简体   繁体   中英

Golang can't install package

I'm trying to get package github.com/faiface/pixel by command:

go get github.com/faiface/pixel

and error appear package github.com/faiface/pixel: mkdir /tomekz: permission denied.
When I try:

sudo go get github.com/faiface/pixel

no error appears, but also there isn't package.
info about golang:

 GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/tomekz/.cache/go-build" GOENV="/home/tomekz/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/tomekz/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/lib/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build118455577=/tmp/go-build -gno-record-gcc-switches"

PS: I use manjaro linux

GOPATH should not be set.
That would make GOPATH be, by default, /home/xxx/go

Right now, it is set to a path which might be owned by root: /xxx/go

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM