背景。
目前我想为golang/go项目做贡献。但是当我在Goland中打开这个项目时,我发现了很多编译错误,比如tar_test.go:11:2: use of internal package internal/testenv not allowed
。但是当我在src
目录下运行execute ./all.bash
时,它显示ALL TESTS PASSED
。所以我很困惑,我错过了什么步骤,我如何在Goland/vscode中正确运行源代码/测试。
环境信息转到环境
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/apple1/Library/Caches/go-build"
GOENV="/Users/apple1/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/apple1/.gvm/pkgsets/go1.19.2/global/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/apple1/.gvm/pkgsets/go1.19.2/global"
GOPRIVATE=""
GOPROXY="https://goproxy.io"
GOROOT="/Users/apple1/go/go1.18.7"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/apple1/go/go1.18.7/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18.7"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/w4/f3kl6pmx4mxbhggc6s7fhrhh0000gp/T/go-build955434052=/tmp/go-build -gno-record-gcc-switches -fno-common"
转到源代码路径
/Users/apple1/develop/go
1条答案
按热度按时间gcmastyq1#
请参阅如何配置GoLand以贡献Go项目的指南:https://www.jetbrains.com/help/go/how-to-use-goland-to-contribute-to-go.html
尤其要注意第2步和第3步,你应该编译Go语言,并在设置中指定它:* 首选项|开始|GOROOT* 以避免假阳性错误。