go 环境及IDE

windows go环境

环境变量

GOROOT  =  C:\Go\
Path   =   C:\Go\bin
GOPATH  =    D:\goproject    工作目录 , go项目的工作路径

linux go环境

安装配置

wget https://studygolang.com/dl/golang/go1.9.2.linux-amd64.tar.gz
tar xf go1.9.2.linux-amd64.tar.gz -C /usr/local/

vim /etc/profile.d/go.sh
export GOROOT=/usr/local/go
export PATH=$PATH:/usr/local/go/bin
export GOPATH=/opt/goproject

. /etc/profile

测试

hello.go

package main

import "fmt"

func main() {
  fmt.Println("hello world")
}

go run运行

go run hello.go

编译

go build hello.go

二进制运行

./hello

vscode插件

GOPATH路径下安装插件
D:\goproject

go get github.com/nsf/gocode
go get github.com/uudashr/gopkgs/cmd/gopkgs
go get github.com/ramya-rao-a/go-outline
go get github.com/acroca/go-symbols
go get golang.org/x/tools/cmd/guru
go get golang.org/x/tools/cmd/gorename
go get github.com/fatih/gomodifytags
go get github.com/haya14busa/goplay/cmd/goplay
go get github.com/josharian/impl
go get github.com/rogpeppe/godef
go get sourcegraph.com/sqs/goreturns
go get github.com/golang/lint/golint
go get github.com/cweill/gotests
go get github.com/derekparker/delve/cmd/dlv

说明:以上操作如果失败,则执行以下

cd $GOPATH/src/github.com/golang
git clone https://github.com/golang/tools.git

git下载完成后,把$GOPATH/src/github.com/golang/tools目录下的所有文件拷贝到$GOPATH/src/golang.org/x/tools下

go install github.com/nsf/gocode
go install github.com/uudashr/gopkgs/cmd/gopkgs
go install github.com/ramya-rao-a/go-outline
go install github.com/acroca/go-symbols
go install golang.org/x/tools/cmd/guru
go install golang.org/x/tools/cmd/gorename
go install github.com/fatih/gomodifytags
go install github.com/haya14busa/goplay/cmd/goplay
go install github.com/josharian/impl
go install github.com/rogpeppe/godef
go install sourcegraph.com/sqs/goreturns
go install github.com/golang/lint/golint
go install github.com/cweill/gotests
go install github.com/derekparker/delve/cmd/dlv
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wuxingge

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值