今天折腾半天安装goland
参考:
http://c.biancheng.net/view/6170.html
不过激活码好像不work,就随意了,大不了回头再卸载安装一次,海王无所畏惧×
在运行:
package main
import "fmt"
func main() {
/* 这是我的第一个简单的程序 */
fmt.Println("Hello, World!")
}
的时候报错:
go: cannot find main module; see 'go help modules'
点开看:
cannot resolve file 'fmt'
unresolve reference ‘Println’
这我就很委屈了,我直接复制粘贴的。https://www.runoob.com/go/go-program-structure.html
查了一下解决方法,好些个没用。
解决方法:
https://www.taodudu.cc/news/show-1800777.html
在指定目录下
go build
报错 : go: cannot find main module; see ‘go help modules’
解决办法 : go env -w GO111MODULE=off
参考文档:https://goproxy.io/zh/ 和 https://blog.csdn.net/benben_2015/article/details/82227338
本文链接http://www.taodudu.cc/news/show-1800777.html
打开cmd,go env -w GO111MODULE=off:
重新执行,执行结果:
GOROOT=null #gosetup
GOPATH=null #gosetup
go.exe build -i -o D:\SOFTware\GoLand\GOcode\go_build_awesomeProject_.exe . #gosetup
go build: -i flag is deprecated
D:\SOFTware\GoLand\GOcode\go_build_awesomeProject_.exe #gosetup
Hello, World!
Process finished with exit code 0
今日碎碎念:好想开学啊,已经开始思念室友了