I used export GO111MODULE=on
when i type go get -u github.com/swaggo/swag/cmd/swag
I got go get: disabled by -mod=vendor
so i can't use the go get any more, anyone who can help me?
and my go env
like this:
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/maple/Library/Caches/go-build"
GOEXE=""
GOFLAGS=" -mod=vendor"
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/maple/go"
GOPROXY="https://goproxy.io"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
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 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/b0/gjtsl1sn61977y7xldkg5f540000gn/T/go-build663727012=/tmp/go-build -gno-record-gcc-switches -fno-common"
i found there has a GOFLAGS=" -mod=vendor"
, how can i change it?
Based on my personal setup, until this gets fixed/cleaned up upstream, you can simply unset this flag in your variable, i.e:
$ export GOFLAGS=""
This because you don't have any other flags but -mod currently set.
As per Golang documentation, this setting tells go
to not automatically update go.mod
if an imported module is not found. To disable the read-only mode, you can run
go env -w GOFLAGS=''
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With