Skip to content

Can not install go module ! what's problem ? #44856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
watangca opened this issue Mar 8, 2021 · 2 comments
Closed

Can not install go module ! what's problem ? #44856

watangca opened this issue Mar 8, 2021 · 2 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@watangca
Copy link

watangca commented Mar 8, 2021

What version of Go are you using (go version)?

$ go version
go version go1.16 darwin/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/folls/Library/Caches/go-build"
GOENV="/Users/folls/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/folls/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/folls/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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/dr/0hks8_y50xqffqdrtqtpdl3c0000gn/T/go-build2301911714=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOROOT/bin/go version: go version go1.16 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.16
uname -v: Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64
ProductName: macOS
ProductVersion: 11.2.2
BuildVersion: 20D80
lldb --version: lldb-1200.0.44.2
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)

What did you do?

Install go extension module with vscode

What did you expect to see?

What did you see instead?

Error Log

ools environment: GOPATH=/User/folls/Desktop/go
Installing 1 tool at /User/folls/Desktop/go/bin in module mode.
gopls

Installing golang.org/x/tools/gopls FAILED
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "/usr/local/go/bin/go get -v golang.org/x/tools/gopls",
"stdout": "",
"stderr": "go: writing stat cache: mkdir /User: read-only file system\ngo: downloading golang.org/x/tools/gopls v0.6.6\ngo: writing stat cache: mkdir /User: read-only file system\ngo: downloading golang.org/x/tools v0.1.0\ngo get golang.org/x/tools/gopls: mkdir /User: read-only file system\n"
}

1 tools failed to install.

gopls: failed to install gopls(golang.org/x/tools/gopls): Error: Command failed: /usr/local/go/bin/go get -v golang.org/x/tools/gopls
go: writing stat cache: mkdir /User: read-only file system
go: downloading golang.org/x/tools/gopls v0.6.6
go: writing stat cache: mkdir /User: read-only file system
go: downloading golang.org/x/tools v0.1.0
go get golang.org/x/tools/gopls: mkdir /User: read-only file system
no output

@ALTree
Copy link
Member

ALTree commented Mar 8, 2021

The error says "read-only file system"; it looks like Go cannot write files where it needs to. This is probably an issue with your machine, not a Go bug. Does that folder exist? Can you write on it?

@ALTree ALTree added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 8, 2021
@bcmills
Copy link
Contributor

bcmills commented Mar 8, 2021

From the go env output, I believe this is a typo in your GOPATH setting.

I see (emphasis added):

GOCACHE="/Users/folls/Library/Caches/go-build"
GOMODCACHE="/Users/folls/go/pkg/mod"

but:

GOPATH=/User/folls/Desktop/go

So the problem here seems to be that /Users has been typo'd as /User, and the go command cannot create the top-level /User directory (no s) because your root directory is (correctly) not writable.

@bcmills bcmills closed this as completed Mar 8, 2021
@golang golang locked and limited conversation to collaborators Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants