diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-02-05 14:33:27 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-02-15 09:14:10 -0800 |
commit | 0b3c2eed35d608d6541ecf004a9576b4eae0b4ef (patch) | |
tree | c92c05d53eb054d8085d069800f4e9b586fef5a3 /libgo/go/cmd | |
parent | 17edb3310d8ce9d5f6c9e53f6c1f7d611c2a5a41 (diff) | |
download | gcc-0b3c2eed35d608d6541ecf004a9576b4eae0b4ef.zip gcc-0b3c2eed35d608d6541ecf004a9576b4eae0b4ef.tar.gz gcc-0b3c2eed35d608d6541ecf004a9576b4eae0b4ef.tar.bz2 |
libgo: update to Go1.14rc1 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/218017
Diffstat (limited to 'libgo/go/cmd')
93 files changed, 254 insertions, 941 deletions
diff --git a/libgo/go/cmd/go/alldocs.go b/libgo/go/cmd/go/alldocs.go index 54e7a8b..971a756 100644 --- a/libgo/go/cmd/go/alldocs.go +++ b/libgo/go/cmd/go/alldocs.go @@ -907,7 +907,7 @@ // Main bool // is this the main module? // Indirect bool // is this module only an indirect dependency of main module? // Dir string // directory holding files for this module, if any -// GoMod string // path to go.mod file for this module, if any +// GoMod string // path to go.mod file used when loading this module, if any // GoVersion string // go version used in module // Error *ModuleError // error loading module // } @@ -916,6 +916,9 @@ // Err string // the error itself // } // +// The file GoMod refers to may be outside the module directory if the +// module is in the module cache or if the -modfile flag is used. +// // The default output is to print the module path and then // information about the version and replacement if any. // For example, 'go list -m all' might print: @@ -1020,7 +1023,9 @@ // execution. The "go mod download" command is useful mainly for pre-filling // the local cache or to compute the answers for a Go module proxy. // -// By default, download reports errors to standard error but is otherwise silent. +// By default, download writes nothing to standard output. It may print progress +// messages and errors to standard error. +// // The -json flag causes download to print a sequence of JSON objects // to standard output, describing each downloaded module (or failure), // corresponding to this Go struct: @@ -2346,14 +2351,15 @@ // // Module support // -// Go 1.13 includes support for Go modules. Module-aware mode is active by default -// whenever a go.mod file is found in, or in a parent of, the current directory. +// The go command includes support for Go modules. Module-aware mode is active +// by default whenever a go.mod file is found in the current directory or in +// any parent directory. // // The quickest way to take advantage of module support is to check out your // repository, create a go.mod file (described in the next section) there, and run // go commands from within that file tree. // -// For more fine-grained control, Go 1.13 continues to respect +// For more fine-grained control, the go command continues to respect // a temporary environment variable, GO111MODULE, which can be set to one // of three string values: off, on, or auto (the default). // If GO111MODULE=on, then the go command requires the use of modules, diff --git a/libgo/go/cmd/go/go_test.go b/libgo/go/cmd/go/go_test.go index ebd0c7a..d535ea0 100644 --- a/libgo/go/cmd/go/go_test.go +++ b/libgo/go/cmd/go/go_test.go @@ -638,7 +638,7 @@ func (tg *testgoData) grepStderrNot(match, msg string) { } // grepBothNot looks for a regular expression in the test run's -// standard output or stand error and fails, logging msg, if it is +// standard output or standard error and fails, logging msg, if it is // found. func (tg *testgoData) grepBothNot(match, msg string) { tg.t.Helper() @@ -913,6 +913,7 @@ func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() // Copy the runtime packages into a temporary GOROOT // so that we can change files. @@ -1026,28 +1027,6 @@ func TestInternalPackagesOutsideGOROOTAreRespected(t *testing.T) { tg.grepBoth(`testinternal2(\/|\\)p\.go\:3\:8\: use of internal package .*internal/w not allowed`, "wrote error message for testdata/testinternal2") } -func TestRunInternal(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - dir := filepath.Join(tg.pwd(), "testdata") - tg.setenv("GOPATH", dir) - tg.run("run", filepath.Join(dir, "src/run/good.go")) - tg.runFail("run", filepath.Join(dir, "src/run/bad.go")) - tg.grepStderr(`testdata(\/|\\)src(\/|\\)run(\/|\\)bad\.go\:3\:8\: use of internal package run/subdir/internal/private not allowed`, "unexpected error for run/bad.go") -} - -func TestRunPkg(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - dir := filepath.Join(tg.pwd(), "testdata") - tg.setenv("GOPATH", dir) - tg.run("run", "hello") - tg.grepStderr("hello, world", "did not find hello, world") - tg.cd(filepath.Join(dir, "src/hello")) - tg.run("run", ".") - tg.grepStderr("hello, world", "did not find hello, world") -} - func TestInternalPackageErrorsAreHandled(t *testing.T) { tg := testgo(t) defer tg.cleanup() @@ -1062,56 +1041,6 @@ func TestInternalCache(t *testing.T) { tg.grepStderr("internal", "did not fail to build p") } -func TestImportCommandMatch(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/importcom")) - tg.run("build", "./testdata/importcom/works.go") -} - -func TestImportCommentMismatch(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/importcom")) - tg.runFail("build", "./testdata/importcom/wrongplace.go") - tg.grepStderr(`wrongplace expects import "my/x"`, "go build did not mention incorrect import") -} - -func TestImportCommentSyntaxError(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/importcom")) - tg.runFail("build", "./testdata/importcom/bad.go") - tg.grepStderr("cannot parse import comment", "go build did not mention syntax error") -} - -func TestImportCommentConflict(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/importcom")) - tg.runFail("build", "./testdata/importcom/conflict.go") - tg.grepStderr("found import comments", "go build did not mention comment conflict") -} - -func TestImportCycle(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/importcycle")) - tg.runFail("build", "selfimport") - - count := tg.grepCountBoth("import cycle not allowed") - if count == 0 { - t.Fatal("go build did not mention cyclical import") - } - if count > 1 { - t.Fatal("go build mentioned import cycle more than once") - } - - // Don't hang forever. - tg.run("list", "-e", "-json", "selfimport") -} - // cmd/go: custom import path checking should not apply to Go packages without import comment. func TestIssue10952(t *testing.T) { testenv.MustHaveExternalNetwork(t) @@ -1217,24 +1146,6 @@ func TestAccidentalGitCheckout(t *testing.T) { } } -func TestErrorMessageForSyntaxErrorInTestGoFileSaysFAIL(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("test", "syntaxerror") - tg.grepStderr("x_test.go:", "did not diagnose error") - tg.grepStdout("FAIL", "go test did not say FAIL") -} - -func TestWildcardsDoNotLookInUselessDirectories(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("list", "...") - tg.grepBoth("badpkg", "go list ... failure does not mention badpkg") - tg.run("list", "m...") -} - func TestRelativeImportsGoTest(t *testing.T) { tg := testgo(t) defer tg.cleanup() @@ -1673,6 +1584,7 @@ func TestDefaultGOPATHGet(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.setenv("GOPATH", "") tg.tempDir("home") tg.setenv(homeEnvName(), tg.path("home")) @@ -1697,6 +1609,7 @@ func TestDefaultGOPATHGet(t *testing.T) { func TestDefaultGOPATHPrintedSearchList(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.setenv("GOPATH", "") tg.tempDir("home") tg.setenv(homeEnvName(), tg.path("home")) @@ -1819,16 +1732,6 @@ func TestGoTestMutexprofileDashOControlsBinaryLocation(t *testing.T) { tg.wantExecutable("myerrors.test"+exeSuffix, "go test -mutexprofile -o myerrors.test did not create myerrors.test") } -func TestGoBuildNonMain(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - // TODO: tg.parallel() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("build", "-buildmode=exe", "-o", "not_main"+exeSuffix, "not_main") - tg.grepStderr("-buildmode=exe requires exactly one main package", "go build with -o and -buildmode=exe should on a non-main package should throw an error") - tg.mustNotExist("not_main" + exeSuffix) -} - func TestGoTestDashCDashOControlsBinaryLocation(t *testing.T) { skipIfGccgo(t, "gccgo has no standard packages") tooSlow(t) @@ -2192,33 +2095,6 @@ func TestCoverageNoStatements(t *testing.T) { tg.grepStdout("[no statements]", "expected [no statements] for pkg4") } -func TestCoverageImportMainLoop(t *testing.T) { - skipIfGccgo(t, "gccgo has no cover tool") - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("test", "importmain/test") - tg.grepStderr("not an importable package", "did not detect import main") - tg.runFail("test", "-cover", "importmain/test") - tg.grepStderr("not an importable package", "did not detect import main") -} - -func TestCoveragePattern(t *testing.T) { - skipIfGccgo(t, "gccgo has no cover tool") - tooSlow(t) - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.makeTempdir() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - - // If coverpkg=sleepy... expands by package loading - // (as opposed to pattern matching on deps) - // then it will try to load sleepybad, which does not compile, - // and the test command will fail. - tg.run("test", "-coverprofile="+tg.path("cover.out"), "-coverpkg=sleepy...", "-run=^$", "sleepy1") -} - func TestCoverageErrorLine(t *testing.T) { skipIfGccgo(t, "gccgo has no cover tool") tooSlow(t) @@ -2291,20 +2167,6 @@ func TestCoverageDashC(t *testing.T) { tg.wantExecutable(tg.path("coverdep"), "go -test -c -coverprofile did not create executable") } -func TestPluginNonMain(t *testing.T) { - wd, err := os.Getwd() - if err != nil { - t.Fatal(err) - } - - pkg := filepath.Join(wd, "testdata", "testdep", "p2") - - tg := testgo(t) - defer tg.cleanup() - - tg.runFail("build", "-buildmode=plugin", pkg) -} - func TestTestEmpty(t *testing.T) { if !canRace { t.Skip("no race detector") @@ -2389,39 +2251,6 @@ func main() { tg.grepStderrNot(`os.Stat .* no such file or directory`, "unexpected stat of archive file") } -func TestCoverageWithCgo(t *testing.T) { - skipIfGccgo(t, "gccgo has no cover tool") - tooSlow(t) - if !canCgo { - t.Skip("skipping because cgo not enabled") - } - - for _, dir := range []string{"cgocover", "cgocover2", "cgocover3", "cgocover4"} { - t.Run(dir, func(t *testing.T) { - tg := testgo(t) - tg.parallel() - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.run("test", "-short", "-cover", dir) - data := tg.getStdout() + tg.getStderr() - checkCoverage(tg, data) - }) - } -} - -func TestCgoAsmError(t *testing.T) { - if !canCgo { - t.Skip("skipping because cgo not enabled") - } - - tg := testgo(t) - tg.parallel() - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("build", "cgoasm") - tg.grepBoth("package using cgo has Go assembly file", "did not detect Go assembly file") -} - func TestCgoDependsOnSyscall(t *testing.T) { if testing.Short() { t.Skip("skipping test that removes $GOROOT/pkg/*_race in short mode") @@ -2435,6 +2264,8 @@ func TestCgoDependsOnSyscall(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() + files, err := filepath.Glob(filepath.Join(runtime.GOROOT(), "pkg", "*_race")) tg.must(err) for _, file := range files { @@ -2648,14 +2479,6 @@ func TestListTemplateContextFunction(t *testing.T) { } } -// cmd/go: "go test" should fail if package does not build -func TestIssue7108(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("test", "notest") -} - func TestGoBuildTestOnly(t *testing.T) { tg := testgo(t) defer tg.cleanup() @@ -2677,17 +2500,6 @@ func TestGoBuildTestOnly(t *testing.T) { tg.run("install", "./testonly...") } -func TestGoTestDetectsTestOnlyImportCycles(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("test", "-c", "testcycle/p3") - tg.grepStderr("import cycle not allowed in test", "go test testcycle/p3 produced unexpected error") - - tg.runFail("test", "-c", "testcycle/q1") - tg.grepStderr("import cycle not allowed in test", "go test testcycle/q1 produced unexpected error") -} - func TestGoTestFooTestWorks(t *testing.T) { tg := testgo(t) defer tg.cleanup() @@ -2715,29 +2527,6 @@ func TestGoTestMainAsNormalTest(t *testing.T) { tg.grepBoth(okPattern, "go test did not say ok") } -func TestGoTestMainTwice(t *testing.T) { - if testing.Short() { - t.Skip("Skipping in short mode") - } - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOCACHE", tg.tempdir) - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.run("test", "-v", "multimain") - if strings.Count(tg.getStdout(), "notwithstanding") != 2 { - t.Fatal("tests did not run twice") - } -} - -func TestGoTestFlagsAfterPackage(t *testing.T) { - tooSlow(t) - tg := testgo(t) - defer tg.cleanup() - tg.run("test", "testdata/flag_test.go", "-v", "-args", "-v=7") // Two distinct -v flags. - tg.run("test", "-v", "testdata/flag_test.go", "-args", "-v=7") // Two distinct -v flags. -} - func TestGoTestXtestonlyWorks(t *testing.T) { tg := testgo(t) defer tg.cleanup() @@ -2829,20 +2618,6 @@ func TestGoGenerateXTestPkgName(t *testing.T) { } } -func TestGoGenerateBadImports(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("skipping because windows has no echo command") - } - - // This package has an invalid import causing an import cycle, - // but go generate is supposed to still run. - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.run("generate", "gencycle") - tg.grepStdout("hello world", "go generate gencycle did not run generator") -} - func TestGoGetCustomDomainWildcard(t *testing.T) { testenv.MustHaveExternalNetwork(t) testenv.MustHaveExecPath(t, "git") @@ -3268,43 +3043,6 @@ func TestGoTestRaceInstallCgo(t *testing.T) { } } -func TestGoTestRaceFailures(t *testing.T) { - tooSlow(t) - - if !canRace { - t.Skip("skipping because race detector not supported") - } - - tg := testgo(t) - tg.parallel() - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - - tg.run("test", "testrace") - - tg.runFail("test", "-race", "testrace") - tg.grepStdout("FAIL: TestRace", "TestRace did not fail") - tg.grepBothNot("PASS", "something passed") - - tg.runFail("test", "-race", "testrace", "-run", "XXX", "-bench", ".") - tg.grepStdout("FAIL: BenchmarkRace", "BenchmarkRace did not fail") - tg.grepBothNot("PASS", "something passed") -} - -func TestGoTestImportErrorStack(t *testing.T) { - const out = `package testdep/p1 (test) - imports testdep/p2 - imports testdep/p3: build constraints exclude all Go files ` - - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("test", "testdep/p1") - if !strings.Contains(tg.stderr.String(), out) { - t.Fatalf("did not give full import stack:\n\n%s", tg.stderr.String()) - } -} - func TestGoGetUpdate(t *testing.T) { // golang.org/issue/9224. // The recursive updating was trying to walk to @@ -3627,27 +3365,6 @@ func TestGoGetUpdateAllDoesNotTryToLoadDuplicates(t *testing.T) { tg.grepStderrNot("duplicate loads of", "did not remove old packages from cache") } -// Issue 17119 more duplicate load errors -func TestIssue17119(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("build", "dupload") - tg.grepBothNot("duplicate load|internal error", "internal error") -} - -func TestFatalInBenchmarkCauseNonZeroExitStatus(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - // TODO: tg.parallel() - tg.runFail("test", "-run", "^$", "-bench", ".", "./testdata/src/benchfatal") - tg.grepBothNot("^ok", "test passed unexpectedly") - tg.grepBoth("FAIL.*benchfatal", "test did not run everything") -} - func TestBinaryOnlyPackages(t *testing.T) { tooSlow(t) @@ -3813,16 +3530,6 @@ func TestMatchesNoTests(t *testing.T) { tg.grepBoth(noMatchesPattern, "go test did not say [no tests to run]") } -func TestMatchesNoTestsDoesNotOverrideBuildFailure(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("test", "-run", "ThisWillNotMatch", "syntaxerror") - tg.grepBothNot(noMatchesPattern, "go test did say [no tests to run]") - tg.grepBoth("FAIL", "go test did not say FAIL") -} - func TestMatchesNoBenchmarksIsOK(t *testing.T) { tg := testgo(t) defer tg.cleanup() @@ -3850,18 +3557,6 @@ func TestMatchesOnlyBenchmarkIsOK(t *testing.T) { tg.grepBoth(okPattern, "go test did not say ok") } -func TestBenchmarkLabels(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - // TODO: tg.parallel() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.run("test", "-run", "^$", "-bench", ".", "bench") - tg.grepStdout(`(?m)^goos: `+runtime.GOOS, "go test did not print goos") - tg.grepStdout(`(?m)^goarch: `+runtime.GOARCH, "go test did not print goarch") - tg.grepStdout(`(?m)^pkg: bench`, "go test did not say pkg: bench") - tg.grepBothNot(`(?s)pkg:.*pkg:`, "go test said pkg multiple times") -} - func TestBenchmarkLabelsOutsideGOPATH(t *testing.T) { tg := testgo(t) defer tg.cleanup() @@ -4261,25 +3956,6 @@ func TestCgoFlagContainsSpace(t *testing.T) { tg.grepStderrNot(`"-L[^"]+c flags".*"-L[^"]+c flags"`, "found too many quoted ld flags") } -// Issue #20435. -func TestGoTestRaceCoverModeFailures(t *testing.T) { - tooSlow(t) - if !canRace { - t.Skip("skipping because race detector not supported") - } - - tg := testgo(t) - tg.parallel() - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - - tg.run("test", "testrace") - - tg.runFail("test", "-race", "-covermode=set", "testrace") - tg.grepStderr(`-covermode must be "atomic", not "set", when -race is enabled`, "-race -covermode=set was allowed") - tg.grepBothNot("PASS", "something passed") -} - // Issue 9737: verify that GOARM and GO386 affect the computed build ID. func TestBuildIDContainsArchModeEnv(t *testing.T) { if testing.Short() { @@ -4319,60 +3995,6 @@ func main() {}`) })) } -func TestTestRegexps(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.run("test", "-cpu=1", "-run=X/Y", "-bench=X/Y", "-count=2", "-v", "testregexp") - var lines []string - for _, line := range strings.SplitAfter(tg.getStdout(), "\n") { - if strings.Contains(line, "=== RUN") || strings.Contains(line, "--- BENCH") || strings.Contains(line, "LOG") { - lines = append(lines, line) - } - } - - // Important parts: - // TestX is run, twice - // TestX/Y is run, twice - // TestXX is run, twice - // TestZ is not run - // BenchmarkX is run but only with N=1, once - // BenchmarkXX is run but only with N=1, once - // BenchmarkX/Y is run in full, twice - want := `=== RUN TestX - TestX: x_test.go:6: LOG: X running -=== RUN TestX/Y - TestX/Y: x_test.go:8: LOG: Y running -=== RUN TestXX - TestXX: z_test.go:10: LOG: XX running -=== RUN TestX - TestX: x_test.go:6: LOG: X running -=== RUN TestX/Y - TestX/Y: x_test.go:8: LOG: Y running -=== RUN TestXX - TestXX: z_test.go:10: LOG: XX running - BenchmarkX: x_test.go:13: LOG: X running N=1 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=1 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=100 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=10000 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=100000000 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000000 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=1 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=100 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=10000 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=100000000 - BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000000 - BenchmarkXX: z_test.go:18: LOG: XX running N=1 -` - - have := strings.Join(lines, "") - if have != want { - t.Errorf("reduced output:<<<\n%s>>> want:<<<\n%s>>>", have, want) - } -} - func TestListTests(t *testing.T) { tooSlow(t) var tg *testgoData @@ -4408,6 +4030,7 @@ func TestBuildmodePIE(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.tempFile("main.go", `package main; func main() { print("hello") }`) src := tg.path("main.go") @@ -4571,6 +4194,7 @@ func TestUpxCompression(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.tempFile("main.go", `package main; import "fmt"; func main() { fmt.Print("hello upx") }`) src := tg.path("main.go") @@ -4964,14 +4588,6 @@ func TestInstallDeps(t *testing.T) { tg.mustExist(p1) } -func TestGoTestMinusN(t *testing.T) { - // Intent here is to verify that 'go test -n' works without crashing. - // This reuses flag_test.go, but really any test would do. - tg := testgo(t) - defer tg.cleanup() - tg.run("test", "testdata/flag_test.go", "-n", "-args", "-v=7") -} - func TestGoTestJSON(t *testing.T) { skipIfGccgo(t, "gccgo does not have standard packages") tooSlow(t) @@ -5109,6 +4725,7 @@ func init() {} func TestBadCommandLines(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.tempFile("src/x/x.go", "package x\n") tg.setenv("GOPATH", tg.path(".")) @@ -5329,6 +4946,7 @@ func TestCgoCache(t *testing.T) { func TestFilepathUnderCwdFormat(t *testing.T) { tg := testgo(t) defer tg.cleanup() + tg.parallel() tg.run("test", "-x", "-cover", "log") tg.grepStderrNot(`\.log\.cover\.go`, "-x output should contain correctly formatted filepath under cwd") } @@ -5433,16 +5051,6 @@ func TestCDAndGOPATHAreDifferent(t *testing.T) { } } -// Issue 26242. -func TestGoTestWithoutTests(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.run("test", "testnorun") - tg.grepStdout(`testnorun\t\[no test files\]`, "do not want test to run") -} - // Issue 25579. func TestGoBuildDashODevNull(t *testing.T) { tooSlow(t) diff --git a/libgo/go/cmd/go/internal/clean/clean.go b/libgo/go/cmd/go/internal/clean/clean.go index 5f4bf4e..69e1748 100644 --- a/libgo/go/cmd/go/internal/clean/clean.go +++ b/libgo/go/cmd/go/internal/clean/clean.go @@ -178,7 +178,9 @@ func runClean(cmd *base.Command, args []string) { } } if err != nil { - base.Errorf("go clean -testcache: %v", err) + if _, statErr := os.Stat(dir); !os.IsNotExist(statErr) { + base.Errorf("go clean -testcache: %v", err) + } } } } diff --git a/libgo/go/cmd/go/internal/list/list.go b/libgo/go/cmd/go/internal/list/list.go index b393c67..8d979e2 100644 --- a/libgo/go/cmd/go/internal/list/list.go +++ b/libgo/go/cmd/go/internal/list/list.go @@ -211,7 +211,7 @@ applied to a Go struct, but now a Module struct: Main bool // is this the main module? Indirect bool // is this module only an indirect dependency of main module? Dir string // directory holding files for this module, if any - GoMod string // path to go.mod file for this module, if any + GoMod string // path to go.mod file used when loading this module, if any GoVersion string // go version used in module Error *ModuleError // error loading module } @@ -220,6 +220,9 @@ applied to a Go struct, but now a Module struct: Err string // the error itself } +The file GoMod refers to may be outside the module directory if the +module is in the module cache or if the -modfile flag is used. + The default output is to print the module path and then information about the version and replacement if any. For example, 'go list -m all' might print: @@ -387,15 +390,24 @@ func runList(cmd *base.Command, args []string) { modload.InitMod() // Parses go.mod and sets cfg.BuildMod. if cfg.BuildMod == "vendor" { + const actionDisabledFormat = "go list -m: can't %s using the vendor directory\n\t(Use -mod=mod or -mod=readonly to bypass.)" + + if *listVersions { + base.Fatalf(actionDisabledFormat, "determine available versions") + } + if *listU { + base.Fatalf(actionDisabledFormat, "determine available upgrades") + } + for _, arg := range args { // In vendor mode, the module graph is incomplete: it contains only the // explicit module dependencies and the modules that supply packages in // the import graph. Reject queries that imply more information than that. if arg == "all" { - base.Fatalf("go list -m: can't compute 'all' using the vendor directory\n\t(Use -mod=mod or -mod=readonly to bypass.)") + base.Fatalf(actionDisabledFormat, "compute 'all'") } if strings.Contains(arg, "...") { - base.Fatalf("go list -m: can't match module patterns using the vendor directory\n\t(Use -mod=mod or -mod=readonly to bypass.)") + base.Fatalf(actionDisabledFormat, "match module patterns") } } } diff --git a/libgo/go/cmd/go/internal/modcmd/download.go b/libgo/go/cmd/go/internal/modcmd/download.go index 5db0e46..7d5294d 100644 --- a/libgo/go/cmd/go/internal/modcmd/download.go +++ b/libgo/go/cmd/go/internal/modcmd/download.go @@ -30,7 +30,9 @@ The go command will automatically download modules as needed during ordinary execution. The "go mod download" command is useful mainly for pre-filling the local cache or to compute the answers for a Go module proxy. -By default, download reports errors to standard error but is otherwise silent. +By default, download writes nothing to standard output. It may print progress +messages and errors to standard error. + The -json flag causes download to print a sequence of JSON objects to standard output, describing each downloaded module (or failure), corresponding to this Go struct: diff --git a/libgo/go/cmd/go/internal/modfetch/cache.go b/libgo/go/cmd/go/internal/modfetch/cache.go index 104fce8..947192b 100644 --- a/libgo/go/cmd/go/internal/modfetch/cache.go +++ b/libgo/go/cmd/go/internal/modfetch/cache.go @@ -13,7 +13,6 @@ import ( "os" "path/filepath" "strings" - "time" "cmd/go/internal/base" "cmd/go/internal/cfg" @@ -28,8 +27,6 @@ import ( var PkgMod string // $GOPATH/pkg/mod; set by package modload -const logFindingDelay = 1 * time.Second - func cacheDir(path string) (string, error) { if PkgMod == "" { return "", fmt.Errorf("internal error: modfetch.PkgMod not set") @@ -140,11 +137,6 @@ func (r *cachingRepo) Versions(prefix string) ([]string, error) { err error } c := r.cache.Do("versions:"+prefix, func() interface{} { - logTimer := time.AfterFunc(logFindingDelay, func() { - fmt.Fprintf(os.Stderr, "go: finding versions for %s\n", r.path) - }) - defer logTimer.Stop() - list, err := r.r.Versions(prefix) return cached{list, err} }).(cached) @@ -167,11 +159,6 @@ func (r *cachingRepo) Stat(rev string) (*RevInfo, error) { return cachedInfo{info, nil} } - logTimer := time.AfterFunc(logFindingDelay, func() { - fmt.Fprintf(os.Stderr, "go: finding %s %s\n", r.path, rev) - }) - defer logTimer.Stop() - info, err = r.r.Stat(rev) if err == nil { // If we resolved, say, 1234abcde to v0.0.0-20180604122334-1234abcdef78, @@ -199,11 +186,6 @@ func (r *cachingRepo) Stat(rev string) (*RevInfo, error) { func (r *cachingRepo) Latest() (*RevInfo, error) { c := r.cache.Do("latest:", func() interface{} { - logTimer := time.AfterFunc(logFindingDelay, func() { - fmt.Fprintf(os.Stderr, "go: finding %s latest\n", r.path) - }) - defer logTimer.Stop() - info, err := r.r.Latest() // Save info for likely future Stat call. diff --git a/libgo/go/cmd/go/internal/modfetch/codehost/git.go b/libgo/go/cmd/go/internal/modfetch/codehost/git.go index e329cbc..f08df51 100644 --- a/libgo/go/cmd/go/internal/modfetch/codehost/git.go +++ b/libgo/go/cmd/go/internal/modfetch/codehost/git.go @@ -682,8 +682,11 @@ func (r *gitRepo) RecentTag(rev, prefix, major string) (tag string, err error) { semtag := line[len(prefix):] // Consider only tags that are valid and complete (not just major.minor prefixes). - if c := semver.Canonical(semtag); c != "" && strings.HasPrefix(semtag, c) && (major == "" || semver.Major(c) == major) { - highest = semver.Max(highest, semtag) + // NOTE: Do not replace the call to semver.Compare with semver.Max. + // We want to return the actual tag, not a canonicalized version of it, + // and semver.Max currently canonicalizes (see golang.org/issue/32700). + if c := semver.Canonical(semtag); c != "" && strings.HasPrefix(semtag, c) && (major == "" || semver.Major(c) == major) && semver.Compare(semtag, highest) > 0 { + highest = semtag } } diff --git a/libgo/go/cmd/go/internal/modfetch/coderepo.go b/libgo/go/cmd/go/internal/modfetch/coderepo.go index de757ec..d1d24a40 100644 --- a/libgo/go/cmd/go/internal/modfetch/coderepo.go +++ b/libgo/go/cmd/go/internal/modfetch/coderepo.go @@ -191,22 +191,6 @@ func (r *codeRepo) appendIncompatibleVersions(list, incompatible []string) ([]st return list, nil } - // We assume that if the latest release of any major version has a go.mod - // file, all subsequent major versions will also have go.mod files (and thus - // be ineligible for use as +incompatible versions). - // If we're wrong about a major version, users will still be able to 'go get' - // specific higher versions explicitly — they just won't affect 'latest' or - // appear in 'go list'. - // - // Conversely, we assume that if the latest release of any major version lacks - // a go.mod file, all versions also lack go.mod files. If we're wrong, we may - // include a +incompatible version that isn't really valid, but most - // operations won't try to use that version anyway. - // - // These optimizations bring - // 'go list -versions -m github.com/openshift/origin' down from 1m58s to 0m37s. - // That's still not great, but a substantial improvement. - versionHasGoMod := func(v string) (bool, error) { _, err := r.code.ReadFile(v, "go.mod", codehost.MaxGoMod) if err == nil { @@ -241,32 +225,41 @@ func (r *codeRepo) appendIncompatibleVersions(list, incompatible []string) ([]st } } - var lastMajor string + var ( + lastMajor string + lastMajorHasGoMod bool + ) for i, v := range incompatible { major := semver.Major(v) - if major == lastMajor { - list = append(list, v+"+incompatible") - continue - } - rem := incompatible[i:] - j := sort.Search(len(rem), func(j int) bool { - return semver.Major(rem[j]) != major - }) - latestAtMajor := rem[j-1] - - ok, err := versionHasGoMod(latestAtMajor) - if err != nil { - return nil, err - } - if ok { - // This major version has a go.mod file, so it is not allowed as - // +incompatible. Subsequent major versions are likely to also have - // go.mod files, so stop here. - break + if major != lastMajor { + rem := incompatible[i:] + j := sort.Search(len(rem), func(j int) bool { + return semver.Major(rem[j]) != major + }) + latestAtMajor := rem[j-1] + + var err error + lastMajor = major + lastMajorHasGoMod, err = versionHasGoMod(latestAtMajor) + if err != nil { + return nil, err + } } - lastMajor = major + if lastMajorHasGoMod { + // The latest release of this major version has a go.mod file, so it is + // not allowed as +incompatible. It would be confusing to include some + // minor versions of this major version as +incompatible but require + // semantic import versioning for others, so drop all +incompatible + // versions for this major version. + // + // If we're wrong about a minor version in the middle, users will still be + // able to 'go get' specific tags for that version explicitly — they just + // won't appear in 'go list' or as the results for queries with inequality + // bounds. + continue + } list = append(list, v+"+incompatible") } @@ -708,7 +701,7 @@ func (r *codeRepo) findDir(version string) (rev, dir string, gomod []byte, err e return "", "", nil, fmt.Errorf("reading %s/%s at revision %s: %v", r.pathPrefix, file1, rev, err1) } mpath1 := modfile.ModulePath(gomod1) - found1 := err1 == nil && isMajor(mpath1, r.pathMajor) + found1 := err1 == nil && (isMajor(mpath1, r.pathMajor) || r.canReplaceMismatchedVersionDueToBug(mpath1)) var file2 string if r.pathMajor != "" && r.codeRoot != r.modPath && !strings.HasPrefix(r.pathMajor, ".") { @@ -817,6 +810,17 @@ func isMajor(mpath, pathMajor string) bool { return pathMajor[1:] == mpathMajor[1:] } +// canReplaceMismatchedVersionDueToBug reports whether versions of r +// could replace versions of mpath with otherwise-mismatched major versions +// due to a historical bug in the Go command (golang.org/issue/34254). +func (r *codeRepo) canReplaceMismatchedVersionDueToBug(mpath string) bool { + // The bug caused us to erroneously accept unversioned paths as replacements + // for versioned gopkg.in paths. + unversioned := r.pathMajor == "" + replacingGopkgIn := strings.HasPrefix(mpath, "gopkg.in/") + return unversioned && replacingGopkgIn +} + func (r *codeRepo) GoMod(version string) (data []byte, err error) { if version != module.CanonicalVersion(version) { return nil, fmt.Errorf("version %s is not canonical", version) diff --git a/libgo/go/cmd/go/internal/modload/build.go b/libgo/go/cmd/go/internal/modload/build.go index 292fd45..d0642bc 100644 --- a/libgo/go/cmd/go/internal/modload/build.go +++ b/libgo/go/cmd/go/internal/modload/build.go @@ -112,7 +112,7 @@ func moduleInfo(m module.Version, fromBuildList bool) *modinfo.ModulePublic { } if HasModRoot() { info.Dir = ModRoot() - info.GoMod = filepath.Join(info.Dir, "go.mod") + info.GoMod = ModFilePath() if modFile.Go != nil { info.GoVersion = modFile.Go.Version } diff --git a/libgo/go/cmd/go/internal/modload/help.go b/libgo/go/cmd/go/internal/modload/help.go index b47f3de..66c1f70 100644 --- a/libgo/go/cmd/go/internal/modload/help.go +++ b/libgo/go/cmd/go/internal/modload/help.go @@ -21,14 +21,15 @@ which source files are used in a given build. Module support -Go 1.13 includes support for Go modules. Module-aware mode is active by default -whenever a go.mod file is found in, or in a parent of, the current directory. +The go command includes support for Go modules. Module-aware mode is active +by default whenever a go.mod file is found in the current directory or in +any parent directory. The quickest way to take advantage of module support is to check out your repository, create a go.mod file (described in the next section) there, and run go commands from within that file tree. -For more fine-grained control, Go 1.13 continues to respect +For more fine-grained control, the go command continues to respect a temporary environment variable, GO111MODULE, which can be set to one of three string values: off, on, or auto (the default). If GO111MODULE=on, then the go command requires the use of modules, diff --git a/libgo/go/cmd/go/internal/modload/import.go b/libgo/go/cmd/go/internal/modload/import.go index 9ae2900..5906d64 100644 --- a/libgo/go/cmd/go/internal/modload/import.go +++ b/libgo/go/cmd/go/internal/modload/import.go @@ -203,7 +203,12 @@ func Import(path string) (m module.Version, dir string, err error) { latest := map[string]string{} // path -> version for _, r := range modFile.Replace { if maybeInModule(path, r.Old.Path) { - latest[r.Old.Path] = semver.Max(r.Old.Version, latest[r.Old.Path]) + // Don't use semver.Max here; need to preserve +incompatible suffix. + v := latest[r.Old.Path] + if semver.Compare(r.Old.Version, v) > 0 { + v = r.Old.Version + } + latest[r.Old.Path] = v } } @@ -264,6 +269,8 @@ func Import(path string) (m module.Version, dir string, err error) { return module.Version{}, "", &ImportMissingError{Path: path} } + fmt.Fprintf(os.Stderr, "go: finding module for package %s\n", path) + candidates, err := QueryPackage(path, "latest", Allowed) if err != nil { if errors.Is(err, os.ErrNotExist) { diff --git a/libgo/go/cmd/go/internal/modload/load.go b/libgo/go/cmd/go/internal/modload/load.go index 408c790..7a8391d 100644 --- a/libgo/go/cmd/go/internal/modload/load.go +++ b/libgo/go/cmd/go/internal/modload/load.go @@ -1324,6 +1324,21 @@ func fetch(mod module.Version) (dir string, isLocal bool, err error) { if !filepath.IsAbs(dir) { dir = filepath.Join(ModRoot(), dir) } + // Ensure that the replacement directory actually exists: + // dirInModule does not report errors for missing modules, + // so if we don't report the error now, later failures will be + // very mysterious. + if _, err := os.Stat(dir); err != nil { + if os.IsNotExist(err) { + // Semantically the module version itself “exists” — we just don't + // have its source code. Remove the equivalence to os.ErrNotExist, + // and make the message more concise while we're at it. + err = fmt.Errorf("replacement directory %s does not exist", r.Path) + } else { + err = fmt.Errorf("replacement directory %s: %w", r.Path, err) + } + return dir, true, module.VersionError(mod, err) + } return dir, true, nil } mod = r diff --git a/libgo/go/cmd/go/internal/modload/query.go b/libgo/go/cmd/go/internal/modload/query.go index 53278b9..031e459 100644 --- a/libgo/go/cmd/go/internal/modload/query.go +++ b/libgo/go/cmd/go/internal/modload/query.go @@ -79,7 +79,7 @@ func queryProxy(proxy, path, query, current string, allowed func(module.Version) if current != "" && !semver.IsValid(current) { return nil, fmt.Errorf("invalid previous version %q", current) } - if cfg.BuildMod != "" && cfg.BuildMod != "mod" { + if cfg.BuildMod == "vendor" { return nil, errQueryDisabled } if allowed == nil { diff --git a/libgo/go/cmd/go/internal/modload/query_test.go b/libgo/go/cmd/go/internal/modload/query_test.go index 9c91c05..15470e2 100644 --- a/libgo/go/cmd/go/internal/modload/query_test.go +++ b/libgo/go/cmd/go/internal/modload/query_test.go @@ -64,7 +64,7 @@ var queryTests = []struct { git add go.mod git commit -m v1 go.mod git tag start - for i in v0.0.0-pre1 v0.0.0 v0.0.1 v0.0.2 v0.0.3 v0.1.0 v0.1.1 v0.1.2 v0.3.0 v1.0.0 v1.1.0 v1.9.0 v1.9.9 v1.9.10-pre1 v1.9.10-pre2+metadata; do + for i in v0.0.0-pre1 v0.0.0 v0.0.1 v0.0.2 v0.0.3 v0.1.0 v0.1.1 v0.1.2 v0.3.0 v1.0.0 v1.1.0 v1.9.0 v1.9.9 v1.9.10-pre1 v1.9.10-pre2+metadata unversioned; do echo before $i >status git add status git commit -m "before $i" status @@ -107,6 +107,7 @@ var queryTests = []struct { {path: queryRepo, query: "v0.2", err: `no matching versions for query "v0.2"`}, {path: queryRepo, query: "v0.0", vers: "v0.0.3"}, {path: queryRepo, query: "v1.9.10-pre2+metadata", vers: "v1.9.10-pre2.0.20190513201126-42abcb6df8ee"}, + {path: queryRepo, query: "ed5ffdaa", vers: "v1.9.10-pre2.0.20191220134614-ed5ffdaa1f5e"}, // golang.org/issue/29262: The major version for for a module without a suffix // should be based on the most recent tag (v1 as appropriate, not v0 @@ -162,10 +163,14 @@ var queryTests = []struct { {path: queryRepoV2, query: "v2.6.0-pre1", vers: "v2.6.0-pre1"}, {path: queryRepoV2, query: "latest", vers: "v2.5.5"}, - // e0cf3de987e6 is the latest commit on the master branch, and it's actually - // v1.19.10-pre1, not anything resembling v3: attempting to query it as such - // should fail. + // Commit e0cf3de987e6 is actually v1.19.10-pre1, not anything resembling v3, + // and it has a go.mod file with a non-v3 module path. Attempting to query it + // as the v3 module should fail. {path: queryRepoV3, query: "e0cf3de987e6", err: `vcs-test.golang.org/git/querytest.git/v3@v3.0.0-20180704024501-e0cf3de987e6: invalid version: go.mod has non-.../v3 module path "vcs-test.golang.org/git/querytest.git" (and .../v3/go.mod does not exist) at revision e0cf3de987e6`}, + + // The querytest repo does not have any commits tagged with major version 3, + // and the latest commit in the repo has a go.mod file specifying a non-v3 path. + // That should prevent us from resolving any version for the /v3 path. {path: queryRepoV3, query: "latest", err: `no matching versions for query "latest"`}, {path: emptyRepo, query: "latest", vers: "v0.0.0-20180704023549-7bb914627242"}, diff --git a/libgo/go/cmd/go/internal/work/gc.go b/libgo/go/cmd/go/internal/work/gc.go index 5702469..7d17c0c 100644 --- a/libgo/go/cmd/go/internal/work/gc.go +++ b/libgo/go/cmd/go/internal/work/gc.go @@ -227,8 +227,8 @@ func (a *Action) trimpath() string { // For "go build -trimpath", rewrite package source directory // to a file system-independent path (just the import path). if cfg.BuildTrimpath { - if m := a.Package.Module; m != nil { - rewrite += ";" + m.Dir + "=>" + m.Path + "@" + m.Version + if m := a.Package.Module; m != nil && m.Version != "" { + rewrite += ";" + a.Package.Dir + "=>" + m.Path + "@" + m.Version + strings.TrimPrefix(a.Package.ImportPath, m.Path) } else { rewrite += ";" + a.Package.Dir + "=>" + a.Package.ImportPath } diff --git a/libgo/go/cmd/go/testdata/badmod/go.mod b/libgo/go/cmd/go/testdata/badmod/go.mod deleted file mode 100644 index f7f6423..0000000 --- a/libgo/go/cmd/go/testdata/badmod/go.mod +++ /dev/null @@ -1 +0,0 @@ -module m diff --git a/libgo/go/cmd/go/testdata/badmod/x.go b/libgo/go/cmd/go/testdata/badmod/x.go deleted file mode 100644 index 579fb08..0000000 --- a/libgo/go/cmd/go/testdata/badmod/x.go +++ /dev/null @@ -1,4 +0,0 @@ -package x - -import _ "appengine" -import _ "nonexistent.rsc.io" // domain does not exist diff --git a/libgo/go/cmd/go/testdata/flag_test.go b/libgo/go/cmd/go/testdata/flag_test.go deleted file mode 100644 index ddf613d..0000000 --- a/libgo/go/cmd/go/testdata/flag_test.go +++ /dev/null @@ -1,16 +0,0 @@ -package flag_test - -import ( - "flag" - "log" - "testing" -) - -var v = flag.Int("v", 0, "v flag") - -// Run this as go test pkg -v=7 -func TestVFlagIsSet(t *testing.T) { - if *v != 7 { - log.Fatal("v flag not set") - } -} diff --git a/libgo/go/cmd/go/testdata/importcom/bad.go b/libgo/go/cmd/go/testdata/importcom/bad.go deleted file mode 100644 index e104c2e..0000000 --- a/libgo/go/cmd/go/testdata/importcom/bad.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import "bad" diff --git a/libgo/go/cmd/go/testdata/importcom/conflict.go b/libgo/go/cmd/go/testdata/importcom/conflict.go deleted file mode 100644 index 995556c..0000000 --- a/libgo/go/cmd/go/testdata/importcom/conflict.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import "conflict" diff --git a/libgo/go/cmd/go/testdata/importcom/src/bad/bad.go b/libgo/go/cmd/go/testdata/importcom/src/bad/bad.go deleted file mode 100644 index bc51fd3..0000000 --- a/libgo/go/cmd/go/testdata/importcom/src/bad/bad.go +++ /dev/null @@ -1 +0,0 @@ -package bad // import diff --git a/libgo/go/cmd/go/testdata/importcom/src/conflict/a.go b/libgo/go/cmd/go/testdata/importcom/src/conflict/a.go deleted file mode 100644 index 2d67703..0000000 --- a/libgo/go/cmd/go/testdata/importcom/src/conflict/a.go +++ /dev/null @@ -1 +0,0 @@ -package conflict // import "a" diff --git a/libgo/go/cmd/go/testdata/importcom/src/conflict/b.go b/libgo/go/cmd/go/testdata/importcom/src/conflict/b.go deleted file mode 100644 index 8fcfb3c..0000000 --- a/libgo/go/cmd/go/testdata/importcom/src/conflict/b.go +++ /dev/null @@ -1 +0,0 @@ -package conflict /* import "b" */ diff --git a/libgo/go/cmd/go/testdata/importcom/src/works/x/x.go b/libgo/go/cmd/go/testdata/importcom/src/works/x/x.go deleted file mode 100644 index 044c6ec..0000000 --- a/libgo/go/cmd/go/testdata/importcom/src/works/x/x.go +++ /dev/null @@ -1 +0,0 @@ -package x // import "works/x" diff --git a/libgo/go/cmd/go/testdata/importcom/src/works/x/x1.go b/libgo/go/cmd/go/testdata/importcom/src/works/x/x1.go deleted file mode 100644 index 2449b29..0000000 --- a/libgo/go/cmd/go/testdata/importcom/src/works/x/x1.go +++ /dev/null @@ -1 +0,0 @@ -package x // important! not an import comment diff --git a/libgo/go/cmd/go/testdata/importcom/src/wrongplace/x.go b/libgo/go/cmd/go/testdata/importcom/src/wrongplace/x.go deleted file mode 100644 index b89849d..0000000 --- a/libgo/go/cmd/go/testdata/importcom/src/wrongplace/x.go +++ /dev/null @@ -1 +0,0 @@ -package x // import "my/x" diff --git a/libgo/go/cmd/go/testdata/importcom/works.go b/libgo/go/cmd/go/testdata/importcom/works.go deleted file mode 100644 index 31b55d0..0000000 --- a/libgo/go/cmd/go/testdata/importcom/works.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import _ "works/x" diff --git a/libgo/go/cmd/go/testdata/importcom/wrongplace.go b/libgo/go/cmd/go/testdata/importcom/wrongplace.go deleted file mode 100644 index e2535e0..0000000 --- a/libgo/go/cmd/go/testdata/importcom/wrongplace.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import "wrongplace" diff --git a/libgo/go/cmd/go/testdata/importcycle/src/selfimport/selfimport.go b/libgo/go/cmd/go/testdata/importcycle/src/selfimport/selfimport.go deleted file mode 100644 index dc63c4b..0000000 --- a/libgo/go/cmd/go/testdata/importcycle/src/selfimport/selfimport.go +++ /dev/null @@ -1,3 +0,0 @@ -package selfimport - -import "selfimport" diff --git a/libgo/go/cmd/go/testdata/script/README b/libgo/go/cmd/go/testdata/script/README index 2782a09..7dba6b3 100644 --- a/libgo/go/cmd/go/testdata/script/README +++ b/libgo/go/cmd/go/testdata/script/README @@ -40,7 +40,7 @@ Scripts also have access to these other environment variables: goversion=<current Go version; for example, 1.12> :=<OS-specific path list separator> -The scripts supporting files are unpacked relative to $GOPATH/src (aka $WORK/gopath/src) +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. diff --git a/libgo/go/cmd/go/testdata/script/clean_testcache.txt b/libgo/go/cmd/go/testdata/script/clean_testcache.txt index dd78464..b3f32fe 100644 --- a/libgo/go/cmd/go/testdata/script/clean_testcache.txt +++ b/libgo/go/cmd/go/testdata/script/clean_testcache.txt @@ -9,6 +9,13 @@ go clean -testcache go test x_test.go ! stdout 'cached' +# golang.org/issue/29100: 'go clean -testcache' should succeed +# if the cache directory doesn't exist at all. +# It should not write a testexpire.txt file, since there are no +# test results that need to be invalidated in the first place. +env GOCACHE=$WORK/nonexistent +go clean -testcache +! exists $WORK/nonexistent -- x/x_test.go -- package x_test @@ -16,4 +23,4 @@ import ( "testing" ) func TestMain(t *testing.T) { -}
\ No newline at end of file +} diff --git a/libgo/go/cmd/go/testdata/script/link_syso_issue33139.txt b/libgo/go/cmd/go/testdata/script/link_syso_issue33139.txt index c2ca27a..03169bf 100644 --- a/libgo/go/cmd/go/testdata/script/link_syso_issue33139.txt +++ b/libgo/go/cmd/go/testdata/script/link_syso_issue33139.txt @@ -8,6 +8,10 @@ # See: https://github.com/golang/go/issues/8912 [linux] [ppc64] skip +# External linking is not supported on linux/riscv64. +# See: https://github.com/golang/go/issues/36739 +[linux] [riscv64] skip + # External linking is not supported on darwin/386 (10.14+). # See: https://github.com/golang/go/issues/31751 [darwin] [386] skip diff --git a/libgo/go/cmd/go/testdata/script/mod_get_test.txt b/libgo/go/cmd/go/testdata/script/mod_get_test.txt index f921168..3680ca2 100644 --- a/libgo/go/cmd/go/testdata/script/mod_get_test.txt +++ b/libgo/go/cmd/go/testdata/script/mod_get_test.txt @@ -33,7 +33,7 @@ grep 'rsc.io/quote v1.5.1$' go.mod # 'go get all' should consider test dependencies with or without -t. cp go.mod.empty go.mod -go get all +go get -d all grep 'rsc.io/quote v1.5.2$' go.mod -- go.mod.empty -- diff --git a/libgo/go/cmd/go/testdata/script/mod_load_badchain.txt b/libgo/go/cmd/go/testdata/script/mod_load_badchain.txt index 2c532f1..67d9a15 100644 --- a/libgo/go/cmd/go/testdata/script/mod_load_badchain.txt +++ b/libgo/go/cmd/go/testdata/script/mod_load_badchain.txt @@ -75,12 +75,14 @@ go: example.com/badchain/a@v1.1.0 requires module declares its path as: badchain.example.com/c but was required as: example.com/badchain/c -- list-missing-expected -- +go: finding module for package example.com/badchain/c go: found example.com/badchain/c in example.com/badchain/c v1.1.0 go: m/use imports example.com/badchain/c: example.com/badchain/c@v1.1.0: parsing go.mod: module declares its path as: badchain.example.com/c but was required as: example.com/badchain/c -- list-missing-test-expected -- +go: finding module for package example.com/badchain/c go: found example.com/badchain/c in example.com/badchain/c v1.1.0 go: m/testuse tested by m/testuse.test imports diff --git a/libgo/go/cmd/go/testdata/script/mod_readonly.txt b/libgo/go/cmd/go/testdata/script/mod_readonly.txt index 1d1771e..77fc735 100644 --- a/libgo/go/cmd/go/testdata/script/mod_readonly.txt +++ b/libgo/go/cmd/go/testdata/script/mod_readonly.txt @@ -34,6 +34,11 @@ go list all go clean -modcache go list all +# -mod=readonly must not cause 'go list -m' to fail. +# (golang.org/issue/36478) +go list -m all +! stderr 'cannot query module' + # -mod=readonly should reject inconsistent go.mod files # (ones that would be rewritten). go mod edit -require rsc.io/sampler@v1.2.0 diff --git a/libgo/go/cmd/go/testdata/script/mod_replace_gopkgin.txt b/libgo/go/cmd/go/testdata/script/mod_replace_gopkgin.txt index 6608fb1..28c1196 100644 --- a/libgo/go/cmd/go/testdata/script/mod_replace_gopkgin.txt +++ b/libgo/go/cmd/go/testdata/script/mod_replace_gopkgin.txt @@ -15,10 +15,28 @@ env GOSUMDB=off # Replacing gopkg.in/[…].vN with a repository with a root go.mod file # specifying […].vN and a compatible version should succeed, even if # the replacement path is not a gopkg.in path. -cd dot-to-dot -go list gopkg.in/src-d/go-git.v4 +cd 4-to-4 +go list -m gopkg.in/src-d/go-git.v4 --- dot-to-dot/go.mod -- +# Previous versions of the "go" command accepted v0 and v1 pseudo-versions +# as replacements for gopkg.in/[…].v4. +# As a special case, we continue to accept those. + +cd ../4-to-0 +go list -m gopkg.in/src-d/go-git.v4 + +cd ../4-to-1 +go list -m gopkg.in/src-d/go-git.v4 + +cd ../4-to-incompatible +go list -m gopkg.in/src-d/go-git.v4 + +# A mismatched gopkg.in path should not be able to replace a different major version. +cd ../3-to-gomod-4 +! go list -m gopkg.in/src-d/go-git.v3 +stderr '^go: gopkg\.in/src-d/go-git\.v3@v3.0.0-20190801152248-0d1a009cbb60: invalid version: go\.mod has non-\.\.\.\.v3 module path "gopkg\.in/src-d/go-git\.v4" at revision 0d1a009cbb60$' + +-- 4-to-4/go.mod -- module golang.org/issue/34254 go 1.13 @@ -26,3 +44,36 @@ go 1.13 require gopkg.in/src-d/go-git.v4 v4.13.1 replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git/v4 v4.13.1 +-- 4-to-1/go.mod -- +module golang.org/issue/34254 + +go 1.13 + +require gopkg.in/src-d/go-git.v4 v4.13.1 + +replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git v1.0.1-0.20190801152248-0d1a009cbb60 +-- 4-to-0/go.mod -- +module golang.org/issue/34254 + +go 1.13 + +require gopkg.in/src-d/go-git.v4 v4.13.1 + +replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git v0.0.0-20190801152248-0d1a009cbb60 +-- 4-to-incompatible/go.mod -- +module golang.org/issue/34254 + +go 1.13 + +require gopkg.in/src-d/go-git.v4 v4.13.1 + +replace gopkg.in/src-d/go-git.v4 v4.13.1 => github.com/src-d/go-git v4.6.0+incompatible +-- 3-to-gomod-4/go.mod -- +module golang.org/issue/34254 +go 1.13 + +require gopkg.in/src-d/go-git.v3 v3.2.0 + +// This replacement has a go.mod file declaring its path to be +// gopkg.in/src-d/go-git.v4, so it cannot be used as a replacement for v3. +replace gopkg.in/src-d/go-git.v3 v3.2.0 => gopkg.in/src-d/go-git.v3 v3.0.0-20190801152248-0d1a009cbb60 diff --git a/libgo/go/cmd/go/testdata/script/mod_replace_import.txt b/libgo/go/cmd/go/testdata/script/mod_replace_import.txt index 941ef61..fd5b04a 100644 --- a/libgo/go/cmd/go/testdata/script/mod_replace_import.txt +++ b/libgo/go/cmd/go/testdata/script/mod_replace_import.txt @@ -28,7 +28,8 @@ stdout 'example.com/v v1.12.0 => ./v12' cd fail ! go list all stdout 'localhost.fail' -stderr '^can.t load package: m.go:3:8: module w@latest found \(v0.0.0-00010101000000-000000000000, replaced by ../w\), but does not contain package w$' +stderr '^can''t load package: m.go:4:2: module w@latest found \(v0.0.0-00010101000000-000000000000, replaced by ../w\), but does not contain package w$' +stderr '^can''t load package: m.go:5:2: nonexist@v0.1.0: replacement directory ../nonexist does not exist$' -- go.mod -- module example.com/m @@ -54,6 +55,10 @@ replace ( example.com/v => ./v ) +replace ( + example.com/i v2.0.0+incompatible => ./i2 +) + -- m.go -- package main import ( @@ -61,6 +66,7 @@ import ( _ "example.com/x/v3" _ "example.com/y/z/w" _ "example.com/v" + _ "example.com/i" ) func main() {} @@ -115,10 +121,18 @@ module v.localhost -- v/v.go -- package v +-- i2/go.mod -- +module example.com/i +-- i2/i.go -- +package i + -- fail/m.go -- package main -import _ "w" +import ( + _ "w" + _ "nonexist" +) func main() {} @@ -127,3 +141,4 @@ module localhost.fail replace w => ../w +replace nonexist v0.1.0 => ../nonexist diff --git a/libgo/go/cmd/go/testdata/script/mod_run_internal.txt b/libgo/go/cmd/go/testdata/script/mod_run_internal.txt deleted file mode 100644 index 653ad28..0000000 --- a/libgo/go/cmd/go/testdata/script/mod_run_internal.txt +++ /dev/null @@ -1,46 +0,0 @@ -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() {} diff --git a/libgo/go/cmd/go/testdata/script/mod_vendor.txt b/libgo/go/cmd/go/testdata/script/mod_vendor.txt index bb3e634..2622916 100644 --- a/libgo/go/cmd/go/testdata/script/mod_vendor.txt +++ b/libgo/go/cmd/go/testdata/script/mod_vendor.txt @@ -38,6 +38,12 @@ stdout 'src[\\/]vendor[\\/]x' go list -mod=vendor -f '{{.Version}} {{.Dir}}' -m x stdout '^v1.0.0 $' +# -mod=vendor should cause 'go list' flags that look up versions to fail. +! go list -mod=vendor -versions -m x +stderr '^go list -m: can''t determine available versions using the vendor directory\n\t\(Use -mod=mod or -mod=readonly to bypass.\)$' +! go list -mod=vendor -u -m x +stderr '^go list -m: can''t determine available upgrades using the vendor directory\n\t\(Use -mod=mod or -mod=readonly to bypass.\)$' + # 'go list -mod=vendor -m' on a transitive dependency that does not # provide vendored packages should give a helpful error rather than # 'not a known dependency'. diff --git a/libgo/go/cmd/go/testdata/script/modfile_flag.txt b/libgo/go/cmd/go/testdata/script/modfile_flag.txt index 1409be9..f05bf03 100644 --- a/libgo/go/cmd/go/testdata/script/modfile_flag.txt +++ b/libgo/go/cmd/go/testdata/script/modfile_flag.txt @@ -11,6 +11,15 @@ cp go.sum go.sum.orig go mod init example.com/m grep example.com/m go.alt.mod +# 'go env GOMOD' should print the path to the real file. +# 'go env' does not recognize the '-modfile' flag. +go env GOMOD +stdout '^\$WORK[/\\]gopath[/\\]src[/\\]go.mod$' + +# 'go list -m' should print the effective go.mod file as GoMod though. +go list -m -f '{{.GoMod}}' +stdout '^go.alt.mod$' + # go mod edit should operate on the alternate file go mod edit -require rsc.io/quote@v1.5.2 grep rsc.io/quote go.alt.mod diff --git a/libgo/go/cmd/go/testdata/script/test_badtest.txt b/libgo/go/cmd/go/testdata/script/test_badtest.txt index f5db694..75b3b68 100644 --- a/libgo/go/cmd/go/testdata/script/test_badtest.txt +++ b/libgo/go/cmd/go/testdata/script/test_badtest.txt @@ -1,11 +1,21 @@ env GO111MODULE=off -! go test badtest/... +! go test badtest/badexec ! stdout ^ok stdout ^FAIL\tbadtest/badexec + +! go test badtest/badsyntax +! stdout ^ok stdout ^FAIL\tbadtest/badsyntax + +! go test badtest/badvar +! stdout ^ok stdout ^FAIL\tbadtest/badvar +! go test notest +! stdout ^ok +stderr '^notest.hello.go:6:1: .*declaration' # Exercise issue #7108 + -- badtest/badexec/x_test.go -- package badexec @@ -30,3 +40,10 @@ package badvar_test func f() { _ = notdefined } +-- notest/hello.go -- +package notest + +func hello() { + println("hello world") +} +Hello world diff --git a/libgo/go/cmd/go/testdata/src/badc/x.c b/libgo/go/cmd/go/testdata/src/badc/x.c deleted file mode 100644 index f6cbf69..0000000 --- a/libgo/go/cmd/go/testdata/src/badc/x.c +++ /dev/null @@ -1 +0,0 @@ -// C code! diff --git a/libgo/go/cmd/go/testdata/src/badc/x.go b/libgo/go/cmd/go/testdata/src/badc/x.go deleted file mode 100644 index bfa1de2..0000000 --- a/libgo/go/cmd/go/testdata/src/badc/x.go +++ /dev/null @@ -1 +0,0 @@ -package badc diff --git a/libgo/go/cmd/go/testdata/src/badpkg/x.go b/libgo/go/cmd/go/testdata/src/badpkg/x.go deleted file mode 100644 index dda35e8..0000000 --- a/libgo/go/cmd/go/testdata/src/badpkg/x.go +++ /dev/null @@ -1 +0,0 @@ -pkg badpkg diff --git a/libgo/go/cmd/go/testdata/src/bench/x_test.go b/libgo/go/cmd/go/testdata/src/bench/x_test.go deleted file mode 100644 index 32cabf8..0000000 --- a/libgo/go/cmd/go/testdata/src/bench/x_test.go +++ /dev/null @@ -1,6 +0,0 @@ -package bench - -import "testing" - -func Benchmark(b *testing.B) { -} diff --git a/libgo/go/cmd/go/testdata/src/benchfatal/x_test.go b/libgo/go/cmd/go/testdata/src/benchfatal/x_test.go deleted file mode 100644 index 8d3a5de..0000000 --- a/libgo/go/cmd/go/testdata/src/benchfatal/x_test.go +++ /dev/null @@ -1,7 +0,0 @@ -package benchfatal - -import "testing" - -func BenchmarkThatCallsFatal(b *testing.B) { - b.Fatal("called by benchmark") -} diff --git a/libgo/go/cmd/go/testdata/src/cgoasm/p.go b/libgo/go/cmd/go/testdata/src/cgoasm/p.go deleted file mode 100644 index 148b47f..0000000 --- a/libgo/go/cmd/go/testdata/src/cgoasm/p.go +++ /dev/null @@ -1,8 +0,0 @@ -package p - -/* -// hi -*/ -import "C" - -func F() {} diff --git a/libgo/go/cmd/go/testdata/src/cgoasm/p.s b/libgo/go/cmd/go/testdata/src/cgoasm/p.s deleted file mode 100644 index aaade03..0000000 --- a/libgo/go/cmd/go/testdata/src/cgoasm/p.s +++ /dev/null @@ -1,2 +0,0 @@ -TEXT asm(SB),$0 - RET diff --git a/libgo/go/cmd/go/testdata/src/cgocover/p.go b/libgo/go/cmd/go/testdata/src/cgocover/p.go deleted file mode 100644 index a6a3891..0000000 --- a/libgo/go/cmd/go/testdata/src/cgocover/p.go +++ /dev/null @@ -1,19 +0,0 @@ -package p - -/* -void -f(void) -{ -} -*/ -import "C" - -var b bool - -func F() { - if b { - for { - } - } - C.f() -} diff --git a/libgo/go/cmd/go/testdata/src/cgocover/p_test.go b/libgo/go/cmd/go/testdata/src/cgocover/p_test.go deleted file mode 100644 index a8f057e..0000000 --- a/libgo/go/cmd/go/testdata/src/cgocover/p_test.go +++ /dev/null @@ -1,7 +0,0 @@ -package p - -import "testing" - -func TestF(t *testing.T) { - F() -} diff --git a/libgo/go/cmd/go/testdata/src/cgocover2/p.go b/libgo/go/cmd/go/testdata/src/cgocover2/p.go deleted file mode 100644 index a6a3891..0000000 --- a/libgo/go/cmd/go/testdata/src/cgocover2/p.go +++ /dev/null @@ -1,19 +0,0 @@ -package p - -/* -void -f(void) -{ -} -*/ -import "C" - -var b bool - -func F() { - if b { - for { - } - } - C.f() -} diff --git a/libgo/go/cmd/go/testdata/src/cgocover2/x_test.go b/libgo/go/cmd/go/testdata/src/cgocover2/x_test.go deleted file mode 100644 index f4790d2..0000000 --- a/libgo/go/cmd/go/testdata/src/cgocover2/x_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package p_test - -import ( - . "cgocover2" - "testing" -) - -func TestF(t *testing.T) { - F() -} diff --git a/libgo/go/cmd/go/testdata/src/cgocover3/p.go b/libgo/go/cmd/go/testdata/src/cgocover3/p.go deleted file mode 100644 index a6a3891..0000000 --- a/libgo/go/cmd/go/testdata/src/cgocover3/p.go +++ /dev/null @@ -1,19 +0,0 @@ -package p - -/* -void -f(void) -{ -} -*/ -import "C" - -var b bool - -func F() { - if b { - for { - } - } - C.f() -} diff --git a/libgo/go/cmd/go/testdata/src/cgocover3/p_test.go b/libgo/go/cmd/go/testdata/src/cgocover3/p_test.go deleted file mode 100644 index c89cd18..0000000 --- a/libgo/go/cmd/go/testdata/src/cgocover3/p_test.go +++ /dev/null @@ -1 +0,0 @@ -package p diff --git a/libgo/go/cmd/go/testdata/src/cgocover3/x_test.go b/libgo/go/cmd/go/testdata/src/cgocover3/x_test.go deleted file mode 100644 index 97d0e0f..0000000 --- a/libgo/go/cmd/go/testdata/src/cgocover3/x_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package p_test - -import ( - . "cgocover3" - "testing" -) - -func TestF(t *testing.T) { - F() -} diff --git a/libgo/go/cmd/go/testdata/src/cgocover4/notcgo.go b/libgo/go/cmd/go/testdata/src/cgocover4/notcgo.go deleted file mode 100644 index c89cd18..0000000 --- a/libgo/go/cmd/go/testdata/src/cgocover4/notcgo.go +++ /dev/null @@ -1 +0,0 @@ -package p diff --git a/libgo/go/cmd/go/testdata/src/cgocover4/p.go b/libgo/go/cmd/go/testdata/src/cgocover4/p.go deleted file mode 100644 index a6a3891..0000000 --- a/libgo/go/cmd/go/testdata/src/cgocover4/p.go +++ /dev/null @@ -1,19 +0,0 @@ -package p - -/* -void -f(void) -{ -} -*/ -import "C" - -var b bool - -func F() { - if b { - for { - } - } - C.f() -} diff --git a/libgo/go/cmd/go/testdata/src/cgocover4/x_test.go b/libgo/go/cmd/go/testdata/src/cgocover4/x_test.go deleted file mode 100644 index fd9bae7..0000000 --- a/libgo/go/cmd/go/testdata/src/cgocover4/x_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package p_test - -import ( - . "cgocover4" - "testing" -) - -func TestF(t *testing.T) { - F() -} diff --git a/libgo/go/cmd/go/testdata/src/dupload/dupload.go b/libgo/go/cmd/go/testdata/src/dupload/dupload.go deleted file mode 100644 index 2f07852..0000000 --- a/libgo/go/cmd/go/testdata/src/dupload/dupload.go +++ /dev/null @@ -1,8 +0,0 @@ -package main - -import ( - _ "dupload/p2" - _ "p" -) - -func main() {} diff --git a/libgo/go/cmd/go/testdata/src/dupload/p/p.go b/libgo/go/cmd/go/testdata/src/dupload/p/p.go deleted file mode 100644 index c89cd18..0000000 --- a/libgo/go/cmd/go/testdata/src/dupload/p/p.go +++ /dev/null @@ -1 +0,0 @@ -package p diff --git a/libgo/go/cmd/go/testdata/src/dupload/p2/p2.go b/libgo/go/cmd/go/testdata/src/dupload/p2/p2.go deleted file mode 100644 index 8a80979..0000000 --- a/libgo/go/cmd/go/testdata/src/dupload/p2/p2.go +++ /dev/null @@ -1,3 +0,0 @@ -package p2 - -import _ "dupload/vendor/p" diff --git a/libgo/go/cmd/go/testdata/src/dupload/vendor/p/p.go b/libgo/go/cmd/go/testdata/src/dupload/vendor/p/p.go deleted file mode 100644 index c89cd18..0000000 --- a/libgo/go/cmd/go/testdata/src/dupload/vendor/p/p.go +++ /dev/null @@ -1 +0,0 @@ -package p diff --git a/libgo/go/cmd/go/testdata/src/gencycle/gencycle.go b/libgo/go/cmd/go/testdata/src/gencycle/gencycle.go deleted file mode 100644 index 600afd9..0000000 --- a/libgo/go/cmd/go/testdata/src/gencycle/gencycle.go +++ /dev/null @@ -1,5 +0,0 @@ -//go:generate echo hello world - -package gencycle - -import _ "gencycle" diff --git a/libgo/go/cmd/go/testdata/src/importmain/ismain/main.go b/libgo/go/cmd/go/testdata/src/importmain/ismain/main.go deleted file mode 100644 index bf01907..0000000 --- a/libgo/go/cmd/go/testdata/src/importmain/ismain/main.go +++ /dev/null @@ -1,5 +0,0 @@ -package main - -import _ "importmain/test" - -func main() {} diff --git a/libgo/go/cmd/go/testdata/src/importmain/test/test.go b/libgo/go/cmd/go/testdata/src/importmain/test/test.go deleted file mode 100644 index 56e5404..0000000 --- a/libgo/go/cmd/go/testdata/src/importmain/test/test.go +++ /dev/null @@ -1 +0,0 @@ -package test diff --git a/libgo/go/cmd/go/testdata/src/importmain/test/test_test.go b/libgo/go/cmd/go/testdata/src/importmain/test/test_test.go deleted file mode 100644 index 2268a82..0000000 --- a/libgo/go/cmd/go/testdata/src/importmain/test/test_test.go +++ /dev/null @@ -1,6 +0,0 @@ -package test_test - -import "testing" -import _ "importmain/ismain" - -func TestCase(t *testing.T) {} diff --git a/libgo/go/cmd/go/testdata/src/multimain/multimain_test.go b/libgo/go/cmd/go/testdata/src/multimain/multimain_test.go deleted file mode 100644 index 007a86a..0000000 --- a/libgo/go/cmd/go/testdata/src/multimain/multimain_test.go +++ /dev/null @@ -1,16 +0,0 @@ -package multimain_test - -import "testing" - -func TestMain(m *testing.M) { - // Some users run m.Run multiple times, changing - // some kind of global state between runs. - // This used to work so I guess now it has to keep working. - // See golang.org/issue/23129. - m.Run() - m.Run() -} - -func Test(t *testing.T) { - t.Log("notwithstanding") -} diff --git a/libgo/go/cmd/go/testdata/src/not_main/not_main.go b/libgo/go/cmd/go/testdata/src/not_main/not_main.go deleted file mode 100644 index 75a397c..0000000 --- a/libgo/go/cmd/go/testdata/src/not_main/not_main.go +++ /dev/null @@ -1,3 +0,0 @@ -package not_main - -func F() {} diff --git a/libgo/go/cmd/go/testdata/src/notest/hello.go b/libgo/go/cmd/go/testdata/src/notest/hello.go deleted file mode 100644 index 7c42c32..0000000 --- a/libgo/go/cmd/go/testdata/src/notest/hello.go +++ /dev/null @@ -1,6 +0,0 @@ -package notest - -func hello() { - println("hello world") -} -Hello world diff --git a/libgo/go/cmd/go/testdata/src/run/bad.go b/libgo/go/cmd/go/testdata/src/run/bad.go deleted file mode 100644 index c1cc3ac..0000000 --- a/libgo/go/cmd/go/testdata/src/run/bad.go +++ /dev/null @@ -1,5 +0,0 @@ -package main - -import _ "run/subdir/internal/private" - -func main() {} diff --git a/libgo/go/cmd/go/testdata/src/run/good.go b/libgo/go/cmd/go/testdata/src/run/good.go deleted file mode 100644 index 0b67dce..0000000 --- a/libgo/go/cmd/go/testdata/src/run/good.go +++ /dev/null @@ -1,5 +0,0 @@ -package main - -import _ "run/internal" - -func main() {} diff --git a/libgo/go/cmd/go/testdata/src/run/internal/internal.go b/libgo/go/cmd/go/testdata/src/run/internal/internal.go deleted file mode 100644 index 5bf0569..0000000 --- a/libgo/go/cmd/go/testdata/src/run/internal/internal.go +++ /dev/null @@ -1 +0,0 @@ -package internal diff --git a/libgo/go/cmd/go/testdata/src/run/subdir/internal/private/private.go b/libgo/go/cmd/go/testdata/src/run/subdir/internal/private/private.go deleted file mode 100644 index 735e4dc..0000000 --- a/libgo/go/cmd/go/testdata/src/run/subdir/internal/private/private.go +++ /dev/null @@ -1 +0,0 @@ -package private diff --git a/libgo/go/cmd/go/testdata/src/sleepy1/p_test.go b/libgo/go/cmd/go/testdata/src/sleepy1/p_test.go deleted file mode 100644 index 333be7d..0000000 --- a/libgo/go/cmd/go/testdata/src/sleepy1/p_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package p - -import ( - "testing" - "time" -) - -func Test1(t *testing.T) { - time.Sleep(200 * time.Millisecond) -} diff --git a/libgo/go/cmd/go/testdata/src/sleepy2/p_test.go b/libgo/go/cmd/go/testdata/src/sleepy2/p_test.go deleted file mode 100644 index 333be7d..0000000 --- a/libgo/go/cmd/go/testdata/src/sleepy2/p_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package p - -import ( - "testing" - "time" -) - -func Test1(t *testing.T) { - time.Sleep(200 * time.Millisecond) -} diff --git a/libgo/go/cmd/go/testdata/src/sleepybad/p.go b/libgo/go/cmd/go/testdata/src/sleepybad/p.go deleted file mode 100644 index e05b403..0000000 --- a/libgo/go/cmd/go/testdata/src/sleepybad/p.go +++ /dev/null @@ -1,5 +0,0 @@ -package p - -// missing import - -var _ = io.DoesNotExist diff --git a/libgo/go/cmd/go/testdata/src/syntaxerror/x.go b/libgo/go/cmd/go/testdata/src/syntaxerror/x.go deleted file mode 100644 index c89cd18..0000000 --- a/libgo/go/cmd/go/testdata/src/syntaxerror/x.go +++ /dev/null @@ -1 +0,0 @@ -package p diff --git a/libgo/go/cmd/go/testdata/src/syntaxerror/x_test.go b/libgo/go/cmd/go/testdata/src/syntaxerror/x_test.go deleted file mode 100644 index 2460743..0000000 --- a/libgo/go/cmd/go/testdata/src/syntaxerror/x_test.go +++ /dev/null @@ -1,4 +0,0 @@ -package p - -func f() (x.y, z int) { -} diff --git a/libgo/go/cmd/go/testdata/src/testcycle/p1/p1.go b/libgo/go/cmd/go/testdata/src/testcycle/p1/p1.go deleted file mode 100644 index 65ab76d..0000000 --- a/libgo/go/cmd/go/testdata/src/testcycle/p1/p1.go +++ /dev/null @@ -1,7 +0,0 @@ -package p1 - -import _ "testcycle/p2" - -func init() { - println("p1 init") -} diff --git a/libgo/go/cmd/go/testdata/src/testcycle/p1/p1_test.go b/libgo/go/cmd/go/testdata/src/testcycle/p1/p1_test.go deleted file mode 100644 index 75abb13..0000000 --- a/libgo/go/cmd/go/testdata/src/testcycle/p1/p1_test.go +++ /dev/null @@ -1,6 +0,0 @@ -package p1 - -import "testing" - -func Test(t *testing.T) { -} diff --git a/libgo/go/cmd/go/testdata/src/testcycle/p2/p2.go b/libgo/go/cmd/go/testdata/src/testcycle/p2/p2.go deleted file mode 100644 index 7e26cdf..0000000 --- a/libgo/go/cmd/go/testdata/src/testcycle/p2/p2.go +++ /dev/null @@ -1,7 +0,0 @@ -package p2 - -import _ "testcycle/p3" - -func init() { - println("p2 init") -} diff --git a/libgo/go/cmd/go/testdata/src/testcycle/p3/p3.go b/libgo/go/cmd/go/testdata/src/testcycle/p3/p3.go deleted file mode 100644 index bb0a2f4..0000000 --- a/libgo/go/cmd/go/testdata/src/testcycle/p3/p3.go +++ /dev/null @@ -1,5 +0,0 @@ -package p3 - -func init() { - println("p3 init") -} diff --git a/libgo/go/cmd/go/testdata/src/testcycle/p3/p3_test.go b/libgo/go/cmd/go/testdata/src/testcycle/p3/p3_test.go deleted file mode 100644 index 9b4b075..0000000 --- a/libgo/go/cmd/go/testdata/src/testcycle/p3/p3_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package p3 - -import ( - "testing" - - _ "testcycle/p1" -) - -func Test(t *testing.T) { -} diff --git a/libgo/go/cmd/go/testdata/src/testcycle/q1/q1.go b/libgo/go/cmd/go/testdata/src/testcycle/q1/q1.go deleted file mode 100644 index 7a471f0..0000000 --- a/libgo/go/cmd/go/testdata/src/testcycle/q1/q1.go +++ /dev/null @@ -1 +0,0 @@ -package q1 diff --git a/libgo/go/cmd/go/testdata/src/testcycle/q1/q1_test.go b/libgo/go/cmd/go/testdata/src/testcycle/q1/q1_test.go deleted file mode 100644 index ca81bd2..0000000 --- a/libgo/go/cmd/go/testdata/src/testcycle/q1/q1_test.go +++ /dev/null @@ -1,6 +0,0 @@ -package q1 - -import "testing" -import _ "testcycle/q1" - -func Test(t *testing.T) {} diff --git a/libgo/go/cmd/go/testdata/src/testdep/p1/p1.go b/libgo/go/cmd/go/testdata/src/testdep/p1/p1.go deleted file mode 100644 index a457035..0000000 --- a/libgo/go/cmd/go/testdata/src/testdep/p1/p1.go +++ /dev/null @@ -1 +0,0 @@ -package p1 diff --git a/libgo/go/cmd/go/testdata/src/testdep/p1/p1_test.go b/libgo/go/cmd/go/testdata/src/testdep/p1/p1_test.go deleted file mode 100644 index 8be7533..0000000 --- a/libgo/go/cmd/go/testdata/src/testdep/p1/p1_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package p1 - -import _ "testdep/p2" diff --git a/libgo/go/cmd/go/testdata/src/testdep/p2/p2.go b/libgo/go/cmd/go/testdata/src/testdep/p2/p2.go deleted file mode 100644 index 15ba2ea..0000000 --- a/libgo/go/cmd/go/testdata/src/testdep/p2/p2.go +++ /dev/null @@ -1,3 +0,0 @@ -package p2 - -import _ "testdep/p3" diff --git a/libgo/go/cmd/go/testdata/src/testdep/p3/p3.go b/libgo/go/cmd/go/testdata/src/testdep/p3/p3.go deleted file mode 100644 index 0219e7f..0000000 --- a/libgo/go/cmd/go/testdata/src/testdep/p3/p3.go +++ /dev/null @@ -1,3 +0,0 @@ -// +build ignore - -package ignored diff --git a/libgo/go/cmd/go/testdata/src/testnorun/p.go b/libgo/go/cmd/go/testdata/src/testnorun/p.go deleted file mode 100644 index 71a9a56..0000000 --- a/libgo/go/cmd/go/testdata/src/testnorun/p.go +++ /dev/null @@ -1,5 +0,0 @@ -package p - -func init() { - panic("go test must not link and run test binaries without tests") -} diff --git a/libgo/go/cmd/go/testdata/src/testrace/race_test.go b/libgo/go/cmd/go/testdata/src/testrace/race_test.go deleted file mode 100644 index 7ec0c6d..0000000 --- a/libgo/go/cmd/go/testdata/src/testrace/race_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package testrace - -import "testing" - -func TestRace(t *testing.T) { - for i := 0; i < 10; i++ { - c := make(chan int) - x := 1 - go func() { - x = 2 - c <- 1 - }() - x = 3 - <-c - _ = x - } -} - -func BenchmarkRace(b *testing.B) { - for i := 0; i < b.N; i++ { - c := make(chan int) - x := 1 - go func() { - x = 2 - c <- 1 - }() - x = 3 - <-c - _ = x - } -} diff --git a/libgo/go/cmd/go/testdata/src/testregexp/x_test.go b/libgo/go/cmd/go/testdata/src/testregexp/x_test.go deleted file mode 100644 index 7573e79..0000000 --- a/libgo/go/cmd/go/testdata/src/testregexp/x_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package x - -import "testing" - -func TestX(t *testing.T) { - t.Logf("LOG: X running") - t.Run("Y", func(t *testing.T) { - t.Logf("LOG: Y running") - }) -} - -func BenchmarkX(b *testing.B) { - b.Logf("LOG: X running N=%d", b.N) - b.Run("Y", func(b *testing.B) { - b.Logf("LOG: Y running N=%d", b.N) - }) -} diff --git a/libgo/go/cmd/go/testdata/src/testregexp/z_test.go b/libgo/go/cmd/go/testdata/src/testregexp/z_test.go deleted file mode 100644 index 4fd1979..0000000 --- a/libgo/go/cmd/go/testdata/src/testregexp/z_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package x - -import "testing" - -func TestZ(t *testing.T) { - t.Logf("LOG: Z running") -} - -func TestXX(t *testing.T) { - t.Logf("LOG: XX running") -} - -func BenchmarkZ(b *testing.B) { - b.Logf("LOG: Z running N=%d", b.N) -} - -func BenchmarkXX(b *testing.B) { - b.Logf("LOG: XX running N=%d", b.N) -} |