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.
Related Issues
- proposal: cmd/go: add ignore directive to go.mod to drop files from module #37724 (closed)
- proposal: x/mod/zip: provide a way to ignore files when creating module zip #50225 (closed)
- cmd/go: skip files tagged `ignore` in `go mod vendor` #31088 (closed)
- cmd/go: get / mod: "module source tree too big" error #40780 (closed)
- cmd/go: does go module support ignoring one sub-directory? #31584 (closed)
- cmd/go: go mod vendor ignore workspace #54452 (closed)
- cmd/go: prune nested modules from git export zipfile #29987 (closed)
- x/exp/cmd/gorelease: ignore .gitignored files when compiling local .zip file #37413 (closed)
- cmd/go: do not update go.mod and go.sum with imports found in .gitignore #42763 (closed)
- cmd/go: build constraint of 'ignore' is special for modules? #29598 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
This would be a new proposal
the accepted proposal doesn't exclude files from module zip files #42965 (comment)
Previously rejected as #37724