GOLand 搭建Go语言开发环境

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/nimoyaoww/article/details/79116724

Go环境: 1.9.2 

IDE: GoLand

第一步 : GO环境安装

Go环境下载地址:https://www.golangtc.com/download


下载好之后,在命令行窗口执行: go env (查看当前的GO开发环境)


Go 环境安装成功。

第二步:安装 IDE

IDE 下载地址:http://www.jetbrains.com/go/?fromMenu

IDE安装就是平常的傻瓜式安装,这里就不多说了。

第三步:搭建环境

GO环境和IDE安装好之后,两者怎么联系起来呢?????

看图:



GOROOT就是IDE的开发环境,打开IDE的配置之后,就自动填充进来了。

除此之外,还需要配置一下你的开发目录,GOPATH,也就是你程序放的目录。

注意:这个是在环境变量里面配置的。


接下来,你就可以用GOLAND创建工程了,但是在运行的时候,部分人会报这样的错。

# runtime
C:\Go\src\runtime\mstkbar.go:151:10: debug.gcstackbarrieroff undefined (type struct { allocfreetrace int32; cgocheck int32; efence int32; gccheckmark int32; gcpacertrace int32; gcshrinkstackoff int32; gcrescanstacks int32; gcstoptheworld int32; gctrace int32; invalidptr int32; sbrk int32; scavenge int32; scheddetail int32; schedtrace int32 } has no field or method gcstackbarrieroff)
C:\Go\src\runtime\mstkbar.go:162:24: division by zero
C:\Go\src\runtime\mstkbar.go:162:43: invalid expression unsafe.Sizeof(composite literal)
C:\Go\src\runtime\mstkbar.go:162:44: undefined: stkbar
C:\Go\src\runtime\mstkbar.go:212:4: gp.stkbar undefined (type *g has no field or method stkbar)
C:\Go\src\runtime\mstkbar.go:213:15: gp.stkbar undefined (type *g has no field or method stkbar)
C:\Go\src\runtime\mstkbar.go:216:23: undefined: stackBarrierPC
C:\Go\src\runtime\mstkbar.go:226:28: gp.stkbarPos undefined (type *g has no field or method stkbarPos)
C:\Go\src\runtime\mstkbar.go:227:19: gp.stkbarPos undefined (type *g has no field or method stkbarPos)
C:\Go\src\runtime\mstkbar.go:248:41: undefined: stkbar
C:\Go\src\runtime\mstkbar.go:227:19: too many errors
错误原因:
安装的GO环境的时候,将GO安装在非C盘,将GO环境安装在 C 盘之后就不会报这个错误了





猜你喜欢

转载自blog.csdn.net/nimoyaoww/article/details/79116724