Skip to content

cmd/go: when a line is set GOPROXY= in the go/env file then GOPROXY is treated as is non-empty #62485

Closed as not planned
@nemith

Description

@nemith

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

$ go version
go version go1.21.0 darwin/arm64

Does this issue reproduce with the latest release?

Yes. I belive this issue is only present on the latest release.

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

go env Output
$ go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/brandonbennett/Library/Caches/go-build'
GOENV='/Users/brandonbennett/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/brandonbennett/.go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/brandonbennett/.go'
GOPRIVATE=''
GOPROXY=''
GOROOT='/opt/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/xv/k7lms_fn08972kd179h5j1zr0000gp/T/go-build406295014=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

I am using go env -w GOPROXY= to try to remove a go/env variable (set it back to default). It updated go/env file with an entry of GOPROXY= .

I then try to use something that needs to proxy like go install -v github.com/cweill/gotests/gotests@v1.6.0

What did you expect to see?

Go should download and install the package with the default GOPROXY settings

What did you see instead?

$ go install -v github.com/cweill/gotests/gotests@v1.6.0
go: github.com/cweill/gotests/gotests@v1.6.0: GOPROXY list is not the empty string, but contains no entries

I think there is probably two potential bugs here:

  1. There should be a way to delete a entry with go env -w
  2. When reading go/env file if the entry exists but is empty, treat it as empty (potentially not a bug but suprising?)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions