| 1 |
# The build cache is required to build anything. It also may be needed to |
| 2 |
# initialize the build system, which is needed for commands like 'go env'. |
| 3 |
# However, there are lots of commands the cache is not needed for, and we |
| 4 |
# shouldn't require it when it won't be used. |
| 5 |
# |
| 6 |
# TODO(golang.org/issue/39882): commands below should work, too. |
| 7 |
# * go clean -modcache |
| 8 |
# * go env |
| 9 |
# * go fix |
| 10 |
# * go fmt |
| 11 |
# * go generate |
| 12 |
# * go get |
| 13 |
# * go list (without -export or -compiled) |
| 14 |
|
| 15 |
env GOCACHE=off |
| 16 |
|
| 17 |
# Commands that don't completely load packages should work. |
| 18 |
go doc fmt |
| 19 |
stdout Printf |
| 20 |
|
| 21 |
! go tool compile -h |
| 22 |
stderr usage: |
| 23 |
|
| 24 |
go version |
| 25 |
stdout '^go version' |
| 26 |
|
| 27 |
|
| 28 |
# Module commands that don't load packages should work. |
| 29 |
go mod init m |
| 30 |
exists go.mod |
| 31 |
|
| 32 |
go mod edit -require rsc.io/[email protected] |
| 33 |
|
| 34 |
go mod download rsc.io/quote |
| 35 |
|
| 36 |
go mod graph |
| 37 |
stdout rsc.io/quote |
| 38 |
|
| 39 |
go mod verify |
| 40 |
|
| 41 |
|
| 42 |
# Commands that load but don't build packages should work. |
| 43 |
go fmt . |
| 44 |
|
| 45 |
go doc . |
| 46 |
|
| 47 |
-- main.go -- |
| 48 |
package main |
| 49 |
|
| 50 |
func main() {} |