golang/go

proposal: cmd/go: go.mod directive to exclude files from module zips

Opened this issue · 2 comments

Go version

go1.25.4

Output of go env in your module/workspace:

AR='ar'
CC='cc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='c++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/xxx/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/xxx/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/8l/cvrswwhs47l18h6nt67jtrdw0000gn/T/go-build1416362801=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/xxx/work/go/main/go.mod'
GOMODCACHE='/Users/xxx/go/pkg/mod'
GOOS='darwin'
GOPATH='/Users/xxx/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.25.4/libexec'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/xxx/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.25.4/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.25.4'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

I'm trying to use go get on a large monorepo that has ignore directives in its go.mod file. The ignore statements have testdata/ and folders containing zips/binaries/.so files.

What did you see happen?

I am hitting an error message with create zip: module source tree too large (max size is 524288000 bytes).

In mod/zip the ignore directive isn't honored. As a workaround, I put dummy go.mod files to workaround the issue but it is untenable for me to sprinkle these files around the repository.

What did you expect to see?

The ignore directive in go.mod already handles ignoring folders/files for go tooling such as gopls. It would be helpful to honor this for go get as well.

This would be a new proposal
the accepted proposal doesn't exclude files from module zip files #42965 (comment)

Previously rejected as #37724