repo_id
stringclasses 927
values | file_path
stringlengths 99
214
| content
stringlengths 2
4.15M
|
|---|---|---|
y
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/modlegacy/src/new/sub/x/v1/y/y.go
|
package y
|
inner
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/modlegacy/src/new/sub/inner/go.mod
|
module new/sub/inner
|
x
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/modlegacy/src/new/sub/inner/x/x.go
|
package x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_convert_vendor_json.txt
|
env GO111MODULE=on
cd $WORK/test/x
go list -m all
stdout '^m$'
-- $WORK/test/vendor/vendor.json --
{}
-- $WORK/test/x/x.go --
package x // import "m/x"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_convert_vendor_conf.txt
|
env GO111MODULE=on
cd $WORK/test/x
go list -m all
stdout '^m$'
-- $WORK/test/vendor.conf --
-- $WORK/test/x/x.go --
package x // import "m/x"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_convert_glockfile.txt
|
env GO111MODULE=on
cd $WORK/test/x
go list -m all
stdout '^m$'
-- $WORK/test/GLOCKFILE --
-- $WORK/test/x/x.go --
package x // import "m/x"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_upgrade_patch.txt
|
env GO111MODULE=on
go list -m all
stdout '^rsc.io/quote v1.4.0'
stdout '^rsc.io/sampler v1.0.0'
# get -u=patch rsc.io/quote should take latest quote & patch update its deps
go get -m -u=patch rsc.io/quote
go list -m all
stdout '^rsc.io/quote v1.5.2'
stdout '^rsc.io/sampler v1.3.1'
stdout '^golang.org/x/text v0.0.0-'
# get -u=patch quote@v1.2.0 should take that version of quote & patch update its deps
go get -m -u=patch rsc.io/quote@v1.2.0
go list -m all
stdout '^rsc.io/quote v1.2.0'
stdout '^rsc.io/sampler v1.3.1'
stdout '^golang.org/x/text v0.0.0-'
# get -u=patch with no args applies to all deps
go get -m -u=patch
go list -m all
stdout '^rsc.io/quote v1.2.1'
-- go.mod --
module x
require rsc.io/quote v1.4.0
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_bad_domain.txt
|
env GO111MODULE=on
# explicit get should report errors about bad names
! go get appengine
stderr 'malformed module path "appengine": missing dot in first path element'
! go get x/y.z
stderr 'malformed module path "x/y.z": missing dot in first path element'
# build should report all unsatisfied imports,
# but should be more definitive about non-module import paths
! go build ./useappengine
stderr 'cannot find package'
! go build ./usenonexistent
stderr 'cannot find module providing package nonexistent.rsc.io'
# go mod vendor and go mod tidy should ignore appengine imports.
rm usenonexistent/x.go
go mod tidy
go mod vendor
-- go.mod --
module x
-- useappengine/x.go --
package useappengine
import _ "appengine" // package does not exist
-- usenonexistent/x.go --
package usenonexistent
import _ "nonexistent.rsc.io" // domain does not exist
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_find.txt
|
# Derive module path from import comment.
cd $WORK/x
exists x.go
go mod init
stderr 'module x'
# Import comment works even with CRLF line endings.
rm go.mod
addcrlf x.go
go mod init
stderr 'module x'
# go mod should die in GOPATH if modules are not enabled for GOPATH
cd $GOPATH/src/example.com/x/y
! go mod init
stderr 'go: modules disabled inside GOPATH/src by GO111MODULE=auto; see ''go help modules'''
env GO111MODULE=on
# Derive module path from location inside GOPATH.
cd $GOPATH/src/example.com/x/y
go mod init
stderr 'module example.com/x/y$'
rm go.mod
# Module path from Godeps/Godeps.json overrides GOPATH.
cd $GOPATH/src/example.com/x/y/z
go mod init
stderr 'unexpected.com/z'
rm go.mod
# Empty directory outside GOPATH fails.
mkdir $WORK/empty
cd $WORK/empty
! go mod init
stderr 'cannot determine module path for source directory'
rm go.mod
# Empty directory inside GOPATH/src uses location inside GOPATH.
mkdir $GOPATH/src/empty
cd $GOPATH/src/empty
go mod init
stderr 'empty'
rm go.mod
[!symlink] stop
# gplink1/src/empty where gopathlink -> GOPATH
symlink $WORK/gopathlink -> gopath
cd $WORK/gopathlink/src/empty
go mod init
rm go.mod
# GOPATH/src/link where link -> out of GOPATH
symlink $GOPATH/src/link -> $WORK/empty
cd $WORK/empty
! go mod init
cd $GOPATH/src/link
go mod init
stderr link
rm go.mod
# GOPATH/src/empty where GOPATH itself is a symlink
env GOPATH=$WORK/gopathlink
cd $GOPATH/src/empty
go mod init
rm go.mod
cd $WORK/gopath/src/empty
go mod init
rm go.mod
# GOPATH/src/link where GOPATH and link are both symlinks
cd $GOPATH/src/link
go mod init
stderr link
rm go.mod
# Too hard: doesn't match unevaluated nor completely evaluated. (Only partially evaluated.)
# Whether this works depends on which OS we are running on.
# cd $WORK/gopath/src/link
# ! go mod init
-- $WORK/x/x.go --
package x // import "x"
-- $GOPATH/src/example.com/x/y/y.go --
package y
-- $GOPATH/src/example.com/x/y/z/z.go --
package z
-- $GOPATH/src/example.com/x/y/z/Godeps/Godeps.json --
{"ImportPath": "unexpected.com/z"}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_go_version.txt
|
# Test support for declaring needed Go version in module.
env GO111MODULE=on
go list
! go build
stderr 'module requires Go 1.999'
go build sub.1
! go build badsub.1
stderr 'module requires Go 1.11111'
go build versioned.1
go mod edit -require versioned.1@v1.1.0
! go build versioned.1
stderr 'module requires Go 1.99999'
-- go.mod --
module m
go 1.999
require (
sub.1 v1.0.0
badsub.1 v1.0.0
versioned.1 v1.0.0
)
replace (
sub.1 => ./sub
badsub.1 => ./badsub
versioned.1 v1.0.0 => ./versioned1
versioned.1 v1.1.0 => ./versioned2
)
-- x.go --
package x
-- sub/go.mod --
module m
go 1.11
-- sub/x.go --
package x
-- badsub/go.mod --
module m
go 1.11111
-- badsub/x.go --
package x
-- versioned1/go.mod --
module versioned
go 1.0
-- versioned1/x.go --
package x
-- versioned2/go.mod --
module versioned
go 1.99999
-- versioned2/x.go --
package x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_get_warning.txt
|
# go get in GO111MODULE=auto should warn when not using modules and go.mod exists
env GO111MODULE=auto
mkdir z
cd z
! go get # fails because no code in directory, not the warning
stderr 'go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src;\n\tignoring ..[/\\]go.mod;\n\tsee ''go help modules'''
-- go.mod --
module x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/list_bad_import.txt
|
# This test matches mod_list_bad_import, but in GOPATH mode.
# Please keep them in sync.
env GO111MODULE=off
cd example.com
# Without -e, listing an otherwise-valid package with an unsatisfied direct import should fail.
# BUG: Today it succeeds.
go list -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}} {{range .DepsErrors}}bad dep: {{.Err}}{{end}}' example.com/direct
! stdout ^error
stdout 'incomplete'
stdout 'bad dep: .*example.com[/\\]notfound'
# Listing with -deps should also fail.
# BUG: Today, it does not.
# ! go list -deps example.com/direct
# stderr example.com[/\\]notfound
go list -deps example.com/direct
stdout example.com/notfound
# Listing an otherwise-valid package that imports some *other* package with an
# unsatisfied import should also fail.
# BUG: Today, it succeeds.
go list -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}} {{range .DepsErrors}}bad dep: {{.Err}}{{end}}' example.com/indirect
! stdout ^error
stdout incomplete
stdout 'bad dep: .*example.com[/\\]notfound'
# Again, -deps should fail.
# BUG: Again, it does not.
# ! go list -deps example.com/indirect
# stderr example.com[/\\]notfound
go list -deps example.com/indirect
stdout example.com/notfound
# Listing the missing dependency directly should fail outright...
! go list -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}}' example.com/notfound
stderr 'no Go files in .*example.com[/\\]notfound'
! stdout error
! stdout incomplete
# ...but listing with -e should succeed.
go list -e -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}}' example.com/notfound
stdout error
stdout incomplete
# The pattern "all" should match only packages that acutally exist,
# ignoring those whose existence is merely implied by imports.
go list -e -f '{{.ImportPath}}' all
stdout example.com/direct
stdout example.com/indirect
! stdout example.com/notfound
-- example.com/direct/direct.go --
package direct
import _ "example.com/notfound"
-- example.com/indirect/indirect.go --
package indirect
import _ "example.com/direct"
-- example.com/notfound/README --
This directory intentionally left blank.
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/cpu_profile_twice.txt
|
# Issue 23150
[short] skip
go test -o=$WORK/x.test -cpuprofile=$WORK/cpu_profile_twice.out x
rm $WORK/cpu_profile_twice.out
go test -o=$WORK/x.test -cpuprofile=$WORK/cpu_profile_twice.out x
exists $WORK/cpu_profile_twice.out
-- x/x_test.go --
package x_test
import (
"testing"
"time"
)
func TestSleep(t *testing.T) {
time.Sleep(10 * time.Millisecond)
}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_file_proxy.txt
|
# Allow (cached) downloads for -mod=readonly.
env GO111MODULE=on
env GOPATH=$WORK/gopath1
cd $WORK/x
go mod edit -fmt
go list -mod=readonly
env GOPROXY=file:///nonexist
go list
grep v1.5.1 $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/list
# Use download cache as file:/// proxy.
[windows] stop # TODO: file://$WORK puts backslashes in the URL
env GOPATH=$WORK/gopath2
env GOPROXY=file:///nonexist
! go list
env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download
go list
grep v1.5.1 $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/list
-- $WORK/x/go.mod --
module x
require rsc.io/quote v1.5.1
-- $WORK/x/x.go --
package x
import _ "rsc.io/quote"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_build_tags.txt
|
# Test that build tags are used.
# golang.org/issue/24053.
env GO111MODULE=on
cd x
! go list -f {{.GoFiles}}
stderr 'build constraints exclude all Go files'
go list -f {{.GoFiles}} -tags tag1
stdout '\[x.go\]'
go list -f {{.GoFiles}} -tags tag2
stdout '\[y\.go\]'
go list -f {{.GoFiles}} -tags 'tag1 tag2'
stdout '\[x\.go y\.go\]'
-- x/go.mod --
module x
-- x/x.go --
// +build tag1
package y
-- x/y.go --
// +build tag2
package y
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_get_local.txt
|
# Test 'go get' with a local module with a name that is not valid for network lookup.
env GO111MODULE=on
go mod edit -fmt
cp go.mod go.mod.orig
# 'go get -u -m' within the main module should work, even if it has a local-only name.
cp go.mod.orig go.mod
go get -u -m
grep 'rsc.io/quote.*v1.5.2' go.mod
grep 'golang.org/x/text.*v0.3.0' go.mod
cp go.mod go.mod.implicitmod
# 'go get -u -m' with the name of the main module should be equivalent to
# 'go get -u -m' without any further arguments.
cp go.mod.orig go.mod
go get -u -m local
cmp go.mod go.mod.implicitmod
# 'go get -u -d' in the empty root of the main module should update the
# dependencies of all packages in the module.
cp go.mod.orig go.mod
go get -u -d
cmp go.mod go.mod.implicitmod
# 'go get -u -d .' within a package in the main module updates all dependencies
# of the main module.
# TODO: Determine whether that behavior is a bug.
# (https://golang.org/issue/26902)
cp go.mod.orig go.mod
cd uselang
go get -u -d .
cd ..
grep 'rsc.io/quote.*v1.5.2' go.mod
grep 'golang.org/x/text.*v0.3.0' go.mod
cp go.mod go.mod.dotpkg
# 'go get -u -d' with an explicit package in the main module updates
# all dependencies of the main module.
# TODO: Determine whether that behavior is a bug.
# (https://golang.org/issue/26902)
cp go.mod.orig go.mod
go get -u -d local/uselang
cmp go.mod go.mod.dotpkg
-- go.mod --
module local
require (
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
rsc.io/quote v1.3.0
)
-- uselang/uselang.go --
package uselang
import _ "golang.org/x/text/language"
-- usequote/usequote.go --
package usequote
import _ "rsc.io/quote"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_vendor_nodeps.txt
|
env GO111MODULE=on
go mod vendor
stderr '^go: no dependencies to vendor'
-- go.mod --
module x
-- x.go --
package x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/build_GOTMPDIR.txt
|
# Build should use GOTMPDIR if set.
env GOTMPDIR=$WORK/my-favorite-tmpdir
env GOCACHE=off
mkdir $GOTMPDIR
go build -work hello.go
stderr ^WORK=.*my-favorite-tmpdir
-- hello.go --
package main
func main() { println("hello") }
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/vendor_complex.txt
|
# smoke test for complex build configuration
go build -o complex.exe complex
[exec:gccgo] go build -compiler=gccgo -o complex.exe complex
-- complex/main.go --
package main
import (
_ "complex/nest/sub/test12"
_ "complex/nest/sub/test23"
"complex/w"
"v"
)
func main() {
println(v.Hello + " " + w.World)
}
-- complex/nest/sub/test12/p.go --
package test12
// Check that vendor/v1 is used but vendor/v2 is NOT used (sub/vendor/v2 wins).
import (
"v1"
"v2"
)
const x = v1.ComplexNestVendorV1
const y = v2.ComplexNestSubVendorV2
-- complex/nest/sub/test23/p.go --
package test23
// Check that vendor/v3 is used but vendor/v2 is NOT used (sub/vendor/v2 wins).
import (
"v2"
"v3"
)
const x = v3.ComplexNestVendorV3
const y = v2.ComplexNestSubVendorV2
-- complex/nest/sub/vendor/v2/v2.go --
package v2
const ComplexNestSubVendorV2 = true
-- complex/nest/vendor/v1/v1.go --
package v1
const ComplexNestVendorV1 = true
-- complex/nest/vendor/v2/v2.go --
package v2
const ComplexNestVendorV2 = true
-- complex/nest/vendor/v3/v3.go --
package v3
const ComplexNestVendorV3 = true
-- complex/vendor/v/v.go --
package v
const Hello = "hello"
-- complex/w/w.go --
package w
const World = "world"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/install_cross_gobin.txt
|
cd mycmd
go build mycmd
# cross-compile install with implicit GOBIN=$GOPATH/bin can make subdirectory
env GOARCH=386
[386] env GOARCH=amd64
env GOOS=linux
go install mycmd
exists $GOPATH/bin/linux_$GOARCH/mycmd
# cross-compile install with explicit GOBIN cannot make subdirectory
env GOBIN=$WORK/bin
! go install mycmd
! exists $GOBIN/linux_$GOARCH
# installing standard command should still work
# (should also be mtime update only if cmd/pack is up-to-date).
! stale cmd/pack
[!short] go install cmd/pack
-- mycmd/x.go --
package main
func main() {}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_convert_godeps.txt
|
env GO111MODULE=on
cd $WORK/test/x
go list -m all
stdout '^m$'
-- $WORK/test/Godeps/Godeps.json --
{}
-- $WORK/test/x/x.go --
package x // import "m/x"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_get_pseudo.txt
|
env GO111MODULE=on
# Testing git->module converter's generation of +incompatible tags; turn off proxy.
[!net] skip
[!exec:git] skip
env GOPROXY=
# We can resolve the @master branch without unshallowing the local repository
# (even with older gits), so try that before we do anything else.
# (This replicates https://golang.org/issue/26713 with git 2.7.4.)
go get -m github.com/rsc/legacytest@master
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.1-0\.\d{14}-7303f7796364\+incompatible$'
# get should include incompatible tags in "latest" calculation.
go get -m github.com/rsc/legacytest@latest
go list
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$'
# v2.0.1-0.pseudo+incompatible
go get -m ...test@7303f77
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.1-0\.\d{14}-7303f7796364\+incompatible$'
# v2.0.0+incompatible by tag+incompatible
go get -m ...test@v2.0.0+incompatible
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$'
# v2.0.0+incompatible by tag
go get -m ...test@v2.0.0
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$'
# v2.0.0+incompatible by hash (back on master)
go get -m ...test@d7ae1e4
go list -m all
stdout '^github.com/rsc/legacytest v2\.0\.0\+incompatible$'
# v1.2.1-0.pseudo
go get -m ...test@d2d4c3e
go list -m all
stdout '^github.com/rsc/legacytest v1\.2\.1-0\.\d{14}-d2d4c3ea6623$'
# v1.2.0
go get -m ...test@9f6f860
go list -m all
stdout '^github.com/rsc/legacytest v1\.2\.0$'
# v1.1.0-pre.0.pseudo
go get -m ...test@fb3c628
go list -m all
stdout '^github.com/rsc/legacytest v1\.1\.0-pre\.0\.\d{14}-fb3c628075e3$'
# v1.1.0-pre (no longer on master)
go get -m ...test@731e3b1
go list -m all
stdout '^github.com/rsc/legacytest v1\.1\.0-pre$'
# v1.0.1-0.pseudo
go get -m ...test@fa4f5d6
go list -m all
stdout '^github.com/rsc/legacytest v1\.0\.1-0\.\d{14}-fa4f5d6a71c6$'
# v1.0.0
go get -m ...test@7fff7f3
go list -m all
stdout '^github.com/rsc/legacytest v1\.0\.0$'
# v0.0.0-pseudo
go get -m ...test@52853eb
go list -m all
stdout '^github.com/rsc/legacytest v0\.0\.0-\d{14}-52853eb7b552$'
-- go.mod --
module x
-- x.go --
package x
import "github.com/rsc/legacytest"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_case_cgo.txt
|
[!cgo] skip
env GO111MODULE=on
go get rsc.io/CGO
go build rsc.io/CGO
-- go.mod --
module x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/fileline.txt
|
# look for short, relative file:line in error message
! go run ../../gopath/x/y/z/err.go
stderr ^..[\\/]x[\\/]y[\\/]z[\\/]err.go:
-- ../x/y/z/err.go --
package main; import "bar"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_run_internal.txt
|
env GO111MODULE=on
go list -e -f '{{.Incomplete}}' runbad1.go
stdout true
! go run runbad1.go
stderr 'use of internal package m/x/internal not allowed'
go list -e -f '{{.Incomplete}}' runbad2.go
stdout true
! go run runbad2.go
stderr 'use of internal package m/x/internal/y not allowed'
go list -e -f '{{.Incomplete}}' runok.go
stdout false
go run runok.go
-- go.mod --
module m
-- x/internal/internal.go --
package internal
-- x/internal/y/y.go --
package y
-- internal/internal.go --
package internal
-- internal/z/z.go --
package z
-- runbad1.go --
package main
import _ "m/x/internal"
func main() {}
-- runbad2.go --
package main
import _ "m/x/internal/y"
func main() {}
-- runok.go --
package main
import _ "m/internal"
import _ "m/internal/z"
func main() {}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_readonly.txt
|
env GO111MODULE=on
# -mod=readonly must not resolve missing modules nor update go.mod
#
# TODO(bcmills): 'go list' should suffice, but today it does not fail due to
# unresolved imports. When that is fixed, use 'go list' instead of 'go list all'.
env GOFLAGS=-mod=readonly
go mod edit -fmt
cp go.mod go.mod.empty
! go list all
stderr 'import lookup disabled by -mod=readonly'
cmp go.mod go.mod.empty
# update go.mod - go get allowed
go get rsc.io/quote
grep rsc.io/quote go.mod
# update go.mod - go mod tidy allowed
cp go.mod.empty go.mod
go mod tidy
# -mod=readonly must succeed once go.mod is up-to-date...
go list
# ... even if it needs downloads
go clean -modcache
go list
# -mod=readonly should reject inconsistent go.mod files
# (ones that would be rewritten).
go mod edit -require rsc.io/sampler@v1.2.0
cp go.mod go.mod.inconsistent
! go list
stderr 'go: updates to go.mod needed, disabled by -mod=readonly'
cmp go.mod go.mod.inconsistent
-- go.mod --
module m
-- x.go --
package x
import _ "rsc.io/quote"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_run_path.txt
|
# Test that go run does not get confused by conflict
# between go.mod's module path and what you'd
# expect from GOPATH. golang.org/issue/26046.
env GO111MODULE=on
cd $GOPATH/src/example.com/hello
go run main.go
-- $GOPATH/src/example.com/hello/go.mod --
module example.com/hello/v2
-- $GOPATH/src/example.com/hello/main.go --
package main
func main() {}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_doc.txt
|
# go doc should find module documentation
env GO111MODULE=on
go doc y
stdout 'Package y is.*alphabet'
stdout 'import "x/y"'
go doc x/y
stdout 'Package y is.*alphabet'
! go doc quote.Hello
stderr 'doc: symbol quote is not a type' # because quote is not in local cache
go list rsc.io/quote # now it is
go doc quote.Hello
stdout 'Hello returns a greeting'
go doc quote
stdout 'Package quote collects pithy sayings.'
# Double-check go doc y when y is not in GOPATH/src.
env GOPATH=$WORK/altgopath
go doc x/y
stdout 'Package y is.*alphabet'
go doc y
stdout 'Package y is.*alphabet'
-- go.mod --
module x
require rsc.io/quote v1.5.2
-- y/y.go --
// Package y is the next to last package of the alphabet.
package y
-- x.go --
package x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/build_cache_link.txt
|
# Set up fresh GOCACHE.
env GOCACHE=$WORK/gocache
mkdir $GOCACHE
# Building a main package should run the compiler and linker ...
go build -o $devnull -x main.go
stderr '(compile|gccgo)( |\.exe).*main\.go'
stderr '(link|gccgo)( |\.exe)'
# ... and then the linker again ...
go build -o $devnull -x main.go
! stderr '(compile|gccgo)( |\.exe).*main\.go'
stderr '(link|gccgo)( |\.exe)'
# ... but the output binary can serve as a cache.
go build -o main$exe -x main.go
stderr '(link|gccgo)( |\.exe)'
go build -o main$exe -x main.go
! stderr '(link|gccgo)( |\.exe)'
-- main.go --
package main
func main() {}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_versions.txt
|
# Test rejection of pkg@version in GOPATH mode.
env GO111MODULE=off
! go get rsc.io/quote@v1.5.1
stderr 'cannot use path@version syntax in GOPATH mode'
! go build rsc.io/quote@v1.5.1
stderr 'cannot use path@version syntax in GOPATH mode'
env GO111MODULE=on
cd x
! go build rsc.io/quote@v1.5.1
stderr 'can only use path@version syntax with ''go get'''
-- x/go.mod --
module x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_tidy_sum.txt
|
env GO111MODULE=on
# go.sum should list directly used modules and dependencies
go get rsc.io/quote@v1.5.2
go mod tidy
grep rsc.io/sampler go.sum
# go.sum should not normally lose old entries
go get rsc.io/quote@v1.0.0
grep 'rsc.io/quote v1.0.0' go.sum
grep 'rsc.io/quote v1.5.2' go.sum
grep rsc.io/sampler go.sum
# go mod tidy should clear dead entries from go.sum
go mod tidy
grep 'rsc.io/quote v1.0.0' go.sum
! grep 'rsc.io/quote v1.5.2' go.sum
! grep rsc.io/sampler go.sum
# go.sum with no entries is OK to keep
# (better for version control not to delete and recreate.)
cp x.go.noimports x.go
go mod tidy
exists go.sum
! grep . go.sum
-- go.mod --
module x
-- x.go --
package x
import _ "rsc.io/quote"
-- x.go.noimports --
package x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_list_bad_import.txt
|
# This test matches list_bad_import, but in module mode.
# Please keep them in sync.
env GO111MODULE=on
cd example.com
# Without -e, listing an otherwise-valid package with an unsatisfied direct import should fail.
# BUG: Today it succeeds.
go list -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}} {{range .DepsErrors}}bad dep: {{.Err}}{{end}}' example.com/direct
! stdout ^error
stdout 'incomplete'
stdout 'bad dep: .*example.com/notfound'
# Listing with -deps should also fail.
# BUG: Today, it does not.
# ! go list -deps example.com/direct
# stderr example.com/notfound
go list -deps example.com/direct
stdout example.com/notfound
# Listing an otherwise-valid package that imports some *other* package with an
# unsatisfied import should also fail.
# BUG: Today, it succeeds.
go list -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}} {{range .DepsErrors}}bad dep: {{.Err}}{{end}}' example.com/indirect
! stdout ^error
stdout incomplete
stdout 'bad dep: .*example.com/notfound'
# Again, -deps should fail.
# BUG: Again, it does not.
# ! go list -deps example.com/indirect
# stderr example.com/notfound
go list -deps example.com/indirect
stdout example.com/notfound
# Listing the missing dependency directly should fail outright...
! go list -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}}' example.com/notfound
stderr 'cannot find module providing package example.com/notfound'
! stdout error
! stdout incomplete
# ...but listing with -e should succeed.
go list -e -f '{{if .Error}}error{{end}} {{if .Incomplete}}incomplete{{end}}' example.com/notfound
stdout error
stdout incomplete
# The pattern "all" should match only packages that acutally exist,
# ignoring those whose existence is merely implied by imports.
go list -e -f '{{.ImportPath}} {{.Error}}' all
stdout example.com/direct
stdout example.com/indirect
# TODO: go list creates a dummy package with the import-not-found
# but really the Error belongs on example.com/direct, and this package
# should not be printed.
# ! stdout example.com/notfound
-- example.com/go.mod --
module example.com
-- example.com/direct/direct.go --
package direct
import _ "example.com/notfound"
-- example.com/indirect/indirect.go --
package indirect
import _ "example.com/direct"
-- example.com/notfound/README --
This directory intentionally left blank.
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_vendor.txt
|
env GO111MODULE=on
go list -m all
stdout '^x v1.0.0 => ./x'
stdout '^w'
[!short] go build
[!short] ! go build -mod=vendor
go list -f {{.Dir}} x
stdout 'src[\\/]x'
go mod vendor -v
stderr '^# x v1.0.0 => ./x'
stderr '^x'
stderr '^# y v1.0.0 => ./y'
stderr '^y'
stderr '^# z v1.0.0 => ./z'
stderr '^z'
! stderr '^w'
go list -f {{.Dir}} x
stdout 'src[\\/]x'
go list -f {{.Dir}} -m x
stdout 'src[\\/]x'
go list -mod=vendor -f {{.Dir}} x
stdout 'src[\\/]vendor[\\/]x'
go list -mod=vendor -f {{.Dir}} -m x
stdout 'src[\\/]vendor[\\/]x'
go list -f {{.Dir}} -m w
stdout 'src[\\/]w'
! go list -mod=vendor -f {{.Dir}} w
stderr 'src[\\/]vendor[\\/]w'
! exists vendor/x/testdata
! exists vendor/a/foo/bar/b/main_test.go
exists vendor/a/foo/AUTHORS.txt
exists vendor/a/foo/CONTRIBUTORS
exists vendor/a/foo/LICENSE
exists vendor/a/foo/PATENTS
exists vendor/a/foo/COPYING
exists vendor/a/foo/COPYLEFT
exists vendor/x/NOTICE!
exists vendor/mysite/myname/mypkg/LICENSE.txt
! exists vendor/a/foo/licensed-to-kill
! exists vendor/w
! exists vendor/w/LICENSE
! exists vendor/x/x2
! exists vendor/x/x2/LICENSE
[short] stop
go build
go build -mod=vendor
go test -mod=vendor . ./subdir
go test -mod=vendor ./...
-- go.mod --
module m
require (
a v1.0.0
mysite/myname/mypkg v1.0.0
w v1.0.0 // indirect
x v1.0.0
y v1.0.0
z v1.0.0
)
replace (
a v1.0.0 => ./a
mysite/myname/mypkg v1.0.0 => ./mypkg
w v1.0.0 => ./w
x v1.0.0 => ./x
y v1.0.0 => ./y
z v1.0.0 => ./z
)
-- a/foo/AUTHORS.txt --
-- a/foo/CONTRIBUTORS --
-- a/foo/LICENSE --
-- a/foo/PATENTS --
-- a/foo/COPYING --
-- a/foo/COPYLEFT --
-- a/foo/licensed-to-kill --
-- w/LICENSE --
-- x/NOTICE! --
-- x/x2/LICENSE --
-- mypkg/LICENSE.txt --
-- a/foo/bar/b/main.go --
package b
-- a/foo/bar/b/main_test.go --
package b
import (
"os"
"testing"
)
func TestDir(t *testing.T) {
if _, err := os.Stat("../testdata/1"); err != nil {
t.Fatalf("testdata: %v", err)
}
}
-- a/foo/bar/c/main.go --
package c
-- a/foo/bar/c/main_test.go --
package c
import (
"os"
"testing"
)
func TestDir(t *testing.T) {
if _, err := os.Stat("../../../testdata/1"); err != nil {
t.Fatalf("testdata: %v", err)
}
if _, err := os.Stat("./testdata/1"); err != nil {
t.Fatalf("testdata: %v", err)
}
}
-- a/foo/bar/c/testdata/1 --
-- a/foo/bar/testdata/1 --
-- a/go.mod --
module a
-- a/main.go --
package a
-- a/main_test.go --
package a
import (
"os"
"testing"
)
func TestDir(t *testing.T) {
if _, err := os.Stat("./testdata/1"); err != nil {
t.Fatalf("testdata: %v", err)
}
}
-- a/testdata/1 --
-- appengine.go --
// +build appengine
package m
import _ "appengine"
import _ "appengine/datastore"
-- nonexistent.go --
// +build alternatereality
package m
import _ "nonexistent.rsc.io"
-- mypkg/go.mod --
module me
-- mypkg/mydir/d.go --
package mydir
-- subdir/v1_test.go --
package m
import _ "mysite/myname/mypkg/mydir"
-- testdata1.go --
package m
import _ "a"
-- testdata2.go --
package m
import _ "a/foo/bar/b"
import _ "a/foo/bar/c"
-- v1.go --
package m
import _ "x"
-- v2.go --
// +build abc
package mMmMmMm
import _ "y"
-- v3.go --
// +build !abc
package m
import _ "z"
-- v4.go --
// +build notmytag
package m
import _ "x/x1"
-- w/go.mod --
module w
-- w/w.go --
package w
-- x/go.mod --
module x
-- x/testdata/x.txt --
placeholder - want directory with no go files
-- x/x.go --
package x
-- x/x1/x1.go --
// +build notmytag
package x1
-- x/x2/dummy.txt --
dummy
-- x/x_test.go --
package x
import _ "w"
-- y/go.mod --
module y
-- y/y.go --
package y
-- z/go.mod --
module z
-- z/z.go --
package z
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_list_upgrade.txt
|
env GO111MODULE=on
go list -m -u all
stdout 'rsc.io/quote v1.2.0 \[v1\.5\.2\]'
-- go.mod --
module x
require rsc.io/quote v1.2.0
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_getmode_vendor.txt
|
env GO111MODULE=on
go get -m rsc.io/quote@v1.5.1
go mod vendor
env GOPATH=$WORK/empty
env GOPROXY=file:///nonexist
go list -mod=vendor
go list -mod=vendor -m -f '{{.Path}} {{.Version}} {{.Dir}}' all
stdout '^rsc.io/quote v1.5.1 .*vendor[\\/]rsc.io[\\/]quote$'
stdout '^golang.org/x/text v0.0.0.* .*vendor[\\/]golang.org[\\/]x[\\/]text$'
! go list -mod=vendor -m rsc.io/quote@latest
stderr 'module lookup disabled by -mod=vendor'
! go get -mod=vendor -u
stderr 'go get: disabled by -mod=vendor'
-- go.mod --
module x
-- x.go --
package x
import _ "rsc.io/quote"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_graph.txt
|
env GO111MODULE=on
go mod graph
stdout '^m rsc.io/quote@v1.5.2$'
stdout '^rsc.io/quote@v1.5.2 rsc.io/sampler@v1.3.0$'
! stdout '^m rsc.io/sampler@v1.3.0$'
-- go.mod --
module m
require rsc.io/quote v1.5.2
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/install_cleans_build.txt
|
# 'go install' with no arguments should clean up after go build
cd mycmd
go build
exists mycmd$exe
go install
! exists mycmd$exe
# 'go install mycmd' does not clean up, even in the mycmd directory
go build
exists mycmd$exe
go install mycmd
exists mycmd$exe
# 'go install mycmd' should not clean up in an unrelated current directory either
cd ..
cp mycmd/mycmd$exe mycmd$exe
go install mycmd
exists mycmd$exe
-- mycmd/main.go --
package main
func main() {}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/list_find.txt
|
# go list -find should not report imports
go list -f {{.Incomplete}} x/y/z... # should probably exit non-zero but never has
stdout true
go list -find -f '{{.Incomplete}} {{.Imports}}' x/y/z...
stdout '^false \[\]'
-- x/y/z/z.go --
package z
import "does/not/exist"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_domain_root.txt
|
# Module paths that are domain roots should resolve.
# (example.com not example.com/something)
env GO111MODULE=on
go build
-- go.mod --
module x
-- x.go --
package x
import _ "example.com"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_std_vendor.txt
|
env GO111MODULE=on
go list -f '{{.TestImports}}'
stdout net/http # from .TestImports
go list -test -f '{{.Deps}}'
stdout golang_org/x/crypto # dep of .TestImports
-- go.mod --
module m
-- x.go --
package x
-- x_test.go --
package x
import "testing"
import _ "net/http"
func Test(t *testing.T) {}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_convert_vendor_manifest.txt
|
env GO111MODULE=on
cd $WORK/test/x
go list -m all
stdout '^m$'
-- $WORK/test/vendor/manifest --
{}
-- $WORK/test/x/x.go --
package x // import "m/x"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_get_none.txt
|
env GO111MODULE=on
go mod init example.com/foo
# 'go get bar@none' should be a no-op if module bar is not active.
go get example.com/bar@none
go list -m all
! stdout example.com/bar
go get example.com/bar@none
go list -m all
! stdout example.com/bar
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_install_versioned.txt
|
env GO111MODULE=on
go list -f '{{.Target}}' rsc.io/fortune
! stdout fortune@v1
stdout 'fortune(\.exe)?$'
go list -f '{{.Target}}' rsc.io/fortune/v2
! stdout v2
stdout 'fortune(\.exe)?$'
-- go.mod --
module m
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_gopkg_unstable.txt
|
env GO111MODULE=on
cp go.mod.empty go.mod
go get -d gopkg.in/dummy.v2-unstable
cp x.go.txt x.go
cp go.mod.empty go.mod
go list
[!net] skip
env GOPROXY=
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"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/goflags.txt
|
# GOFLAGS sets flags for commands
env GOFLAGS='-e -f={{.Dir}} --test.benchtime=1s -count=10'
go list asdfasdfasdf # succeeds because of -e
go list runtime
stdout '[\\/]runtime$'
env GOFLAGS=-race OLDGOARCH=$GOARCH OLDGOOS=$GOOS GOARCH=386 GOOS=linux
! go list runtime
stderr 'race is only supported on'
env GOARCH=$OLDGOARCH GOOS=$OLDGOOS
# go env succeeds even though -f={{.Dir}} is inappropriate
go env
# bad flags are diagnosed
env GOFLAGS=-typoflag
! go list runtime
stderr 'unknown flag -typoflag'
env GOFLAGS=-
! go list runtime
stderr '^go: parsing \$GOFLAGS: non-flag "-"'
env GOFLAGS=--
! go list runtime
stderr '^go: parsing \$GOFLAGS: non-flag "--"'
env GOFLAGS=---oops
! go list runtime
stderr '^go: parsing \$GOFLAGS: non-flag "---oops"'
env GOFLAGS=-=noname
! go list runtime
stderr '^go: parsing \$GOFLAGS: non-flag "-=noname"'
env GOFLAGS=-f
! go list runtime
stderr '^go: flag needs an argument: -f \(from (\$GOFLAGS|%GOFLAGS%)\)$'
env GOFLAGS=-e=asdf
! go list runtime
stderr '^go: invalid boolean value \"asdf\" for flag -e \(from (\$GOFLAGS|%GOFLAGS%)\)'
# except in go bug (untested) and go env
go env
stdout GOFLAGS
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_multirepo.txt
|
env GO111MODULE=on
# initial standalone module should use no downloaded modules
go list -deps -f {{.Dir}}
! stdout 'pkg[\\/]mod'
# v2 import should use a downloaded module
# both without an explicit go.mod entry ...
cp tmp/use_v2.go x.go
go list -deps -f {{.Dir}}
stdout 'pkg[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'
# ... and with one ...
cp tmp/use_v2.mod go.mod
go list -deps -f {{.Dir}}
stdout 'pkg[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'
# ... and even if there is a v2 module in a subdirectory.
mkdir v2
cp x.go v2/x.go
cp tmp/v2.mod v2/go.mod
go list -deps -f {{.Dir}}
stdout 'pkg[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'
-- go.mod --
module rsc.io/quote
-- x.go --
package quote
-- tmp/use_v2.go --
package quote
import _ "rsc.io/quote/v2"
-- tmp/use_v2.mod --
module rsc.io/quote
require rsc.io/quote/v2 v2.0.1
-- tmp/v2.mod --
package rsc.io/quote/v2
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_get_incompatible.txt
|
env GO111MODULE=on
go list x
go list -m all
stdout 'rsc.io/breaker v2.0.0\+incompatible'
cp go.mod2 go.mod
go get rsc.io/breaker@7307b30
go list -m all
stdout 'rsc.io/breaker v2.0.0\+incompatible'
go get rsc.io/breaker@v2.0.0
go list -m all
stdout 'rsc.io/breaker v2.0.0\+incompatible'
-- go.mod --
module x
-- go.mod2 --
module x
require rsc.io/breaker v1.0.0
-- x.go --
package x
import "rsc.io/breaker"
var _ = breaker.XX
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_gobuild_import.txt
|
# go/build's Import should find modules by invoking the go command
go build -o $WORK/testimport.exe ./testimport
# GO111MODULE=off
env GO111MODULE=off
! exec $WORK/testimport.exe x/y/z/w .
# GO111MODULE=auto in GOPATH/src
env GO111MODULE=
! exec $WORK/testimport.exe x/y/z/w .
env GO111MODULE=auto
! exec $WORK/testimport.exe x/y/z/w .
# GO111MODULE=auto outside GOPATH/src
cd $GOPATH/other
env GO111MODULE=
exec $WORK/testimport.exe other/x/y/z/w .
stdout w2.go
! exec $WORK/testimport.exe x/y/z/w .
stderr 'cannot find module providing package x/y/z/w'
cd z
env GO111MODULE=auto
exec $WORK/testimport.exe other/x/y/z/w .
stdout w2.go
# GO111MODULE=on outside GOPATH/src
env GO111MODULE=on
exec $WORK/testimport.exe other/x/y/z/w .
stdout w2.go
# GO111MODULE=on in GOPATH/src
cd $GOPATH/src
exec $WORK/testimport.exe x/y/z/w .
stdout w1.go
cd w
exec $WORK/testimport.exe x/y/z/w ..
stdout w1.go
-- go.mod --
module x/y/z
-- z.go --
package z
-- w/w1.go --
package w
-- testimport/x.go --
package main
import (
"fmt"
"go/build"
"log"
"os"
"strings"
)
func main() {
p, err := build.Import(os.Args[1], os.Args[2], 0)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n%s\n", p.Dir, strings.Join(p.GoFiles, " "))
}
-- $GOPATH/other/go.mod --
module other/x/y
-- $GOPATH/other/z/w/w2.go --
package w
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_require_exclude.txt
|
# build with no newer version to satisfy exclude
env GO111MODULE=on
! go list -m all
stderr 'no newer version available'
# build with newer version available
cp go.mod2 go.mod
go list -m all
stdout 'rsc.io/quote v1.5.2'
# build with excluded newer version
cp go.mod3 go.mod
go list -m all
stdout 'rsc.io/quote v1.5.1'
-- x.go --
package x
import _ "rsc.io/quote"
-- go.mod --
module x
exclude rsc.io/sampler latest
require rsc.io/sampler latest
-- go.mod2 --
module x
exclude rsc.io/quote v1.5.1
require rsc.io/quote v1.5.1
-- go.mod3 --
module x
exclude rsc.io/quote v1.5.2
require rsc.io/quote v1.5.1
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_nomod.txt
|
# Test go commands with no module.
env GO111MODULE=on
# go mod edit fails unless given explicit mod file argument
! go mod edit -json
go mod edit -json x.mod
# bug succeeds
[exec:echo] env BROWSER=echo
[exec:echo] go bug
# commands that load the package in the current directory fail
! go build
! go fmt
! go generate
! go get
! go install
! go list
! go run x.go
! go test
! go vet
# clean succeeds, even with -modcache
go clean -modcache
# doc succeeds for standard library
go doc unsafe
# env succeeds
go env
# tool succeeds
go tool -n test2json
# version succeeds
go version
-- x.mod --
module m
-- x.go --
package main
func main() {}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/install_rebuild_removed.txt
|
# go command should detect package staleness as source file set changes
go install mypkg
! stale mypkg
# z.go was not compiled; removing it should NOT make mypkg stale
rm mypkg/z.go
! stale mypkg
# y.go was compiled; removing it should make mypkg stale
rm mypkg/y.go
stale mypkg
# go command should detect executable staleness too
go install mycmd
! stale mycmd
rm mycmd/z.go
! stale mycmd
rm mycmd/y.go
stale mycmd
-- mypkg/x.go --
package mypkg
-- mypkg/y.go --
package mypkg
-- mypkg/z.go --
// +build missingtag
package mypkg
-- mycmd/x.go --
package main
func main() {}
-- mycmd/y.go --
package main
-- mycmd/z.go --
// +build missingtag
package main
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/list_test_e.txt
|
# issue 25980: crash in go list -e -test
go list -e -test -f '{{.Error}}' p
stdout '^p[/\\]d_test.go:2:8: cannot find package "d" in any of:'
-- p/d.go --
package d
-- p/d_test.go --
package d_test
import _ "d"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_fs_patterns.txt
|
# File system pattern searches should skip sub-modules and vendor directories.
env GO111MODULE=on
cd x
# all packages
go list all
stdout ^m$
stdout ^m/vendor$
! stdout vendor/
stdout ^m/y$
! stdout ^m/y/z
# path pattern
go list m/...
stdout ^m$
stdout ^m/vendor$
! stdout vendor/
stdout ^m/y$
! stdout ^m/y/z
# directory pattern
go list ./...
stdout ^m$
stdout ^m/vendor$
! stdout vendor/
stdout ^m/y$
! stdout ^m/y/z
# non-existent directory should not prompt lookups
! go build -mod=readonly example.com/nonexist
stderr 'import lookup disabled'
! go build -mod=readonly ./nonexist
! stderr 'import lookup disabled'
stderr '^go: no such directory ./nonexist'
! go build -mod=readonly ./go.mod
! stderr 'import lookup disabled'
stderr '^go: ./go.mod is not a directory'
-- x/go.mod --
module m
-- x/x.go --
package x
-- x/vendor/v/v.go --
package v
import _ "golang.org/x/crypto"
-- x/vendor/v.go --
package main
-- x/y/y.go --
package y
-- x/y/z/go.mod --
syntax error!
-- x/y/z/z.go --
package z
-- x/y/z/w/w.go --
package w
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/test_compile_binary.txt
|
! go test -c compile_binary/...
stderr 'build comment'
-- compile_binary/foo_test.go --
//+build foo
package foo
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/cover_pkgall_runtime.txt
|
# Issue 23882
[short] skip
go test -coverpkg=all x
stdout ok[\s\S]+?coverage
[!race] stop
go test -coverpkg=all -race x
stdout ok[\s\S]+?coverage
-- x/x.go --
package x
import _ "runtime"
func F() {}
-- x/x_test.go --
package x
import "testing"
func TestF(t *testing.T) { F() }
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_get_moved.txt
|
env GO111MODULE=on
# A 'go get' that worked at a previous version should continue to work at that version,
# even if the package was subsequently moved into a submodule.
go mod init example.com/foo
go get -d example.com/split/subpkg@v1.0.0
go list -m all
stdout 'example.com/split v1.0.0'
# A 'go get' that simultaneously upgrades away conflicting package defitions is not ambiguous.
go get example.com/split/subpkg@v1.1.0
# A 'go get' without an upgrade should find the package.
rm go.mod
go mod init example.com/foo
go get -d example.com/split/subpkg
go list -m all
stdout 'example.com/split/subpkg v1.1.0'
# A 'go get' that worked at a previous version should continue to work at that version,
# even if the package was subsequently moved into a parent module.
rm go.mod
go mod init example.com/foo
go get -d example.com/join/subpkg@v1.0.0
go list -m all
stdout 'example.com/join/subpkg v1.0.0'
# A 'go get' that simultaneously upgrades away conflicting package definitions is not ambiguous.
go get example.com/join/subpkg@v1.1.0
# A 'go get' without an upgrade should find the package.
rm go.mod
go mod init example.com/foo
go get -d example.com/join/subpkg@v1.1.0
go list -m all
stdout 'example.com/join v1.1.0'
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/install_rebuild_gopath.txt
|
# GOPATH with p1 in d1, p2 in d2
env GOPATH=$WORK/d1${:}$WORK/d2
# build & install p1
go install -i p1
! stale p1 p2
# modify p2 - p1 should appear stale
cp $WORK/p2x.go $WORK/d2/src/p2/p2.go
stale p1 p2
# build & install p1 again
go install -i p1
! stale p1 p2
-- $WORK/d1/src/p1/p1.go --
package p1
import "p2"
func F() { p2.F() }
-- $WORK/d2/src/p2/p2.go --
package p2
func F() {}
-- $WORK/p2x.go --
package p2
func F() {}
func G() {}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/run_hello.txt
|
# hello world
go run hello.go
stderr 'hello world'
-- hello.go --
package main
func main() { println("hello world") }
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_edit.txt
|
env GO111MODULE=on
# Test that go mod edits and related mod flags work.
# Also test that they can use a dummy name that isn't resolvable. golang.org/issue/24100
# go mod init
! go mod init
stderr 'cannot determine module path'
! exists go.mod
go mod init x.x/y/z
stderr 'creating new go.mod: module x.x/y/z'
cmp go.mod $WORK/go.mod.init
! go mod init
cmp go.mod $WORK/go.mod.init
# go mod edits
go mod edit -droprequire=x.1 -require=x.1@v1.0.0 -require=x.2@v1.1.0 -droprequire=x.2 -exclude='x.1 @ v1.2.0' -exclude=x.1@v1.2.1 -replace=x.1@v1.3.0=y.1@v1.4.0 -replace='x.1@v1.4.0 = ../z'
cmp go.mod $WORK/go.mod.edit1
go mod edit -droprequire=x.1 -dropexclude=x.1@v1.2.1 -dropreplace=x.1@v1.3.0 -require=x.3@v1.99.0
cmp go.mod $WORK/go.mod.edit2
# go mod edit -json
go mod edit -json
cmp stdout $WORK/go.mod.json
# go mod edit -replace
go mod edit -replace=x.1@v1.3.0=y.1/v2@v2.3.5 -replace=x.1@v1.4.0=y.1/v2@v2.3.5
cmp go.mod $WORK/go.mod.edit3
go mod edit -replace=x.1=y.1/v2@v2.3.6
cmp go.mod $WORK/go.mod.edit4
go mod edit -dropreplace=x.1
cmp go.mod $WORK/go.mod.edit5
# go mod edit -fmt
cp $WORK/go.mod.badfmt go.mod
go mod edit -fmt -print # -print should avoid writing file
cmp stdout $WORK/go.mod.edit4
cmp go.mod $WORK/go.mod.badfmt
go mod edit -fmt # without -print, should write file (and nothing to stdout)
! stdout .
cmp go.mod $WORK/go.mod.edit4
-- x.go --
package x
-- w/w.go --
package w
-- $WORK/go.mod.init --
module x.x/y/z
-- $WORK/go.mod.edit1 --
module x.x/y/z
require x.1 v1.0.0
exclude (
x.1 v1.2.0
x.1 v1.2.1
)
replace (
x.1 v1.3.0 => y.1 v1.4.0
x.1 v1.4.0 => ../z
)
-- $WORK/go.mod.edit2 --
module x.x/y/z
exclude x.1 v1.2.0
replace x.1 v1.4.0 => ../z
require x.3 v1.99.0
-- $WORK/go.mod.json --
{
"Module": {
"Path": "x.x/y/z"
},
"Require": [
{
"Path": "x.3",
"Version": "v1.99.0"
}
],
"Exclude": [
{
"Path": "x.1",
"Version": "v1.2.0"
}
],
"Replace": [
{
"Old": {
"Path": "x.1",
"Version": "v1.4.0"
},
"New": {
"Path": "../z"
}
}
]
}
-- $WORK/go.mod.edit3 --
module x.x/y/z
exclude x.1 v1.2.0
replace (
x.1 v1.3.0 => y.1/v2 v2.3.5
x.1 v1.4.0 => y.1/v2 v2.3.5
)
require x.3 v1.99.0
-- $WORK/go.mod.edit4 --
module x.x/y/z
exclude x.1 v1.2.0
replace x.1 => y.1/v2 v2.3.6
require x.3 v1.99.0
-- $WORK/go.mod.edit5 --
module x.x/y/z
exclude x.1 v1.2.0
require x.3 v1.99.0
-- $WORK/go.mod.badfmt --
module x.x/y/z
exclude x.1 v1.2.0
replace x.1 => y.1/v2 v2.3.6
require x.3 v1.99.0
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_vcs_missing.txt
|
[exec:bzr] skip 'tests NOT having bzr'
[!net] skip
env GO111MODULE=on
env GOPROXY=
! go list launchpad.net/gocheck
stderr '"bzr": executable file not found'
-- go.mod --
module m
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_convert_dep.txt
|
env GO111MODULE=on
cd $WORK/test/x
go list -m all
stdout '^m$'
-- $WORK/test/Gopkg.lock --
-- $WORK/test/x/x.go --
package x // import "m/x"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_gofmt_invalid.txt
|
# Test for a crash in go fmt on invalid input when using modules.
# Issue 26792.
env GO111MODULE=on
! go fmt x.go
! stderr panic
-- go.mod --
module x
-- x.go --
// Missing package declaration.
var V int
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/list_tags.txt
|
# go list supports -tags
go list -tags=thetag ./my...
stdout mypkg
-- mypkg/x.go --
// +build thetag
package mypkg
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_get_indirect.txt
|
env GO111MODULE=on
# get -u should find quote v1.5.2
go get -u
go list -m all
stdout 'quote v1.5.2$'
grep 'rsc.io/quote v1.5.2$' go.mod
# it should also update x/text later than requested by v1.5.2
go list -m -f '{{.Path}} {{.Version}}{{if .Indirect}} // indirect{{end}}' all
stdout '^golang.org/x/text [v0-9a-f\.-]+ // indirect'
grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod
# importing an empty module root as a package makes it direct.
# TODO(bcmills): This doesn't seem correct. Fix is in the next change.
cp $WORK/tmp/usetext.go x.go
go list -e
grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod
# indirect tag should be removed upon seeing direct import.
cp $WORK/tmp/uselang.go x.go
go list
grep 'rsc.io/quote v1.5.2$' go.mod
grep 'golang.org/x/text [v0-9a-f\.-]+$' go.mod
# indirect tag should be added by go mod tidy
cp $WORK/tmp/usequote.go x.go
go mod tidy
grep 'rsc.io/quote v1.5.2$' go.mod
grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod
# requirement should be dropped entirely if not needed
cp $WORK/tmp/uselang.go x.go
go mod tidy
! grep rsc.io/quote go.mod
grep 'golang.org/x/text [v0-9a-f\.-]+$' go.mod
-- go.mod --
module x
require rsc.io/quote v1.5.1
-- x.go --
package x
-- $WORK/tmp/usetext.go --
package x
import _ "golang.org/x/text"
-- $WORK/tmp/uselang.go --
package x
import _ "golang.org/x/text/language"
-- $WORK/tmp/usequote.go --
package x
import _ "rsc.io/quote"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/help.txt
|
# go help shows overview.
go help
stdout 'Go is a tool'
stdout 'bug.*start a bug report'
# go help bug shows usage for bug
go help bug
stdout 'usage: go bug'
stdout 'bug report'
# go bug help is an error (bug takes no arguments)
! go bug help
stderr 'bug takes no arguments'
# go help mod shows mod subcommands
go help mod
stdout 'go mod <command>'
stdout tidy
# go help mod tidy explains tidy
go help mod tidy
stdout 'usage: go mod tidy'
# go mod help tidy does too
go mod help tidy
stdout 'usage: go mod tidy'
# go mod --help doesn't print help but at least suggests it.
! go mod --help
stderr 'Run ''go help mod'' for usage.'
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_get_upgrade.txt
|
env GO111MODULE=on
go get rsc.io/quote@v1.5.1
go list -m all
stdout 'rsc.io/quote v1.5.1'
grep 'rsc.io/quote v1.5.1$' go.mod
# get -u should update all dependencies
go get -u
grep 'rsc.io/quote v1.5.2$' go.mod
grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod
# get -u rsc.io/sampler should update only sampler's dependencies
cp go.mod-v1.5.1 go.mod
go get -u rsc.io/sampler
grep 'rsc.io/quote v1.5.1$' go.mod
grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod
# move to a pseudo-version after any tags
go get -m rsc.io/quote@dd9747d
grep 'rsc.io/quote v0.0.0-20180628003336-dd9747d19b04' go.mod
# get -u should not jump off newer pseudo-version to earlier tag
go get -m -u
grep 'rsc.io/quote v0.0.0-20180628003336-dd9747d19b04' go.mod
# move to earlier pseudo-version
go get -m rsc.io/quote@e7a685a342
grep 'rsc.io/quote v0.0.0-20180214005133-e7a685a342c0' go.mod
# get -u should jump off earlier pseudo-version to newer tag
go get -m -u
grep 'rsc.io/quote v1.5.2' go.mod
-- go.mod --
module x
require rsc.io/quote v1.1.0
-- go.mod-v1.5.1 --
module x
require rsc.io/quote v1.5.1
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/README
|
This directory holds test scripts *.txt run during 'go test cmd/go'.
To run a specific script foo.txt
go test cmd/go -run=Script/^foo$
In general script files should have short names: a few words, not whole sentences.
The first word should be the general category of behavior being tested,
often the name of a go subcommand (list, build, test, ...) or concept (vendor, pattern).
Each script is a text archive (go doc cmd/go/internal/txtar).
The script begins with an actual command script to run
followed by the content of zero or more supporting files to
create in the script's temporary file system before it starts executing.
As an example, run_hello.txt says:
# hello world
go run hello.go
stderr 'hello world'
! stdout .
-- hello.go --
package main
func main() { println("hello world") }
Each script runs in a fresh temporary work directory tree, available to scripts as $WORK.
Scripts also have access to these other environment variables:
GOARCH=<target GOARCH>
GOCACHE=<actual GOCACHE being used outside the test>
GOOS=<target GOOS>
GOPATH=$WORK/gopath
GOPROXY=<local module proxy serving from cmd/go/testdata/mod>
GOROOT=<actual GOROOT>
HOME=/no-home
PATH=<actual PATH>
TMPDIR=$WORK/tmp
devnull=<value of os.DevNull>
The environment variable $exe (lowercase) is an empty string on most systems, ".exe" on Windows.
The scripts supporting files are unpacked relative to $GOPATH/src (aka $WORK/gopath/src)
and then the script begins execution in that directory as well. Thus the example above runs
in $WORK/gopath/src with GOPATH=$WORK/gopath and $WORK/gopath/src/hello.go
containing the listed contents.
The lines at the top of the script are a sequence of commands to be executed
by a tiny script engine in ../../script_test.go (not the system shell).
The script stops and the overall test fails if any particular command fails.
Each line is parsed into a sequence of space-separated command words,
with environment variable expansion and # marking an end-of-line comment.
Adding single quotes around text keeps spaces in that text from being treated
as word separators and also disables environment variable expansion.
Inside a single-quoted block of text, a repeated single quote indicates
a literal single quote, as in:
'Don''t communicate by sharing memory.'
A line beginning with # is a comment and conventionally explains what is
being done or tested at the start of a new phase in the script.
The command prefix ! indicates that the command on the rest of the line
(typically go or a matching predicate) must fail, not succeed. Only certain
commands support this prefix. They are indicated below by [!] in the synopsis.
The command prefix [cond] indicates that the command on the rest of the line
should only run when the condition is satisfied. The available conditions are:
- GOOS and GOARCH values, like [386], [windows], and so on.
- Compiler names, like [gccgo], [gc].
- Test environment details:
- [short] for testing.Short()
- [cgo], [msan], [race] for whether cgo, msan, and the race detector can be used
- [net] for whether the external network can be used
- [link] for testenv.HasLink()
- [symlink] for testenv.HasSymlink()
- [exec:prog] for whether prog is available for execution (found by exec.LookPath)
A condition can be negated: [!short] means to run the rest of the line
when testing.Short() is false.
The commands are:
- cd dir
Change to the given directory for future commands.
- cmp file1 file2
Check that the named files have the same content.
By convention, file1 is the actual data and file2 the expected data.
File1 can be "stdout" or "stderr" to use the standard output or standard error
from the most recent exec or go command.
(If the files have differing content, the failure prints a diff.)
- cp src... dst
Copy the listed files to the target file or existing directory.
- env [key=value...]
With no arguments, print the environment (useful for debugging).
Otherwise add the listed key=value pairs to the environment.
- [!] exec program [args...]
Run the given executable program with the arguments.
It must (or must not) succeed.
Note that 'exec' does not terminate the script (unlike in Unix shells).
- [!] exists [-readonly] file...
Each of the listed files or directories must (or must not) exist.
If -readonly is given, the files or directories must be unwritable.
- [!] go args...
Run the (test copy of the) go command with the given arguments.
It must (or must not) succeed.
- [!] grep [-count=N] pattern file
The file's content must (or must not) match the regular expression pattern.
For positive matches, -count=N specifies an exact number of matches to require.
- mkdir path...
Create the listed directories, if they do not already exists.
- rm file...
Remove the listed files or directories.
- skip [message]
Mark the test skipped, including the message if given.
- [!] stale path...
The packages named by the path arguments must (or must not)
be reported as "stale" by the go command.
- [!] stderr [-count=N] pattern
Apply the grep command (see above) to the standard error
from the most recent exec or go command.
- [!] stdout [-count=N] pattern
Apply the grep command (see above) to the standard output
from the most recent exec or go command.
- stop [message]
Stop the test early (marking it as passing), including the message if given.
- symlink file -> target
Create file as a symlink to target. The -> (like in ls -l output) is required.
When TestScript runs a script and the script fails, by default TestScript shows
the execution of the most recent phase of the script (since the last # comment)
and only shows the # comments for earlier phases. For example, here is a
multi-phase script with a bug in it:
# GOPATH with p1 in d2, p2 in d2
env GOPATH=$WORK/d1${:}$WORK/d2
# build & install p1
env
go install -i p1
! stale p1
! stale p2
# modify p2 - p1 should appear stale
cp $WORK/p2x.go $WORK/d2/src/p2/p2.go
stale p1 p2
# build & install p1 again
go install -i p11
! stale p1
! stale p2
-- $WORK/d1/src/p1/p1.go --
package p1
import "p2"
func F() { p2.F() }
-- $WORK/d2/src/p2/p2.go --
package p2
func F() {}
-- $WORK/p2x.go --
package p2
func F() {}
func G() {}
The bug is that the final phase installs p11 instead of p1. The test failure looks like:
$ go test -run=Script
--- FAIL: TestScript (3.75s)
--- FAIL: TestScript/install_rebuild_gopath (0.16s)
script_test.go:223:
# GOPATH with p1 in d2, p2 in d2 (0.000s)
# build & install p1 (0.087s)
# modify p2 - p1 should appear stale (0.029s)
# build & install p1 again (0.022s)
> go install -i p11
[stderr]
can't load package: package p11: cannot find package "p11" in any of:
/Users/rsc/go/src/p11 (from $GOROOT)
$WORK/d1/src/p11 (from $GOPATH)
$WORK/d2/src/p11
[exit status 1]
FAIL: unexpected go command failure
script_test.go:73: failed at testdata/script/install_rebuild_gopath.txt:15 in $WORK/gopath/src
FAIL
exit status 1
FAIL cmd/go 4.875s
$
Note that the commands in earlier phases have been hidden, so that the relevant
commands are more easily found, and the elapsed time for a completed phase
is shown next to the phase heading. To see the entire execution, use "go test -v",
which also adds an initial environment dump to the beginning of the log.
Note also that in reported output, the actual name of the per-script temporary directory
has been consistently replaced with the literal string $WORK.
The cmd/go test flag -testwork (which must appear on the "go test" command line after
standard test flags) causes each test to log the name of its $WORK directory and other
environment variable settings and also to leave that directory behind when it exits,
for manual debugging of failing tests:
$ go test -run=Script -work
--- FAIL: TestScript (3.75s)
--- FAIL: TestScript/install_rebuild_gopath (0.16s)
script_test.go:223:
WORK=/tmp/cmd-go-test-745953508/script-install_rebuild_gopath
GOARCH=
GOCACHE=/Users/rsc/Library/Caches/go-build
GOOS=
GOPATH=$WORK/gopath
GOROOT=/Users/rsc/go
HOME=/no-home
TMPDIR=$WORK/tmp
exe=
# GOPATH with p1 in d2, p2 in d2 (0.000s)
# build & install p1 (0.085s)
# modify p2 - p1 should appear stale (0.030s)
# build & install p1 again (0.019s)
> go install -i p11
[stderr]
can't load package: package p11: cannot find package "p11" in any of:
/Users/rsc/go/src/p11 (from $GOROOT)
$WORK/d1/src/p11 (from $GOPATH)
$WORK/d2/src/p11
[exit status 1]
FAIL: unexpected go command failure
script_test.go:73: failed at testdata/script/install_rebuild_gopath.txt:15 in $WORK/gopath/src
FAIL
exit status 1
FAIL cmd/go 4.875s
$
$ WORK=/tmp/cmd-go-test-745953508/script-install_rebuild_gopath
$ cd $WORK/d1/src/p1
$ cat p1.go
package p1
import "p2"
func F() { p2.F() }
$
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_tidy_quote.txt
|
# Check that mod tidy does not introduce repeated
# require statements when input go.mod has quoted requirements.
env GO111MODULE=on
go mod tidy
grep -count=1 rsc.io/quote go.mod
cp go.mod2 go.mod
go mod tidy
grep -count=1 rsc.io/quote go.mod
-- go.mod --
module x
-- x.go --
package x
import "rsc.io/quote"
func main() { _ = quote.Hello }
-- go.mod2 --
module x
require (
"rsc.io/sampler" v1.3.0
"rsc.io/quote" v1.5.2
)
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_convert_glide.txt
|
env GO111MODULE=on
cd $WORK/test/x
go list -m all
stdout '^m$'
-- $WORK/test/glide.lock --
-- $WORK/test/x/x.go --
package x // import "m/x"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/list_std.txt
|
[!gc] skip
# listing GOROOT should only find standard packages
cd $GOROOT/src
go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' ./...
! stdout .
# TODO: ignore _/blah/go/src in output
# our vendored packages should be reported as standard
go list std cmd
stdout golang_org/x/net/http2/hpack
stdout cmd/vendor/golang\.org/x/arch/x86/x86asm
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/cover_atomic_pkgall.txt
|
[short] skip
go test -coverpkg=all -covermode=atomic x
stdout ok[\s\S]+?coverage
[!race] stop
go test -coverpkg=all -race x
stdout ok[\s\S]+?coverage
-- x/x.go --
package x
import _ "sync/atomic"
func F() {}
-- x/x_test.go --
package x
import "testing"
func TestF(t *testing.T) { F() }
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_download.txt
|
env GO111MODULE=on
# download with version should print nothing
go mod download rsc.io/quote@v1.5.0
! stdout .
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.info
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip
# download -json with version should print JSON
go mod download -json 'rsc.io/quote@<=v1.5.0'
stdout '^\t"Path": "rsc.io/quote"'
stdout '^\t"Version": "v1.5.0"'
stdout '^\t"Info": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.0.info"'
stdout '^\t"GoMod": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.0.mod"'
stdout '^\t"Zip": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.0.zip"'
stdout '^\t"Sum": "h1:6fJa6E\+wGadANKkUMlZ0DhXFpoKlslOQDCo259XtdIE="' # hash of testdata/mod version, not real version!
stdout '^\t"GoModSum": "h1:LzX7hefJvL54yjefDEDHNONDjII0t9xZLPXsUe\+TKr0="'
! stdout '"Error"'
# download queries above should not have added to go.mod.
go list -m all
! stdout rsc.io
# add to go.mod so we can test non-query downloads
go mod edit -require rsc.io/quote@v1.5.2
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip
# module loading will page in the info and mod files
go list -m all
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip
# download will fetch and unpack the zip file
go mod download
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.info
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.mod
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.2.zip
exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
go mod download -json
stdout '^\t"Path": "rsc.io/quote"'
stdout '^\t"Version": "v1.5.2"'
stdout '^\t"Info": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.2.info"'
stdout '^\t"GoMod": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.2.mod"'
stdout '^\t"Zip": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)cache(\\\\|/)download(\\\\|/)rsc.io(\\\\|/)quote(\\\\|/)@v(\\\\|/)v1.5.2.zip"'
stdout '^\t"Dir": ".*(\\\\|/)pkg(\\\\|/)mod(\\\\|/)rsc.io(\\\\|/)quote@v1.5.2"'
# download will follow replacements
go mod edit -require rsc.io/quote@v1.5.1 -replace rsc.io/quote@v1.5.1=rsc.io/quote@v1.5.3-pre1
go mod download
! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.1.zip
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.3-pre1.zip
# download will not follow replacements for explicit module queries
go mod download -json rsc.io/quote@v1.5.1
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.1.zip
-- go.mod --
module m
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/build_cache_compile.txt
|
# Set up fresh GOCACHE.
env GOCACHE=$WORK/gocache
mkdir $GOCACHE
# Building trivial non-main package should run compiler the first time.
go build -x lib.go
stderr '(compile|gccgo)( |\.exe).*lib\.go'
# ... but not again ...
go build -x lib.go
! stderr '(compile|gccgo)( |\.exe).*lib\.go'
# ... unless we use -a.
go build -a -x lib.go
stderr '(compile|gccgo)( |\.exe)'
-- lib.go --
package lib
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_convert_git.txt
|
env GO111MODULE=on
# detect root of module tree as root of enclosing git repo
cd $WORK/test/x
go list -m all
stdout '^m$'
-- $WORK/test/.git/config --
-- $WORK/test/x/x.go --
package x // import "m/x"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_load_badmod.txt
|
# Unknown lines should be ignored in dependency go.mod files.
env GO111MODULE=on
go list -m all
# ... and in replaced dependency go.mod files.
cp go.mod go.mod.usesub
go list -m all
# ... but not in the main module.
cp go.mod.bad go.mod
! go list -m all
stderr 'unknown directive: hello'
-- go.mod --
module m
require rsc.io/badmod v1.0.0
-- go.mod.bad --
module m
hello world
-- go.mod.usesub --
module m
require rsc.io/badmod v1.0.0
replace rsc.io/badmod v1.0.0 => ./sub
-- sub/go.mod --
module sub
hello world
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_test.txt
|
env GO111MODULE=on
# A test in the module's root package should work.
cd a/
cp go.mod.empty go.mod
go test
stdout PASS
cp go.mod.empty go.mod
go list -deps
! stdout ^testing$
# list all should include test dependencies, like testing
cp go.mod.empty go.mod
go list all
stdout ^testing$
stdout ^rsc.io/quote$
stdout ^rsc.io/testonly$
# list -deps -tests should also include testing
# but not deps of tests of deps (rsc.io/testonly).
go list -deps -test
stdout ^testing$
stdout ^rsc.io/quote$
! stdout ^rsc.io/testonly$
# list -test all should succeed
cp go.mod.empty go.mod
go list -test all
stdout '^testing'
cp go.mod.empty go.mod
go test
stdout PASS
# A test with the "_test" suffix in the module root should also work.
cd ../b/
go test
stdout PASS
# A test with the "_test" suffix of a *package* with a "_test" suffix should
# even work (not that you should ever do that).
cd ../c_test
go test
stdout PASS
cd ../d_test
go test
stdout PASS
-- a/go.mod.empty --
module example.com/user/a
-- a/a.go --
package a
-- a/a_test.go --
package a
import "testing"
import _ "rsc.io/quote"
func Test(t *testing.T) {}
-- b/go.mod --
module example.com/user/b
-- b/b.go --
package b
-- b/b_test.go --
package b_test
import "testing"
func Test(t *testing.T) {}
-- c_test/go.mod --
module example.com/c_test
-- c_test/umm.go --
// Package c_test is the non-test package for its import path!
package c_test
-- c_test/c_test_test.go --
package c_test_test
import "testing"
func Test(t *testing.T) {}
-- d_test/go.mod --
// Package d is an ordinary package in a deceptively-named directory.
module example.com/d
-- d_test/d.go --
package d
-- d_test/d_test.go --
package d_test
import "testing"
func Test(t *testing.T) {}
-- e/go.mod --
module example.com/e_test
-- e/wat.go --
// Package e_test is the non-test package for its import path,
// in a deceptively-named directory!
package e_test
-- e/e_test.go --
package e_test_test
import "testing"
func Test(t *testing.T) {}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_import_mod.txt
|
# Test that GOPATH/pkg/mod is excluded
env GO111MODULE=off
! go list mod/foo
stderr 'disallowed import path'
-- mod/foo/foo.go --
package foo
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_convert_tsv.txt
|
env GO111MODULE=on
cd $WORK/test/x
go list -m all
stdout '^m$'
-- $WORK/test/dependencies.tsv --
-- $WORK/test/x/x.go --
package x // import "m/x"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/list_test_imports.txt
|
# issue 26880: list with tests has wrong variant in imports
go list -test -f '{{.ImportPath}}:{{with .Imports}} {{join . ", "}}{{end}}' a b
cmp stdout imports.txt
-- a/a.go --
package a; import _ "b"
-- b/b.go --
package b
-- b/b_test.go --
package b
-- b/b_x_test.go --
package b_test; import _ "a"
-- imports.txt --
a: b
b:
b.test: b [b.test], b_test [b.test], os, testing, testing/internal/testdeps
b [b.test]:
b_test [b.test]: a [b.test]
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/get_with_git_trace.txt
|
env GIT_TRACE=1
[!net] skip
[!exec:git] skip
# go get should be success when GIT_TRACE set
go get golang.org/x/text
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/list_compiled_imports.txt
|
[!cgo] skip
# go list should report import "C"
cd x
go list -f '{{.Imports}}'
! stdout runtime/cgo
! stdout unsafe
! stdout syscall
stdout C
stdout unicode
stdout unicode/utf16
# go list -compiled should report imports in compiled files as well,
# adding "runtime/cgo", "unsafe", and "syscall" but not dropping "C".
go list -compiled -f '{{.Imports}}'
stdout runtime/cgo
stdout unsafe
stdout syscall
stdout C
stdout unicode
stdout unicode/utf16
-- x/x.go --
package x
import "C"
import "unicode" // does not use unsafe, syscall, runtime/cgo, unicode/utf16
-- x/x1.go --
package x
import "unicode/utf16" // does not use unsafe, syscall, runtime/cgo, unicode
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_get_commit.txt
|
env GO111MODULE=on
# @commit should resolve
# golang.org/x/text/language@commit should not resolve with -m,
# because that's not a module path.
! go get -m golang.org/x/text/language@14c0d48
# ... but it should work without -m.
# because of -d, the compiler should not run
go get -d -x golang.org/x/text/language@14c0d48
! stderr 'compile|cp|gccgo .*language\.a$'
# go get should skip build with no Go files in root
go get golang.org/x/text@14c0d48
# ... and go get should skip build with -m
go get -m golang.org/x/text@14c0d48
# dropping -d, we should see a build.
go get -x golang.org/x/text/language@14c0d48
stderr 'compile|cp|gccgo .*language\.a$'
# BUG: after the build, the package should not be stale, as 'go install' would
# not do anything further.
go list -f '{{.Stale}}' golang.org/x/text/language
stdout ^true
# install after get should not run the compiler again.
go install -x golang.org/x/text/language
! stderr 'compile|cp|gccgo .*language\.a$'
# even with -d, we should see an error for unknown packages.
! go get -d -x golang.org/x/text/foo@14c0d48
# get pseudo-version should record that version
go get rsc.io/quote@v0.0.0-20180214005840-23179ee8a569
grep 'rsc.io/quote v0.0.0-20180214005840-23179ee8a569' go.mod
# but as commit should record as v1.5.1
go get rsc.io/quote@23179ee8
grep 'rsc.io/quote v1.5.1' go.mod
# go mod edit -require does not interpret commits
go mod edit -require rsc.io/quote@23179ee
grep 'rsc.io/quote 23179ee' go.mod
# but other commands fix them
go mod graph
grep 'rsc.io/quote v1.5.1' go.mod
-- go.mod --
module x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_get_downgrade.txt
|
env GO111MODULE=on
# downgrade sampler should downgrade quote
go get rsc.io/sampler@v1.0.0
go list -m all
stdout 'rsc.io/quote v1.4.0'
stdout 'rsc.io/sampler v1.0.0'
# downgrade sampler away should downgrade quote further
go get rsc.io/sampler@none
go list -m all
stdout 'rsc.io/quote v1.3.0'
# downgrade should report inconsistencies and not change go.mod
go get rsc.io/quote@v1.5.1
go list -m all
stdout 'rsc.io/quote v1.5.1'
stdout 'rsc.io/sampler v1.3.0'
! go get rsc.io/sampler@v1.0.0 rsc.io/quote@v1.5.2 golang.org/x/text@none
stderr 'go get: inconsistent versions:\n\trsc.io/quote@v1.5.2 requires golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c \(not golang.org/x/text@none\), rsc.io/sampler@v1.3.0 \(not rsc.io/sampler@v1.0.0\)'
go list -m all
stdout 'rsc.io/quote v1.5.1'
stdout 'rsc.io/sampler v1.3.0'
# go get -u args should limit upgrades
cp go.mod.empty go.mod
go get -u rsc.io/quote@v1.4.0 rsc.io/sampler@v1.0.0
go list -m all
stdout 'rsc.io/quote v1.4.0'
stdout 'rsc.io/sampler v1.0.0'
! stdout golang.org/x/text
-- go.mod --
module x
require rsc.io/quote v1.5.1
-- go.mod.empty --
module x
-- x.go --
package x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_why.txt
|
env GO111MODULE=on
go list -test all
stdout rsc.io/quote
stdout golang.org/x/text/language
# why a package?
go mod why golang.org/x/text/language
cmp stdout why-language.txt
# why a module?
go mod why -m golang.org...
cmp stdout why-text-module.txt
# why a package used only in tests?
go mod why rsc.io/testonly
cmp stdout why-testonly.txt
# why a module used only in tests?
go mod why -m rsc.io/testonly
cmp stdout why-testonly.txt
# test package not needed
go mod why golang.org/x/text/unused
cmp stdout why-unused.txt
# vendor doesn't use packages used only in tests.
go mod why -vendor rsc.io/testonly
cmp stdout why-vendor.txt
# vendor doesn't use modules used only in tests.
go mod why -vendor -m rsc.io/testonly
cmp stdout why-vendor-module.txt
# test multiple packages
go mod why golang.org/x/text/language golang.org/x/text/unused
cmp stdout why-both.txt
# test multiple modules
go mod why -m rsc.io/quote rsc.io/sampler
cmp stdout why-both-module.txt
-- go.mod --
module mymodule
require rsc.io/quote v1.5.2
-- x/x.go --
package x
import _ "mymodule/z"
-- y/y.go --
package y
-- y/y_test.go --
package y
import _ "rsc.io/quote"
-- z/z.go --
package z
import _ "mymodule/y"
-- why-language.txt --
# golang.org/x/text/language
mymodule/y
mymodule/y.test
rsc.io/quote
rsc.io/sampler
golang.org/x/text/language
-- why-unused.txt --
# golang.org/x/text/unused
(main module does not need package golang.org/x/text/unused)
-- why-text-module.txt --
# golang.org/x/text
mymodule/y
mymodule/y.test
rsc.io/quote
rsc.io/sampler
golang.org/x/text/language
-- why-testonly.txt --
# rsc.io/testonly
mymodule/y
mymodule/y.test
rsc.io/quote
rsc.io/sampler
rsc.io/sampler.test
rsc.io/testonly
-- why-vendor.txt --
# rsc.io/testonly
(main module does not need to vendor package rsc.io/testonly)
-- why-vendor-module.txt --
# rsc.io/testonly
(main module does not need to vendor module rsc.io/testonly)
-- why-both.txt --
# golang.org/x/text/language
mymodule/y
mymodule/y.test
rsc.io/quote
rsc.io/sampler
golang.org/x/text/language
# golang.org/x/text/unused
(main module does not need package golang.org/x/text/unused)
-- why-both-module.txt --
# rsc.io/quote
mymodule/y
mymodule/y.test
rsc.io/quote
# rsc.io/sampler
mymodule/y
mymodule/y.test
rsc.io/quote
rsc.io/sampler
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_vendor_build.txt
|
env GO111MODULE=on
# initial conditions: using sampler v1.3.0, not listed in go.mod.
go list -deps
stdout rsc.io/sampler
! grep 'rsc.io/sampler v1.3.0' go.mod
# update to v1.3.1, now indirect in go.mod.
go get rsc.io/sampler@v1.3.1
grep 'rsc.io/sampler v1.3.1 // indirect' go.mod
cp go.mod go.mod.good
# vendoring can but should not need to make changes.
go mod vendor
cmp go.mod go.mod.good
# go list -mod=vendor (or go build -mod=vendor) must not modify go.mod.
# golang.org/issue/26704
go list -mod=vendor
cmp go.mod go.mod.good
-- go.mod --
module m
-- x.go --
package x
import _ "rsc.io/quote"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/binary_only.txt
|
# check that error for missing binary-only says where it should be
! go build b
stderr pkg[\\/].*a\.a
-- a/a.go --
//go:binary-only-package
package a
-- b/b.go --
package b; import "a"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/pattern_syntax_error.txt
|
# patterns match directories with syntax errors
! go list ./...
! go build ./...
! go install ./...
-- mypkg/x.go --
package mypkg
-- mypkg/y.go --
pkg mypackage
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_query_exclude.txt
|
env GO111MODULE=on
# get excluded version
cp go.mod1 go.mod
! go get rsc.io/quote@v1.5.0
stderr 'rsc.io/quote@v1.5.0 excluded'
# get non-excluded version
cp go.mod1 go.mod
go get rsc.io/quote@v1.5.1
stderr 'rsc.io/quote v1.5.1'
# get range with excluded version
cp go.mod1 go.mod
go get rsc.io/quote@>=v1.5
go list -m ...quote
stdout 'rsc.io/quote v1.5.[1-9]'
-- go.mod1 --
module x
exclude rsc.io/quote v1.5.0
-- x.go --
package x
import _ "rsc.io/quote"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/build_cache_output.txt
|
[!gc] skip
# Set up fresh GOCACHE.
env GOCACHE=$WORK/gocache
mkdir $GOCACHE
# Building a trivial non-main package should run compiler the first time.
go build -x -gcflags=-m lib.go
stderr 'compile( |\.exe"?)'
stderr 'lib.go:2.* can inline f'
# ... but not the second, even though it still prints the compiler output.
go build -x -gcflags=-m lib.go
! stderr 'compile( |\.exe"?)'
stderr 'lib.go:2.* can inline f'
# Building a trivial main package should run the compiler and linker the first time.
go build -x -gcflags=-m -ldflags='-v -w' main.go
stderr 'compile( |\.exe"?)'
stderr 'main.go:2.* can inline main' # from compiler
stderr 'link(\.exe"?)? -'
stderr '\d+ symbols' # from linker
# ... but not the second, even though it still prints the compiler and linker output.
go build -x -gcflags=-m -ldflags='-v -w' main.go
! stderr 'compile( |\.exe"?)'
stderr 'main.go:2.* can inline main' # from compiler
! stderr 'link(\.exe"?)? -'
stderr '\d+ symbols' # from linker
# Running a test should run the compiler, linker, and the test the first time.
go test -v -x -gcflags=-m -ldflags=-v p_test.go
stderr 'compile( |\.exe"?)'
stderr 'p_test.go:.*can inline Test' # from compile of p_test
stderr 'testmain\.go:.*inlin' # from compile of testmain
stderr 'link(\.exe"?)? -'
stderr '\d+ symbols' # from linker
stderr 'p\.test( |\.exe"?)'
stdout 'TEST' # from test
# ... but not the second, even though it still prints the compiler, linker, and test output.
go test -v -x -gcflags=-m -ldflags=-v p_test.go
! stderr 'compile( |\.exe"?)'
stderr 'p_test.go:.*can inline Test' # from compile of p_test
stderr 'testmain\.go:.*inlin' # from compile of testmain
! stderr 'link(\.exe"?)? -'
stderr '\d+ symbols' # from linker
! stderr 'p\.test( |\.exe"?)'
stdout 'TEST' # from test
-- lib.go --
package p
func f(x *int) *int { return x }
-- main.go --
package main
func main() {}
-- p_test.go --
package p
import "testing"
func Test(t *testing.T) {println("TEST")}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/test_badtest.txt
|
! go test badtest/...
! stdout ^ok
stdout ^FAIL\tbadtest/badexec
stdout ^FAIL\tbadtest/badsyntax
stdout ^FAIL\tbadtest/badvar
-- badtest/badexec/x_test.go --
package badexec
func init() {
panic("badexec")
}
-- badtest/badsyntax/x.go --
package badsyntax
-- badtest/badsyntax/x_test.go --
package badsyntax
func func func func func!
-- badtest/badvar/x.go --
package badvar
-- badtest/badvar/x_test.go --
package badvar_test
func f() {
_ = notdefined
}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_list_dir.txt
|
# go list with path to directory should work
env GO111MODULE=off
go list -f '{{.ImportPath}}' $GOROOT/src/math
stdout ^math$
env GO111MODULE=on
go list -f '{{.ImportPath}}' $GOROOT/src/math
stdout ^math$
go list -f '{{.ImportPath}}' .
stdout ^x$
! go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
stderr '^go: no such directory.*quote@v1.5.2'
go mod download rsc.io/quote@v1.5.2
go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
stdout '^rsc.io/quote$'
go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/sampler@v1.3.0
stdout '^rsc.io/sampler$'
go get -d rsc.io/sampler@v1.3.1
go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/sampler@v1.3.1
stdout '^rsc.io/sampler$'
! go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/sampler@v1.3.0
stderr 'outside available modules'
-- go.mod --
module x
require rsc.io/quote v1.5.2
-- x.go --
package x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_tidy.txt
|
env GO111MODULE=on
# tidy removes unused y, but everything else is used
go mod tidy -v
stderr '^unused y.1'
! stderr '^unused [^y]'
go list -m all
! stdout '^y'
stdout '^w.1 v1.2.0'
stdout '^z.1 v1.2.0'
# empty tidy should not crash
cd triv
go mod tidy
-- go.mod --
module m
require (
x.1 v1.0.0
y.1 v1.0.0
w.1 v1.2.0
)
replace x.1 v1.0.0 => ./x
replace y.1 v1.0.0 => ./y
replace z.1 v1.1.0 => ./z
replace z.1 v1.2.0 => ./z
replace w.1 => ./w
-- m.go --
package m
import _ "x.1"
import _ "z.1/sub"
-- w/go.mod --
module w
-- w/w.go --
package w
-- x/go.mod --
module x
require w.1 v1.1.0
require z.1 v1.1.0
-- x/x.go --
package x
import _ "w.1"
-- y/go.mod --
module y
require z.1 v1.2.0
-- z/go.mod --
module z
-- z/sub/sub.go --
package sub
-- triv/go.mod --
module triv
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_convert_vendor_yml.txt
|
env GO111MODULE=on
cd $WORK/test/x
go list -m all
stdout '^m$'
-- $WORK/test/vendor.yml --
-- $WORK/test/x/x.go --
package x // import "m/x"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_list_test.txt
|
env GO111MODULE=on
# go list -compiled -test must handle test-only packages
# golang.org/issue/27097.
go list -compiled -test
stdout '^m$'
stdout '^m\.test$'
stdout '^m \[m\.test\]$'
-- go.mod --
module m
-- x_test.go --
package x
import "testing"
func Test(t *testing.T) {}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_local_replace.txt
|
# Test that local replacements work even with dummy module names.
# golang.org/issue/24100.
env GO111MODULE=on
cd x/y
go list -f '{{.Dir}}' zz
stdout x[/\\]z$
-- x/y/go.mod --
module x/y
require zz v1.0.0
replace zz v1.0.0 => ../z
-- x/y/y.go --
package y
import _ "zz"
-- x/z/go.mod --
module x/z
-- x/z/z.go --
package z
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_internal.txt
|
env GO111MODULE=on
# golang.org/x/internal should be importable from other golang.org/x modules.
rm go.mod
go mod init golang.org/x/anything
go build .
# ...and their tests...
go test
stdout PASS
# ...but that should not leak into other modules.
! go build ./baddep
stderr golang.org[/\\]notx[/\\]useinternal
stderr 'use of internal package golang.org/x/.* not allowed'
# Internal packages in the standard library should not leak into modules.
! go build ./fromstd
stderr 'use of internal package internal/testenv not allowed'
# Packages found via standard-library vendoring should not leak.
! go build ./fromstdvendor
stderr 'use of vendored package golang_org/x/net/http/httpguts not allowed'
env GO111MODULE=off
! go build ./fromstdvendor
stderr 'cannot find package "golang_org/x/net/http/httpguts" in any of:'
env GO111MODULE=on
# Dependencies should be able to use their own internal modules...
rm go.mod
go mod init golang.org/notx
go build ./throughdep
# ... but other modules should not, even if they have transitive dependencies.
! go build .
stderr 'use of internal package golang.org/x/.* not allowed'
# And transitive dependencies still should not leak.
! go build ./baddep
stderr golang.org[/\\]notx[/\\]useinternal
stderr 'use of internal package golang.org/x/.* not allowed'
# Replacing an internal module should keep it internal to the same paths.
rm go.mod
go mod init golang.org/notx
go mod edit -replace golang.org/x/internal=./replace/golang.org/notx/internal
go build ./throughdep
! go build ./baddep
stderr golang.org[/\\]notx[/\\]useinternal
stderr 'use of internal package golang.org/x/.* not allowed'
go mod edit -replace golang.org/x/internal=./vendor/golang.org/x/internal
go build ./throughdep
! go build ./baddep
stderr golang.org[/\\]notx[/\\]useinternal
stderr 'use of internal package golang.org/x/.* not allowed'
-- useinternal.go --
package useinternal
import _ "golang.org/x/internal/subtle"
-- useinternal_test.go --
package useinternal_test
import (
"testing"
_ "golang.org/x/internal/subtle"
)
func Test(*testing.T) {}
-- throughdep/useinternal.go --
package throughdep
import _ "golang.org/x/useinternal"
-- baddep/useinternal.go --
package baddep
import _ "golang.org/notx/useinternal"
-- fromstd/useinternal.go --
package fromstd
import _ "internal/testenv"
-- fromstdvendor/useinternal.go --
package fromstdvendor
import _ "golang_org/x/net/http/httpguts"
-- replace/golang.org/notx/internal/go.mod --
module golang.org/x/internal
-- replace/golang.org/notx/internal/subtle/subtle.go --
package subtle
// Ha ha! Nothing here!
-- vendor/golang.org/x/internal/go.mod --
module golang.org/x/internal
-- vendor/golang.org/x/internal/subtle/subtle.go --
package subtle
// Ha ha! Nothing here!
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_case.txt
|
env GO111MODULE=on
go get rsc.io/QUOTE
go list -m all
stdout '^rsc.io/quote v1.5.2'
stdout '^rsc.io/QUOTE v1.5.2'
go list -f 'DIR {{.Dir}} DEPS {{.Deps}}' rsc.io/QUOTE/QUOTE
stdout 'DEPS.*rsc.io/quote'
stdout 'DIR.*!q!u!o!t!e'
go get rsc.io/QUOTE@v1.5.3-PRE
go list -m all
stdout '^rsc.io/QUOTE v1.5.3-PRE'
go list -f '{{.Dir}}' rsc.io/QUOTE/QUOTE
stdout '!q!u!o!t!e@v1.5.3-!p!r!e'
-- go.mod --
module x
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/mod_list.txt
|
env GO111MODULE=on
# list {{.Dir}} shows main module and go.mod but not not-yet-downloaded dependency dir.
go list -m -f '{{.Path}} {{.Main}} {{.GoMod}} {{.Dir}}' all
stdout '^x true .*[\\/]src[\\/]go.mod .*[\\/]src$'
stdout '^rsc.io/quote false .*[\\/]v1.5.2.mod $'
# list {{.Dir}} shows dependency after download (and go list without -m downloads it)
go list -f '{{.Dir}}' rsc.io/quote
stdout '.*mod[\\/]rsc.io[\\/]quote@v1.5.2$'
# downloaded dependencies are read-only
exists -readonly $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
exists -readonly $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/buggy
# go clean -modcache can delete read-only dependencies
go clean -modcache
! exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
# list {{.Dir}} shows replaced directories
cp go.mod2 go.mod
go list -f {{.Dir}} rsc.io/quote
go list -m -f '{{.Path}} {{.Version}} {{.Dir}}{{with .Replace}} {{.GoMod}} => {{.Version}} {{.Dir}} {{.GoMod}}{{end}}' all
stdout 'mod[\\/]rsc.io[\\/]quote@v1.5.1'
stdout 'v1.3.0.*mod[\\/]rsc.io[\\/]sampler@v1.3.1 .*[\\/]v1.3.1.mod => v1.3.1.*sampler@v1.3.1 .*[\\/]v1.3.1.mod'
# list std should work
go list std
stdout ^math/big
# rsc.io/quote/buggy should be listable as a package
go list rsc.io/quote/buggy
# rsc.io/quote/buggy should not be listable as a module
go list -m -e -f '{{.Error.Err}}' nonexist rsc.io/quote/buggy
stdout '^module "nonexist" is not a known dependency'
stdout '^module "rsc.io/quote/buggy" is not a known dependency'
! go list -m nonexist rsc.io/quote/buggy
stderr '^go list -m nonexist: module "nonexist" is not a known dependency'
stderr '^go list -m rsc.io/quote/buggy: module "rsc.io/quote/buggy" is not a known dependency'
# Module loader does not interfere with list -e (golang.org/issue/24149).
go list -e -f '{{.Error.Err}}' database
stdout 'no Go files in '
! go list database
stderr 'no Go files in '
-- go.mod --
module x
require rsc.io/quote v1.5.2
-- go.mod2 --
module x
require rsc.io/quote v1.5.1
replace rsc.io/sampler v1.3.0 => rsc.io/sampler v1.3.1
-- x.go --
package x
import _ "rsc.io/quote"
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/gcflags_patterns.txt
|
[!gc] skip 'using -gcflags and -ldflags'
# -gcflags=-e applies to named packages, not dependencies
go build -n -v -gcflags=-e z1 z2
stderr 'compile.* -e .*-p z1'
stderr 'compile.* -e .*-p z2'
stderr 'compile.* -p y'
! stderr 'compile.* -e .*-p [^z]'
# -gcflags can specify package=flags, and can be repeated; last match wins
go build -n -v -gcflags=-e -gcflags=z1=-N z1 z2
stderr 'compile.* -N .*-p z1'
! stderr 'compile.* -e .*-p z1'
! stderr 'compile.* -N .*-p z2'
stderr 'compile.* -e .*-p z2'
stderr 'compile.* -p y'
! stderr 'compile.* -e .*-p [^z]'
! stderr 'compile.* -N .*-p [^z]'
# -gcflags can have arbitrary spaces around the flags
go build -n -v -gcflags=' z1 = -e ' z1
stderr 'compile.* -e .*-p z1'
# -ldflags for implicit test package applies to test binary
go test -c -n -gcflags=-N -ldflags=-X=x.y=z z1
stderr 'compile.* -N .*z_test.go'
stderr 'link.* -X=x.y=z'
# -ldflags for explicit test package applies to test binary
go test -c -n -gcflags=z1=-N -ldflags=z1=-X=x.y=z z1
stderr 'compile.* -N .*z_test.go'
stderr 'link.* -X=x.y=z'
# -ldflags applies to link of command
go build -n -ldflags=-X=math.pi=3 my/cmd/prog
stderr 'link.* -X=math.pi=3'
# -ldflags applies to link of command even with strange directory name
go build -n -ldflags=-X=math.pi=3 my/cmd/prog/
stderr 'link.* -X=math.pi=3'
# -ldflags applies to current directory
cd my/cmd/prog
go build -n -ldflags=-X=math.pi=3
stderr 'link.* -X=math.pi=3'
# -ldflags applies to current directory even if GOPATH is funny
[windows] cd $WORK/GoPath/src/my/cmd/prog
[darwin] cd $WORK/GoPath/src/my/cmd/prog
go build -n -ldflags=-X=math.pi=3
stderr 'link.* -X=math.pi=3'
-- z1/z.go --
package z1
import _ "y"
import _ "z2"
-- z1/z_test.go --
package z1_test
import "testing"
func Test(t *testing.T) {}
-- z2/z.go --
package z2
-- y/y.go --
package y
-- my/cmd/prog/prog.go --
package main
func main() {}
|
script
|
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/vgo/vendor/cmd/go/testdata/script/linkname.txt
|
# check for linker name in error message about linker crash
[!gc] skip
! go build -ldflags=-crash_for_testing x.go
stderr [\\/]tool[\\/].*[\\/]link
-- x.go --
package main; func main() {}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.