可爱鱼os go语言环境 搭建+ goland安装激活

0 环境

  • 系统环境:可爱鱼os

1 参考网址

Debian10 安装Go环境

配置goland脚本

2 go环境搭建

环境搭建 可参考Debian安装Go环境

1 下载 解压安装包

最新安装包地址

# 若没有wget 需要权限,在apt命令前 加sudo 
apt install wget
# 下载包
 wget https://studygolang.com/dl/golang/go1.17.6.linux-amd64.tar.gz 
 # 解压文件 自动创建go文件夹的
 tar xfz go1.17.6.linux-amd64.tar.gz -C /usr/local
# 若是提示权限不足,在tar 前面添加sudo命令
sudo tar xfz go1.17.6.linux-amd64.tar.gz -C /usr/local

wget下载
解压

2 全局变量配置和验证

进入~/.zshrc文件 复制如下 #添加Gopath路径里的三个export 退出保存 激活文件

#修改~/.zshrc
vim ~/.zshrc

#添加Gopath路径
export GOROOT=/usr/local/go #GOROOT是系统上安装Go软件包的位置。
export GOPATH=/root/go #GOPATH是工作目录的位置。
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

# 激活配置
source ~/.zshrc

在这里插入图片描述

注意 回车进入后 先输入i 然后在粘贴进来 GOPATH根据自己喜好配地址 按键盘左上角的Esc 在按:wq 保存退出
在这里插入图片描述
激活配置
在这里插入图片描述
验证
在这里插入图片描述

3 goland安装 配置

1 下载 解压安装包

自己到官网下载 或wget下载
官网

# wget下载
wget https://download.jetbrains.com.cn/go/goland-2021.3.2.tar.gz

# /usr/local/ 下创建jb文件夹
cd /usr/local/
sudo mkdir jb

# 这里注意 你tar.gz的放置位置 不是当前local位置 cd tar.gz父目录 在解压
sudo tar xfz goland-2021.3.2.tar.gz -C /usr/local/jb/

创建文件夹
解压缩

2 添加go.desktop文件

go.desktop文件 根据你电脑本地goland的位置配置Exec Icon即可 会有goland图标 直接点击 就可以了
配置

[Desktop Entry]
Version=212
Encoding=UTF-8
Name=Goland
Comment=Goland
Exec=/usr/local/jb/GoLand-2021.3.2/bin/goland.sh
Icon=/usr/local/jb/GoLand-2021.3.2/bin/goland.png
Terminal=false
Type=Application
Categories=Application;Ut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x7ImNvZGUiOiJQR08iLCJwYWlkVXBUbyI6IjIwMjItMDItMDciLCJleHRlbmRlZCI6dHJ1ZX0seyJjb2RlIjoiUFBDIiwicGFpZFVwVG8iOiIyMDIyLTAyLTA3IiwiZXh0ZW5kZWQiOnRydWV9LHsiY29kZSI6IlBSQiIsInBhaWRVcFRvIjoiMjAyMi0wMi0wNyIsImV4dGVuZGVkIjp0cnVlfSx7ImNvZGUiOiJQU1ciLCJwYWlkVXBUbyI6IjIwMjItMDItMDciLCJleHRlbmRlZCI6dHJ1ZX0seyJjb2RlIjoiUlMiLCJwYWlkVXBUbyI6IjIwMjItMDItMDciLCJleHRlbmRlZCI6dHJ1ZX1dLCJtZXRhZGF0YSI6IjAxMjAyMjAxMDhQUEFNMDAwMDA1IiwiaGFzaCI6IjI5ODE1OTE4LzA6OTMyMDU1NTgzIiwiZ3JhY2VQZXJpb2REYXlzIjo3LCJhdXRvUHJvbG9uZ2F0ZWQiOmZhbHNlLCJpc0F1dG9Qcm9sb25nYXRlZCI6ZmFsc2V9

成功效果

5 运行go

1 简单字体配置(ctrl + alt + s进入setttings界面)

配置

2 编写测试

1.go

package main

import "fmt"

func test() int {
	return 1
}

func main() {
	fmt.Println("123")
	fmt.Println(test())
}

运行

posted @ 2022-01-08 15:40  焜掱玚  阅读(418)  评论(0编辑  收藏  举报
levels of contents