GoLand IDE
- 在官网下载
- 在下载目录执行以下命令
sudo tar -zxvf goland-2021.2.2.tar.gz -C /opt/
sudo mv goland-2021.2.2 goland
sudo touch /usr/share/applications/goland.desktop
sudo gedit /usr/share/applications/goland.desktop
[Desktop Entry]
Name=IntelliJ GoLand
Comment=IntelliJ GoLand
Exec=/opt/goland/bin/goland.sh
Icon=/opt/goland/bin/goland.png
Terminal=false
Type=Application
Categories=Developer;
sudo chmod u+x goland.desktop
Go in VS Code
- 官网下载压缩包
- 运行如下命令
sudo tar -zxvf go1.17.linux-amd64.tar.gz -C /opt/
sudo gedit ~/.bashrc
- 加上两行:
export GO_HOME=/opt/go
export PATH=$PATH:$GO_HOME/bin
保存然后使其生效
source ~/. bashrc
- 验证安装是否成功
[bernard@fedora ~]$ go version
go version go1.17 linux/amd64
然后直接在vscode里装go的拓展就可以了,文件尾缀是go。
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
|