主要.go:5:2: 程序包问候语不在 GOROOT 中 (C:\程序文件\转到\src\问候语)
我正在阅读 Head First First go,它被写成在 c:/用户/用户名/go/src/软件包名称和 c:/用户/用户名/go/src/project_name
当我尝试运行
go run main.go从project_name文件夹中,我收到以下错误。main.go:5:2: package greetings is not in GOROOT (C:\Program Files\Go\src\greetings)
C:\Users\agriz>go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\agriz\AppData\Local\go-build
set GOENV=C:\Users\agriz\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\agriz\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\agriz\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.16.7
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
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\agriz\AppData\Local\Temp\go-build2047492330=/tmp/go-build -gno-record-gcc-switches
我不想将代码保存在c驱动器中。我想从 D:/ 运行代码这可能吗?我该怎么做?
白衣非少年
MM们
相关分类