Файловый менеджер - Редактировать - /var/www/html/script.zip
Ðазад
PK ! �aP' ' build_exe.txtnu �[��� # go build with -o and -buildmode=exe should report an error on a non-main package. ! go build -buildmode=exe -o out$GOEXE ./not_main stderr '-buildmode=exe requires exactly one main package' ! exists out$GOEXE ! go build -buildmode=exe -o out$GOEXE ./main_one ./main_two stderr '-buildmode=exe requires exactly one main package' ! exists out$GOEXE -- go.mod -- module m go 1.16 -- not_main/not_main.go -- package not_main func F() {} -- main_one/main_one.go -- package main func main() {} -- main_two/main_two.go -- package main func main() {} PK ! �g�1� � mod_sum_replaced.txtnu �[��� env GO111MODULE=on # After 'go get', the go.sum file should contain the sum for the module. go get rsc.io/quote@v1.5.0 grep 'rsc.io/quote v1.5.0' go.sum # If we replace the module and run 'go mod tidy', we should get a sum for the replacement. go mod edit -replace rsc.io/quote@v1.5.0=rsc.io/quote@v1.5.1 go mod tidy grep 'rsc.io/quote v1.5.1' go.sum cp go.sum go.sum.tidy # 'go mod vendor' should preserve that sum, and should not need to add any new entries. go mod vendor grep 'rsc.io/quote v1.5.1' go.sum cmp go.sum go.sum.tidy -- go.mod -- module golang.org/issue/27868 require rsc.io/quote v1.5.0 -- main.go -- package main import _ "rsc.io/quote" func main() {} PK ! o�� � link_syso_deps.txtnu �[��� # Test that syso in deps is available to cgo. [!compiler:gc] skip 'requires syso support' [!cgo] skip [short] skip 'invokes system C compiler' # External linking is not supported on linux/ppc64. # See: https://github.com/golang/go/issues/8912 [GOOS:linux] [GOARCH:ppc64] skip cc -c -o syso/x.syso syso/x.c cc -c -o syso2/x.syso syso2/x.c go build m/cgo -- go.mod -- module m go 1.18 -- cgo/x.go -- package cgo // extern void f(void); // extern void g(void); import "C" func F() { C.f() } func G() { C.g() } -- cgo/x2.go -- package cgo import _ "m/syso" -- syso/x.c -- //go:build ignore void f() {} -- syso/x.go -- package syso import _ "m/syso2" -- syso2/x.c -- //go:build ignore void g() {} -- syso2/x.go -- package syso2 PK ! ���� � build_relative_pkgdir.txtnu �[��� env GO111MODULE=off # Regression test for golang.org/issue/21309: accept relative -pkgdir argument. [short] skip mkdir $WORK/gocache env GOCACHE=$WORK/gocache go build -pkgdir=. runtime PK ! 0���� � dist_list_missing.txtnu �[��� # Regression test for #60939: when 'go tool dist' is missing, # 'go tool dist list' should inject its output. # Set GOROOT to a directory that definitely does not include # a compiled 'dist' tool. 'go tool dist list' should still # work, because 'cmd/go' itself can impersonate this command. mkdir $WORK/goroot/bin mkdir $WORK/goroot/pkg/tool/${GOOS}_${GOARCH} env GOROOT=$WORK/goroot ! go tool -n dist stderr 'go: no such tool "dist"' go tool dist list stdout linux/amd64 cp stdout tool.txt go tool dist list -v stdout linux/amd64 cp stdout tool-v.txt go tool dist list -broken stdout $GOOS/$GOARCH cp stdout tool-broken.txt go tool dist list -json stdout '"GOOS": "linux",\n\s*"GOARCH": "amd64",\n' cp stdout tool-json.txt go tool dist list -json -broken stdout '"GOOS": "'$GOOS'",\n\s*"GOARCH": "'$GOARCH'",\n' cp stdout tool-json-broken.txt [short] stop # Check against the real cmd/dist as the source of truth. env GOROOT=$TESTGO_GOROOT go build -o dist.exe cmd/dist exec ./dist.exe list cmp stdout tool.txt exec ./dist.exe list -v cmp stdout tool-v.txt exec ./dist.exe list -broken cmp stdout tool-broken.txt exec ./dist.exe list -json cmp stdout tool-json.txt exec ./dist.exe list -json -broken cmp stdout tool-json-broken.txt PK ! �D�r r # mod_list_command_line_arguments.txtnu �[��� # The command-line-arguments package does not belong to a module... cd a go list -f '{{.Module}}' ../b/b.go stdout '^<nil>$' # ... even if the arguments are sources from that module go list -f '{{.Module}}' a.go stdout '^<nil>$' [short] skip # check that the version of command-line-arguments doesn't include a module go build -o a.exe a.go go version -m a.exe stdout '^\tpath\tcommand-line-arguments$' stdout '^\tdep\ta\t\(devel\)\t$' ! stdout mod[^e] -- a/go.mod -- module a go 1.17 -- a/a.go -- package main import "a/dep" func main() { dep.D() } -- a/dep/dep.go -- package dep func D() {} -- b/b.go -- package bPK ! y���� � build_cache_disabled.txtnu �[��� # The build cache is required to build anything. It also may be needed to # initialize the build system, which is needed for commands like 'go env'. # However, there are lots of commands the cache is not needed for, and we # shouldn't require it when it won't be used. # # TODO(golang.org/issue/39882): commands below should work, too. # * go clean -modcache # * go env # * go fix # * go fmt # * go generate # * go get # * go list (without -export or -compiled) env GOCACHE=off # Commands that don't completely load packages should work. go doc fmt stdout Printf ! go tool compile -h stderr usage: go version stdout '^go version' # Module commands that don't load packages should work. go mod init m exists go.mod go mod edit -require rsc.io/quote@v1.5.2 go mod download rsc.io/quote go mod graph stdout rsc.io/quote go mod verify # Commands that load but don't build packages should work. go fmt . go doc . -- main.go -- package main func main() {} PK ! Z�p�I I build_acl_windows.txtnu �[��� [!GOOS:windows] stop [!exec:icacls] skip [!exec:powershell] skip # Create $WORK\guest and give the Guests group full access. # Files created within that directory will have different security attributes by default. mkdir $WORK\guest exec icacls $WORK\guest /grant '*S-1-5-32-546:(oi)(ci)f' env TMP=$WORK\guest env TEMP=$WORK\guest # Build a binary using the guest directory as an intermediate cd TestACL go build -o main.exe main.go # Build the same binary, but write it to the guest directory. go build -o $TMP\main.exe main.go # Read ACLs for the files. exec powershell -Command 'Get-Acl main.exe | Select -expand AccessToString' cp stdout $WORK\exe-acl.txt exec powershell -Command 'Get-Acl main.go | Select -expand AccessToString' cp stdout $WORK\src-acl.txt cd $TMP exec powershell -Command 'Get-Acl main.exe | Select -expand AccessToString' cp stdout $WORK\guest-acl.txt cd $WORK # The executable written to the source directory should have the same ACL as the source file. cmp $WORK\exe-acl.txt $WORK\src-acl.txt # The file written to the guest-allowed directory should give Guests control. grep 'BUILTIN\\Guests\s+Allow' $WORK\guest-acl.txt # The file written to the ordinary directory should not. ! grep 'BUILTIN\\Guests\s+Allow' $WORK\exe-acl.txt -- TestACL/go.mod -- module TestACL -- TestACL/main.go -- package main func main() {} PK ! �U�^o o mod_tidy_compat_ambiguous.txtnu �[��� # https://golang.org/issue/46141: 'go mod tidy' for a Go 1.17 module should by # default preserve enough checksums for the module to be used by Go 1.16. # # We don't have a copy of Go 1.16 handy, but we can simulate it by editing the # 'go' version in the go.mod file to 1.16, without actually updating the # requirements to match. [short] skip env MODFMT='{{with .Module}}{{.Path}} {{.Version}}{{end}}' # For this module, the dependency providing package # example.net/ambiguous/nested/pkg is unambiguous in Go 1.17 (because only one # root of the module graph contains the package), whereas it is ambiguous in # Go 1.16 (because two different modules contain plausible packages and Go 1.16 # does not privilege roots above other dependencies). # # However, the overall build list is identical for both versions. cp go.mod go.mod.orig ! go mod tidy stderr '^go: example\.com/m imports\n\texample\.net/indirect imports\n\texample\.net/ambiguous/nested/pkg loaded from example\.net/ambiguous/nested@v0\.1\.0,\n\tbut go 1.16 would fail to locate it:\n\tambiguous import: found package example\.net/ambiguous/nested/pkg in multiple modules:\n\texample\.net/ambiguous v0.1.0 \(.*\)\n\texample\.net/ambiguous/nested v0.1.0 \(.*\)\n\n' stderr '\n\nTo proceed despite packages unresolved in go 1\.16:\n\tgo mod tidy -e\nIf reproducibility with go 1.16 is not needed:\n\tgo mod tidy -compat=1\.17\nFor other options, see:\n\thttps://golang\.org/doc/modules/pruning\n' cmp go.mod go.mod.orig # If we run 'go mod tidy -e', we should still save enough checksums to run # 'go list -m all' reproducibly with go 1.16, even though we can't list # the specific package. go mod tidy -e ! stderr '\n\tgo mod tidy' cmp go.mod go.mod.orig go list -m all cmp stdout all-m.txt go list -f $MODFMT example.net/ambiguous/nested/pkg stdout '^example.net/ambiguous/nested v0\.1\.0$' ! stderr . go mod edit -go=1.16 go list -m all cmp stdout all-m.txt ! go list -f $MODFMT example.net/ambiguous/nested/pkg stderr '^ambiguous import: found package example\.net/ambiguous/nested/pkg in multiple modules:\n\texample\.net/ambiguous v0\.1\.0 \(.*\)\n\texample\.net/ambiguous/nested v0\.1\.0 \(.*\)\n' # On the other hand, if we use -compat=1.17, 1.16 can't even load # the build list (due to missing checksums). cp go.mod.orig go.mod go mod tidy -compat=1.17 ! stderr . go list -m all cmp stdout all-m.txt go mod edit -go=1.16 ! go list -m all stderr '^go: example\.net/indirect@v0\.1\.0 requires\n\texample\.net/ambiguous@v0\.1\.0: missing go\.sum entry for go\.mod file; to add it:\n\tgo mod download example\.net/ambiguous\n' -- go.mod -- module example.com/m go 1.17 replace example.net/indirect v0.1.0 => ./indirect require example.net/indirect v0.1.0 require example.net/ambiguous/nested v0.1.0 // indirect -- all-m.txt -- example.com/m example.net/ambiguous v0.1.0 example.net/ambiguous/nested v0.1.0 example.net/indirect v0.1.0 => ./indirect -- m.go -- package m import _ "example.net/indirect" -- indirect/go.mod -- module example.net/indirect go 1.17 require example.net/ambiguous v0.1.0 -- indirect/indirect.go -- package indirect import _ "example.net/ambiguous/nested/pkg" PK ! �U�� � mod_gopkg_unstable.txtnu �[��� env GO111MODULE=on cp go.mod.empty go.mod go get gopkg.in/dummy.v2-unstable cp x.go.txt x.go cp go.mod.empty go.mod go list [!net:gopkg.in] skip [!git] skip skip # TODO(#54503): redirect gopkg.in requests to a local server and re-enable. env GOPROXY=direct env GOSUMDB=off go get gopkg.in/macaroon-bakery.v2-unstable/bakery go list -m all stdout 'gopkg.in/macaroon-bakery.v2-unstable v2.0.0-[0-9]+-[0-9a-f]+$' -- go.mod.empty -- module m -- x.go.txt -- package x import _ "gopkg.in/dummy.v2-unstable" PK ! ީ~Mx x gopath_std_vendor.txtnu �[��� env GO111MODULE=off [!compiler:gc] skip go list -f '{{.Dir}}' vendor/golang.org/x/net/http2/hpack stdout $GOPATH[/\\]src[/\\]vendor # A package importing 'net/http' should resolve its dependencies # to the package 'vendor/golang.org/x/net/http2/hpack' within GOROOT. cd importnethttp go list -deps -f '{{.ImportPath}} {{.Dir}}' stdout ^vendor/golang.org/x/net/http2/hpack stdout $GOROOT[/\\]src[/\\]vendor[/\\]golang.org[/\\]x[/\\]net[/\\]http2[/\\]hpack ! stdout $GOPATH[/\\]src[/\\]vendor # In the presence of $GOPATH/src/vendor/golang.org/x/net/http2/hpack, # a package in GOPATH importing 'golang.org/x/net/http2/hpack' should # resolve its dependencies in GOPATH/src. cd ../issue16333 go build . go list -deps -f '{{.ImportPath}} {{.Dir}}' . stdout $GOPATH[/\\]src[/\\]vendor[/\\]golang.org[/\\]x[/\\]net[/\\]http2[/\\]hpack ! stdout $GOROOT[/\\]src[/\\]vendor go list -test -deps -f '{{.ImportPath}} {{.Dir}}' . stdout $GOPATH[/\\]src[/\\]vendor[/\\]golang.org[/\\]x[/\\]net[/\\]http2[/\\]hpack ! stdout $GOROOT[/\\]src[/\\]vendor -- issue16333/issue16333.go -- package vendoring17 import _ "golang.org/x/net/http2/hpack" -- issue16333/issue16333_test.go -- package vendoring17 import _ "testing" import _ "golang.org/x/net/http2/hpack" -- importnethttp/http.go -- package importnethttp import _ "net/http" -- $GOPATH/src/vendor/golang.org/x/net/http2/hpack/hpack.go -- package hpack PK ! (`�4� � mod_install_pkg_version.txtnu �[��� # 'go install pkg@version' works outside a module. env GO111MODULE=auto go install example.com/cmd/a@v1.0.0 exists $GOPATH/bin/a$GOEXE rm $GOPATH/bin # 'go install pkg@version' reports an error if modules are disabled. env GO111MODULE=off ! go install example.com/cmd/a@v1.0.0 stderr '^go: modules disabled by GO111MODULE=off; see ''go help modules''$' env GO111MODULE=auto # 'go install pkg@version' ignores go.mod in current directory. cd m cp go.mod go.mod.orig ! go list -m all stderr '^go: example.com/cmd@v1.1.0-doesnotexist: reading http.*/mod/example.com/cmd/@v/v1.1.0-doesnotexist.info: 404 Not Found\n\tserver response: 404 page not found$' stderr '^go: example.com/cmd@v1.1.0-doesnotexist: missing go.sum entry for go.mod file; to add it:\n\tgo mod download example.com/cmd$' go install example.com/cmd/a@latest cmp go.mod go.mod.orig exists $GOPATH/bin/a$GOEXE go version -m $GOPATH/bin/a$GOEXE stdout '^\tmod\texample.com/cmd\tv1.0.0\t' # "latest", not from go.mod rm $GOPATH/bin/a cd .. # 'go install -modfile=x.mod pkg@version' reports an error, but only if # -modfile is specified explicitly on the command line. cd m env GOFLAGS=-modfile=go.mod go install example.com/cmd/a@latest # same as above env GOFLAGS= ! go install -modfile=go.mod example.com/cmd/a@latest stderr '^go: -modfile cannot be used with commands that ignore the current module$' cd .. # Every test case requires linking, so we only cover the most important cases # when -short is set. [short] stop # 'go install pkg@version' works on a module that doesn't have a go.mod file # and with a module whose go.mod file has missing requirements. # With a proxy, the two cases are indistinguishable. go install rsc.io/fortune@v1.0.0 stderr '^go: found rsc.io/quote in rsc.io/quote v1.5.2$' exists $GOPATH/bin/fortune$GOEXE ! exists $GOPATH/pkg/mod/rsc.io/fortune@v1.0.0/go.mod # no go.mod file go version -m $GOPATH/bin/fortune$GOEXE stdout '^\tdep\trsc.io/quote\tv1.5.2\t' # latest version of fortune's dependency rm $GOPATH/bin # 'go install dir@version' works like a normal 'go install' command if # dir is a relative or absolute path. env GO111MODULE=on go mod download rsc.io/fortune@v1.0.0 ! go install $GOPATH/pkg/mod/rsc.io/fortune@v1.0.0 stderr '^go: go\.mod file not found in current directory or any parent directory; see ''go help modules''$' ! go install ../pkg/mod/rsc.io/fortune@v1.0.0 stderr '^go: go\.mod file not found in current directory or any parent directory; see ''go help modules''$' mkdir tmp cd tmp go mod init tmp go mod edit -require=rsc.io/fortune@v1.0.0 ! go install -mod=readonly $GOPATH/pkg/mod/rsc.io/fortune@v1.0.0 stderr '^missing go\.sum entry for module providing package rsc\.io/fortune; to add:\n\tgo mod download rsc\.io/fortune$' ! go install -mod=readonly ../../pkg/mod/rsc.io/fortune@v1.0.0 stderr '^missing go\.sum entry for module providing package rsc\.io/fortune; to add:\n\tgo mod download rsc\.io/fortune$' go get rsc.io/fortune@v1.0.0 go install -mod=readonly $GOPATH/pkg/mod/rsc.io/fortune@v1.0.0 exists $GOPATH/bin/fortune$GOEXE cd .. rm tmp rm $GOPATH/bin env GO111MODULE=auto # 'go install pkg@version' reports errors for meta packages, std packages, # and directories. ! go install std@v1.0.0 stderr '^go: std@v1.0.0: argument must be a package path, not a meta-package$' ! go install fmt@v1.0.0 stderr '^go: fmt@v1.0.0: argument must not be a package in the standard library$' ! go install example.com//cmd/a@v1.0.0 stderr '^go: example.com//cmd/a@v1.0.0: argument must be a clean package path$' ! go install example.com/cmd/a@v1.0.0 ./x@v1.0.0 stderr '^go: ./x@v1.0.0: argument must be a package path, not a relative path$' ! go install example.com/cmd/a@v1.0.0 $GOPATH/src/x@v1.0.0 stderr '^go: '$WORK'[/\\]gopath/src/x@v1.0.0: argument must be a package path, not an absolute path$' ! go install example.com/cmd/a@v1.0.0 cmd/...@v1.0.0 stderr '^package cmd/go not provided by module example.com/cmd@v1.0.0$' # 'go install pkg@version' should accept multiple arguments but report an error # if the version suffixes are different, even if they refer to the same version. go install example.com/cmd/a@v1.0.0 example.com/cmd/b@v1.0.0 exists $GOPATH/bin/a$GOEXE exists $GOPATH/bin/b$GOEXE rm $GOPATH/bin env GO111MODULE=on go list -m example.com/cmd@latest stdout '^example.com/cmd v1.0.0$' env GO111MODULE=auto ! go install example.com/cmd/a@v1.0.0 example.com/cmd/b@latest stderr '^go: example.com/cmd/b@latest: all arguments must refer to packages in the same module at the same version \(@v1.0.0\)$' # 'go install pkg@version' should report an error if the arguments are in # different modules. ! go install example.com/cmd/a@v1.0.0 rsc.io/fortune@v1.0.0 stderr '^package rsc.io/fortune provided by module rsc.io/fortune@v1.0.0\n\tAll packages must be provided by the same module \(example.com/cmd@v1.0.0\).$' # 'go install pkg@version' should report an error if an argument is not # a main package. ! go install example.com/cmd/a@v1.0.0 example.com/cmd/err@v1.0.0 stderr '^package example.com/cmd/err is not a main package$' # Wildcards should match only main packages. This module has a non-main package # with an error, so we'll know if that gets built. mkdir tmp cd tmp go mod init m go get example.com/cmd@v1.0.0 ! go build example.com/cmd/... stderr 'err[/\\]err.go:3:9: undefined: DoesNotCompile( .*)?$' cd .. go install example.com/cmd/...@v1.0.0 exists $GOPATH/bin/a$GOEXE exists $GOPATH/bin/b$GOEXE rm $GOPATH/bin # If a wildcard matches no packages, we should see a warning. ! go install example.com/cmd/nomatch...@v1.0.0 stderr '^go: example.com/cmd/nomatch\.\.\.@v1.0.0: module example.com/cmd@v1.0.0 found, but does not contain packages matching example.com/cmd/nomatch\.\.\.$' go install example.com/cmd/a@v1.0.0 example.com/cmd/nomatch...@v1.0.0 stderr '^go: warning: "example.com/cmd/nomatch\.\.\." matched no packages$' # If a wildcard matches only non-main packages, we should see a different warning. go install example.com/cmd/err...@v1.0.0 stderr '^go: warning: "example.com/cmd/err\.\.\." matched only non-main packages$' # 'go install pkg@version' should report errors if the module contains # replace or exclude directives. go mod download example.com/cmd@v1.0.0-replace ! go install example.com/cmd/a@v1.0.0-replace cmp stderr replace-err go mod download example.com/cmd@v1.0.0-exclude ! go install example.com/cmd/a@v1.0.0-exclude cmp stderr exclude-err # 'go install pkg@version' should report an error if the module requires a # higher version of itself. ! go install example.com/cmd/a@v1.0.0-newerself stderr '^go: example.com/cmd/a@v1.0.0-newerself: version constraints conflict:\n\texample.com/cmd@v1.0.0-newerself requires example.com/cmd@v1.0.0, but v1.0.0-newerself is requested$' # 'go install pkg@version' will only match a retracted version if it's # explicitly requested. env GO111MODULE=on go list -m -versions example.com/cmd ! stdout v1.9.0 go list -m -versions -retracted example.com/cmd stdout v1.9.0 go install example.com/cmd/a@latest go version -m $GOPATH/bin/a$GOEXE stdout '^\tmod\texample.com/cmd\tv1.0.0\t' go install example.com/cmd/a@v1.9.0 go version -m $GOPATH/bin/a$GOEXE stdout '^\tmod\texample.com/cmd\tv1.9.0\t' env GO111MODULE= # 'go install pkg@version' succeeds when -mod=readonly is set explicitly. # Verifies #43278. go install -mod=readonly example.com/cmd/a@v1.0.0 -- m/go.mod -- module m go 1.16 require example.com/cmd v1.1.0-doesnotexist -- x/x.go -- package main func main() {} -- replace-err -- go: example.com/cmd/a@v1.0.0-replace (in example.com/cmd@v1.0.0-replace): The go.mod file for the module providing named packages contains one or more replace directives. It must not contain directives that would cause it to be interpreted differently than if it were the main module. -- exclude-err -- go: example.com/cmd/a@v1.0.0-exclude (in example.com/cmd@v1.0.0-exclude): The go.mod file for the module providing named packages contains one or more exclude directives. It must not contain directives that would cause it to be interpreted differently than if it were the main module. PK ! ����� � cgo_stale_precompiled.txtnu �[��� # Regression test for https://go.dev/issue/47215 and https://go.dev/issue/50183: # A mismatched $GOROOT_FINAL or missing $CC caused the C dependencies of the net # package to appear stale, and it could not be rebuilt due to a missing $CC. [!cgo] skip # This test may start with the runtime/cgo package already stale. # Explicitly rebuild it to ensure that it is cached. # (See https://go.dev/issue/50892.) # # If running in non-short mode, explicitly vary CGO_CFLAGS # as a control case (to ensure that our regexps do catch rebuilds). [!short] env GOCACHE=$WORK/cache [!short] env CGO_CFLAGS=-DTestScript_cgo_stale_precompiled=true go build -x runtime/cgo [!short] stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo' # https://go.dev/issue/50183: a mismatched GOROOT_FINAL caused net to be stale. env oldGOROOT_FINAL=$GOROOT_FINAL env GOROOT_FINAL=$WORK${/}goroot go build -x runtime/cgo ! stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo' env GOROOT_FINAL=$oldGOROOT_FINAL # https://go.dev/issue/47215: a missing $(go env CC) caused the precompiled net # to be stale. But as of https://go.dev/cl/452457 the precompiled libraries are # no longer installed anyway! Since we're requiring a C compiler in order to # build and use cgo libraries in the standard library, we should make sure it # matches what's in the cache. [abscc] stop env CGO_ENABLED=1 env CC='' [!GOOS:plan9] env PATH='' # Guaranteed not to include $(go env CC)! [GOOS:plan9] env path='' ! go build -x runtime/cgo stderr 'C compiler .* not found' PK ! ;�uӨ � # test_race_cover_mode_issue20435.txtnu �[��� [short] skip [!race] skip # Make sure test is functional. go test testrace # Now, check that -race -covermode=set is not allowed. ! go test -race -covermode=set testrace stderr '-covermode must be "atomic", not "set", when -race is enabled' ! stdout PASS ! stderr PASS -- go.mod -- module testrace go 1.16 -- race_test.go -- package testrace import "testing" func TestRace(t *testing.T) { for i := 0; i < 10; i++ { c := make(chan int) x := 1 go func() { x = 2 c <- 1 }() x = 3 <-c _ = x } } func BenchmarkRace(b *testing.B) { for i := 0; i < b.N; i++ { c := make(chan int) x := 1 go func() { x = 2 c <- 1 }() x = 3 <-c _ = x } } PK ! b$�! ! work_use_only_dirs.txtnu �[��� ! go work use foo bar baz stderr '^go: foo is not a directory' stderr '^go: directory baz does not exist' cmp go.work go.work_want ! go work use -r qux stderr '^go: qux is not a directory' -- go.work -- go 1.18 -- go.work_want -- go 1.18 -- foo -- -- qux -- -- bar/go.mod -- module bar PK ! �ԕ� mod_sumdb_golang.txtnu �[��� # Test default GOPROXY and GOSUMDB [go-builder] env GOPROXY= [go-builder] env GOSUMDB= [go-builder] go env GOPROXY [go-builder] stdout '^https://proxy.golang.org,direct$' [go-builder] go env GOSUMDB [go-builder] stdout '^sum.golang.org$' [go-builder] env GOPROXY=https://proxy.golang.org [go-builder] go env GOSUMDB [go-builder] stdout '^sum.golang.org$' # Download direct from github. [!net:proxy.golang.org] skip [!net:sum.golang.org] skip [!git] skip env GOSUMDB=sum.golang.org env GOPROXY=direct go get rsc.io/quote@v1.5.2 cp go.sum saved.sum # Download from proxy.golang.org with go.sum entry already. # Use 'go list' instead of 'go get' since the latter may download extra go.mod # files not listed in go.sum. go clean -modcache env GOSUMDB=sum.golang.org env GOPROXY=https://proxy.golang.org,direct go list -x -m all # Download go.mod files. ! stderr github stderr proxy.golang.org/rsc.io/quote ! stderr sum.golang.org/tile ! stderr sum.golang.org/lookup/rsc.io/quote go list -x -deps rsc.io/quote # Download module source. ! stderr github stderr proxy.golang.org/rsc.io/quote ! stderr sum.golang.org/tile ! stderr sum.golang.org/lookup/rsc.io/quote cmp go.sum saved.sum # Download again. # Should use the checksum database to validate new go.sum lines, # but not need to fetch any new data from the proxy. rm go.sum go list -mod=mod -x -m all # Add checksums for go.mod files. stderr sum.golang.org/tile ! stderr github ! stderr proxy.golang.org/rsc.io/quote stderr sum.golang.org/lookup/rsc.io/quote go list -mod=mod -x rsc.io/quote # Add checksums for module source. ! stderr . # Adds checksums, but for entities already in the module cache. cmp go.sum saved.sum # test fallback to direct env TESTGOPROXY404=1 go clean -modcache rm go.sum go list -mod=mod -x -m all # Download go.mod files stderr 'proxy.golang.org.*404 testing' stderr github.com/rsc go list -mod=mod -x rsc.io/quote # Download module source. stderr 'proxy.golang.org.*404 testing' stderr github.com/rsc cmp go.sum saved.sum -- go.mod -- module m PK ! U� test_benchmark_1x.txtnu �[��� # Test that -benchtime 1x only runs a total of 1 loop iteration. # See golang.org/issue/32051. go test -run ^$ -bench . -benchtime 1x -- go.mod -- module bench go 1.16 -- x_test.go -- package bench import ( "fmt" "os" "testing" ) var called = false func TestMain(m *testing.M) { m.Run() if !called { fmt.Println("benchmark never called") os.Exit(1) } } func Benchmark(b *testing.B) { if b.N > 1 { b.Fatalf("called with b.N=%d; want b.N=1 only", b.N) } if called { b.Fatal("called twice") } called = true } PK ! �#�� mod_init_empty.txtnu �[��� env GO111MODULE=on env GOPATH=$WORK${/}invalid-gopath go list -m stdout '^example.com$' go list stdout '^example.com$' -- go.mod -- module example.com go 1.13 -- main.go -- package main func main() {} -- $WORK/invalid-gopath This is a text file, not a directory. PK ! �}&� � list_importmap.txtnu �[��� env GO111MODULE=off # gccgo does not have standard packages. [compiler:gccgo] skip # fmt should have no rewritten imports. # The import from a/b should map c/d to a's vendor directory. go list -f '{{.ImportPath}}: {{.ImportMap}}' fmt a/b stdout 'fmt: map\[\]' stdout 'a/b: map\[c/d:a/vendor/c/d\]' # flag [fmt.test] should import fmt [fmt.test] as fmt # fmt.test should import testing [fmt.test] as testing # fmt.test should not import a modified os go list -deps -test -f '{{.ImportPath}} MAP: {{.ImportMap}}{{"\n"}}{{.ImportPath}} IMPORT: {{.Imports}}' fmt stdout '^flag \[fmt\.test\] MAP: map\[fmt:fmt \[fmt\.test\]\]' stdout '^fmt\.test MAP: map\[(.* )?testing:testing \[fmt\.test\]' ! stdout '^fmt\.test MAP: map\[(.* )?os:' stdout '^fmt\.test IMPORT: \[fmt \[fmt\.test\] fmt_test \[fmt\.test\] os reflect testing \[fmt\.test\] testing/internal/testdeps \[fmt\.test\]\]' -- a/b/b.go -- package b import _ "c/d" -- a/vendor/c/d/d.go -- package d PK ! E�c�j j mod_get_issue48511.txtnu �[��� # Regression test for https://golang.org/issue/48511: # requirement minimization was accidentally replacing previous # versions of the main module, causing dependencies to be # spuriously dropping during requirement minimization and # leading to an infinite loop. cp go.mod go.mod.orig go mod tidy cmp go.mod go.mod.orig go get -u=patch ./... cmp go.mod go.mod.want -- go.mod -- module example.net/m go 1.16 replace ( example.net/a v0.1.0 => ./a example.net/b v0.1.0 => ./b example.net/b v0.1.1 => ./b example.net/m v0.1.0 => ./m1 ) require example.net/a v0.1.0 -- go.mod.want -- module example.net/m go 1.16 replace ( example.net/a v0.1.0 => ./a example.net/b v0.1.0 => ./b example.net/b v0.1.1 => ./b example.net/m v0.1.0 => ./m1 ) require ( example.net/a v0.1.0 example.net/b v0.1.1 // indirect ) -- m.go -- package m import "example.net/a" -- m1/go.mod -- module example.net/m go 1.16 require example.net/b v0.1.0 -- a/go.mod -- module example.net/a go 1.16 require example.net/m v0.1.0 -- a/a.go -- package a import "example.net/b" -- b/go.mod -- module example.net/b go 1.16 -- b/b.go -- package b PK ! �&�b� � build_internal.txtnu �[��� # Test internal package errors are handled cd testinternal3 go list . stdout 'testinternal3' # Test internal cache cd ../testinternal4 ! go build testinternal4/p stderr 'internal' # Test internal packages outside GOROOT are respected cd ../testinternal2 env GO111MODULE=off ! go build -v . stderr 'p\.go:3:8: use of internal package .*internal/w not allowed' env GO111MODULE='' [compiler:gccgo] skip # gccgo does not have GOROOT cd ../testinternal ! go build -v . stderr 'p\.go:3:8: use of internal package net/http/internal not allowed' -- testinternal/go.mod -- module testinternal go 1.16 -- testinternal/p.go -- package p import _ "net/http/internal" -- testinternal2/go.mod -- module testinternal2 go 1.16 -- testinternal2/p.go -- package p import _ "./x/y/z/internal/w" -- testinternal2/x/y/z/internal/w/w.go -- package w -- testinternal3/go.mod -- module testinternal3 go 1.16 -- testinternal3/t.go -- package t import _ "internal/does-not-exist" -- testinternal4/go.mod -- module testinternal4 go 1.16 -- testinternal4/p/p.go -- package p import ( _ "testinternal4/q/internal/x" _ "testinternal4/q/j" ) -- testinternal4/q/internal/x/x.go -- package x -- testinternal4/q/j/j.go -- package j import _ "testinternal4/q/internal/x" PK ! G< H[ [ build_cache_gomips.txtnu �[��� env GO111MODULE=off [short] skip # rebuilds std for mips # Set up fresh GOCACHE. env GOCACHE=$WORK/gocache mkdir $GOCACHE # Building for mipsle without setting GOMIPS will use floating point registers. env GOARCH=mipsle env GOOS=linux go build -gcflags=-S f.go stderr ADDD.F[0-9]+,.F[0-9]+,.F[0-9]+ # Clean cache go clean -cache # Building with GOMIPS=softfloat will not use floating point registers env GOMIPS=softfloat go build -gcflags=-S f.go ! stderr ADDD.F[0-9]+,.F[0-9]+,.F[0-9]+ # Clean cache go clean -cache # Build without setting GOMIPS env GOMIPS= go build -gcflags=-S f.go stderr ADDD.F[0-9]+,.F[0-9]+,.F[0-9]+ # Building with GOMIPS should still not use floating point registers. env GOMIPS=softfloat go build -gcflags=-S f.go ! stderr ADDD.F[0-9]+,.F[0-9]+,.F[0-9]+ -- f.go -- package f func F(x float64) float64 { return x + x } PK ! <yRZ[ [ mod_sum_lookup.txtnu �[��� # When we attempt to resolve an import that doesn't exist, we should not save # hashes for downloaded modules. # Verifies golang.org/issue/36260. # TODO(golang.org/issue/26603): use 'go mod tidy -e' when implemented. go list -e -mod=mod -tags=ignore ./noexist ! exists go.sum # When an import is resolved successfully, we should only save hashes for # the module that provides the package, not for other modules looked up. # Verifies golang.org/issue/31580. go get ./exist grep '^example.com/join v1.1.0 h1:' go.sum ! grep '^example.com/join/subpkg' go.sum cp go.sum go.list.sum go mod tidy cmp go.sum go.list.sum -- go.mod -- module m go 1.15 -- noexist/use.go -- // ignore tags prevents errors in 'go mod tidy' // +build ignore package use import _ "example.com/join/subpkg/noexist" -- exist/use.go -- package use import _ "example.com/join/subpkg" PK ! �7{/ / work_disablevendor.txtnu �[��� # Test that mod=vendor is disabled in workspace mode, even # with a single workspace module. cd workspace # Base case: ensure the module would default to mod=vendor # outside of workspace mode. env GOWORK=off go list -f '{{.Dir}}' example.com/dep stdout $GOPATH[\\/]src[\\/]workspace[\\/]vendor[\\/]example.com[\\/]dep # Test case: endure the module does not enter mod=vendor outside # worspace mode. env GOWORK='' go list -f '{{.Dir}}' example.com/dep stdout $GOPATH[\\/]src[\\/]dep -- workspace/go.work -- use . replace example.com/dep => ../dep -- workspace/main.go -- package main import "example.com/dep" func main() { dep.Dep() } -- workspace/go.mod -- module example.com/mod go 1.20 require example.com/dep v1.0.0 -- workspace/vendor/example.com/dep/dep.go -- package dep import "fmt" func Dep() { fmt.Println("the vendored dep") } -- workspace/vendor/modules.txt -- # example.com/dep v1.0.0 ## explicit example.com/dep -- dep/go.mod -- module example.com/dep -- dep/dep.go -- package dep import "fmt" func Dep () { fmt.Println("the real dep") } PK ! @��g g list_empty_import.txtnu �[��� ! go list a.go ! stdout . stderr 'invalid import path' ! stderr panic -- a.go -- package a import "" PK ! m���� � build_test_only.txtnu �[��� # Named explicitly, test-only packages should be reported as # unbuildable/uninstallable, even if there is a wildcard also matching. ! go build m/testonly m/testonly... stderr 'no non-test Go files in' ! go install ./testonly stderr 'no non-test Go files in' # Named through a wildcard, the test-only packages should be silently ignored. go build m/testonly... go install ./testonly... -- go.mod -- module m go 1.16 -- testonly/t_test.go -- package testonly -- testonly2/t.go -- package testonly2 PK ! �p�{ { mod_vendor_embed.txtnu �[��� go mod vendor cmp vendor/example.com/a/samedir_embed.txt a/samedir_embed.txt cmp vendor/example.com/a/subdir/embed.txt a/subdir/embed.txt cmp vendor/example.com/a/subdir/test/embed.txt a/subdir/test/embed.txt cmp vendor/example.com/a/subdir/test/xtest/embed.txt a/subdir/test/xtest/embed.txt cd broken_no_matching_files ! go mod vendor stderr 'go: pattern foo.txt: no matching files found' cd ../broken_bad_pattern ! go mod vendor stderr 'go: pattern ../foo.txt: invalid pattern syntax' cd ../embed_go122 go mod vendor cmp vendor/example.com/a/samedir_embed.txt ../a/samedir_embed.txt cmp vendor/example.com/a/subdir/embed.txt ../a/subdir/embed.txt ! exists vendor/example.com/a/subdir/test/embed.txt ! exists vendor/example.com/a/subdir/test/xtest/embed.txt -- embed_go122/go.mod -- module example.com/foo go 1.22 require ( example.com/a v0.1.0 ) replace ( example.com/a v0.1.0 => ../a ) -- embed_go122/foo.go -- package main import ( "fmt" "example.com/a" ) func main() { fmt.Println(a.Str()) } # matchPotentialSourceFile prunes out tests and unbuilt code. # Make sure that they are vendored if they are embedded files. cd ../embed_unbuilt go mod vendor cmp vendor/example.com/dep/unbuilt.go dep/unbuilt.go cmp vendor/example.com/dep/dep_test.go dep/dep_test.go ! exists vendor/example.com/dep/not_embedded_unbuilt.go ! exists vendor/example.com/dep/not_embedded_dep_test.go -- go.mod -- module example.com/foo go 1.16 require ( example.com/a v0.1.0 ) replace ( example.com/a v0.1.0 => ./a ) -- foo.go -- package main import ( "fmt" "example.com/a" ) func main() { fmt.Println(a.Str()) } -- a/go.mod -- module example.com/a -- a/a.go -- package a import _ "embed" //go:embed samedir_embed.txt var sameDir string //go:embed subdir/embed.txt var subDir string func Str() string { return sameDir + subDir } -- a/a_test.go -- package a import _ "embed" //go:embed subdir/test/embed.txt var subderTest string -- a/a_x_test.go -- package a_test import _ "embed" //go:embed subdir/test/xtest/embed.txt var subdirXtest string -- a/samedir_embed.txt -- embedded file in same directory as package -- a/subdir/embed.txt -- embedded file in subdirectory of package -- a/subdir/test/embed.txt -- embedded file of test in subdirectory of package -- a/subdir/test/xtest/embed.txt -- embedded file of xtest in subdirectory of package -- broken_no_matching_files/go.mod -- module example.com/broken go 1.16 require ( example.com/brokendep v0.1.0 ) replace ( example.com/brokendep v0.1.0 => ./brokendep ) -- broken_no_matching_files/f.go -- package broken import _ "example.com/brokendep" func F() {} -- broken_no_matching_files/brokendep/go.mod -- module example.com/brokendep go 1.16 -- broken_no_matching_files/brokendep/f.go -- package brokendep import _ "embed" //go:embed foo.txt var foo string -- broken_bad_pattern/go.mod -- module example.com/broken go 1.16 require ( example.com/brokendep v0.1.0 ) replace ( example.com/brokendep v0.1.0 => ./brokendep ) -- broken_bad_pattern/f.go -- package broken import _ "example.com/brokendep" func F() {} -- broken_bad_pattern/brokendep/go.mod -- module example.com/brokendep go 1.16 -- broken_bad_pattern/brokendep/f.go -- package brokendep import _ "embed" //go:embed ../foo.txt var foo string -- embed_unbuilt/go.mod -- module example.com/foo go 1.16 require ( example.com/dep v0.1.0 ) replace ( example.com/dep v0.1.0 => ./dep ) -- embed_unbuilt/foo.go -- package a import _ "example.com/dep" func F() {} -- embed_unbuilt/dep/go.mod -- module example.com/dep go 1.16 -- embed_unbuilt/dep/dep.go -- package dep import _ "embed" //go:embed unbuilt.go var unbuilt string //go:embed dep_test.go var depTest string -- embed_unbuilt/dep/unbuilt.go -- // +build ignore package dep -- embed_unbuilt/dep/not_embedded_unbuilt.go -- // +build ignore package dep -- embed_unbuilt/dep/dep_test.go -- package dep -- embed_unbuilt/dep/not_embedded_dep_test.go -- package dep PK ! ʾ�� � mod_get_issue60490.txtnu �[��� # Regression test for https://go.dev/issue/60490: 'go get' should not cause an # infinite loop for cycles introduced in the pruned module graph. go get example.net/c@v0.1.0 -- go.mod -- module example go 1.19 require ( example.net/a v0.1.0 example.net/b v0.1.0 ) replace ( example.net/a v0.1.0 => ./a1 example.net/a v0.2.0 => ./a2 example.net/b v0.1.0 => ./b1 example.net/b v0.2.0 => ./b2 example.net/c v0.1.0 => ./c1 ) -- a1/go.mod -- module example.net/a go 1.19 -- a2/go.mod -- module example.net/a go 1.19 require example.net/b v0.2.0 -- b1/go.mod -- module example.net/b go 1.19 -- b2/go.mod -- module example.net/b go 1.19 require example.net/a v0.2.0 -- c1/go.mod -- module example.net/c go 1.19 require example.net/a v0.2.0 PK ! �BXs s mod_get_patchcycle.txtnu �[��� # If a patch of a module requires a higher version of itself, # it should be reported as its own conflict. # # This case is weird and unlikely to occur often at all, but it should not # spuriously succeed. # (It used to print v0.1.1 but then silently upgrade to v0.2.0.) ! go get example.net/a@patch stderr '^go: example.net/a@patch \(v0.1.1\) indirectly requires example.net/a@v0.2.0, not example.net/a@patch \(v0.1.1\)$' # TODO: A mention of b v0.1.0 would be nice. -- go.mod -- module example go 1.16 require example.net/a v0.1.0 replace ( example.net/a v0.1.0 => ./a10 example.net/a v0.1.1 => ./a11 example.net/a v0.2.0 => ./a20 example.net/b v0.1.0 => ./b10 ) -- example.go -- package example import _ "example.net/a" -- a10/go.mod -- module example.net/a go 1.16 -- a10/a.go -- package a -- a11/go.mod -- module example.net/a go 1.16 require example.net/b v0.1.0 -- a11/a.go -- package a import _ "example.net/b" -- a20/go.mod -- module example.net/a go 1.16 -- a20/a.go -- package a -- b10/go.mod -- module example.net/b go 1.16 require example.net/a v0.2.0 -- b10/b.go -- package b import _ "example.net/a" PK ! �V�>