-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
What version of Go are you using (go version)?
$ go version go version devel go1.18-f154f8b Tue Jan 4 22:27:20 2022 +0000 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/gura/Library/Caches/go-build" GOENV="/Users/gura/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/gura/go/pkg/mod" GONOPROXY="*.uangel.com" GONOSUMDB="*.uangel.com" GOOS="darwin" GOPATH="/Users/gura/go" GOPRIVATE="*.uangel.com" GOPROXY="https://proxy.golang.org,direct" GOROOT="/Users/gura/sdk/gotip" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/Users/gura/sdk/gotip/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="devel go1.18-f154f8b Tue Jan 4 22:27:20 2022 +0000" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/gura/test/fp/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/y1/bngm83dj5_5dcsgh9yrwvpm00000gp/T/go-build228120003=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
$ git clone -b build-cache https://github.com/csgura/fp.git
$ cd fp
$ gotip clean -cache
$ du -hs ~/Library/Caches/go-build/
8.0K /Users/gura/Library/Caches/go-build/
$ gotip test ./...
$ du -hs ~/Library/Caches/go-build/
1.4G /Users/gura/Library/Caches/go-build/
What did you expect to see?
A build cache directory of a reasonable size ,
or
Warning about incorrectly used generic type.
What did you see instead?
$ du -hs ~/Library/Caches/go-build/
1.4G /Users/gura/Library/Caches/go-build/
Please excuse my poor English.
It seems to be related to this issue as well. #50204
I have written some algebraic data types to test the generic of Go 1.18.
( https://github.com/csgura/fp.git )
After running the tests, I noticed that the build cache was using a very large amount of disk.
I guess the cause lies in the some recursive type ( HList and curried Func ) and the interface type that uses the type parameter.
When I modified the code so that a generic interface type does not return other generic interface type,
The size of the build cache has been significantly reduced.
This fix is applied in the master branch.
$ git checkout master
$ gotip clean -cache
$ gotip test ./...
$ du -hs ~/Library/Caches/go-build/
176M /Users/gura/Library/Caches/go-build/
It will not become a problem right now, but I think it will become a big problem as more and more projects use generics.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status