golang 12.9 go mod 实践

1. get start

  go mod init    >>  generate go.mod

  export GO111MODULE=on

  

  go run mai.go

  goalng 1.11以后 GO111MODULE defalutl set on

2.依赖包会放置在 $GOPATH/pkg/mod

3. goland 使用会发现外部包一片红色,无法找到引用包。

  解决方案:settings  --->   Go ---> Go modules

  

没有什么是写一万遍还不会的,如果有那就再写一万遍。
原文地址:https://www.cnblogs.com/waken-captain/p/11459609.html