sorry一下一个多月没有学习了,这下接着问老师:
我直接下载coding-180代码下来编译,看见import里面是:
"imooc.com/ccmouse/learngo/lang/queue"
虽然IDE红色下划线提醒找不到module, 但是依然可以运行,这个是直接通过link连接到网络上的包么?并没有用到当前路径下的queue来编译是吧?
然后我把import里面的"imooc.com/ccmouse/learngo/lang/queue"
修改成本地相对路径:"../../queue"
反而报错了:build command-line-arguments: cannot find module for path _/C_/Users/wuzey/IdeaProjects/coding-180-source/lang/queue
我查了下这个路径就是我当前包含queue的路径没有错呢?(C:\Users\wuzey\IdeaProjects\coding-180-source\lang\queue)
或者修改为绝对路径:"lang/queue",结果定位到了GOROOT去了
package lang/queue is not in GOROOT (C:\Go\src\lang\queue)
然后我想重新设置GOROOT到queue的路径下,又说有冲突改不了
C:\Users\wuzey\IdeaProjects\coding-180-source>go env -w GOROOT=C:\Users\wuzey\IdeaProjects
warning: go env -w GOROOT=... does not override conflicting OS environment variable
环境问题十分棘手呀。。。
go env:
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\wuzey\AppData\Local\go-build
set GOENV=C:\Users\wuzey\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\wuzey\IdeaProjects\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\wuzey\IdeaProjects;C:\Users\wuzey\IdeaProjects\go;C:\Users\wuzey\go;C:\Go\src\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\wuzey\IdeaProjects\coding-180-source\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\wuzey\AppData\Local\Temp\go-build
760949206=/tmp/go-build -gno-record-gcc-switches