tg.wantExecutable(tg.path("myerrors.test"+exeSuffix), "go test -o myerrors.test did not create myerrors.test")
}
-// Issue 4568.
-func TestSymlinksList(t *testing.T) {
- testenv.MustHaveSymlink(t)
-
- tg := testgo(t)
- defer tg.cleanup()
- // TODO: tg.parallel()
- tg.tempDir("src")
- tg.must(os.Symlink(tg.path("."), tg.path("src/dir1")))
- tg.tempFile("src/dir1/p.go", "package p")
- tg.setenv("GOPATH", tg.path("."))
- tg.cd(tg.path("src"))
- tg.run("list", "-f", "{{.Root}}", "dir1")
- if strings.TrimSpace(tg.getStdout()) != tg.path(".") {
- t.Error("confused by symlinks")
- }
-}
-
-// Issue 14054.
-func TestSymlinksVendor(t *testing.T) {
- testenv.MustHaveSymlink(t)
-
- tg := testgo(t)
- defer tg.cleanup()
- // TODO: tg.parallel()
- tg.tempDir("gopath/src/dir1/vendor/v")
- tg.tempFile("gopath/src/dir1/p.go", "package main\nimport _ `v`\nfunc main(){}")
- tg.tempFile("gopath/src/dir1/vendor/v/v.go", "package v")
- tg.must(os.Symlink(tg.path("gopath/src/dir1"), tg.path("symdir1")))
- tg.setenv("GOPATH", tg.path("gopath"))
- tg.cd(tg.path("symdir1"))
- tg.run("list", "-f", "{{.Root}}", ".")
- if strings.TrimSpace(tg.getStdout()) != tg.path("gopath") {
- t.Error("list confused by symlinks")
- }
-
- // All of these should succeed, not die in vendor-handling code.
- tg.run("run", "p.go")
- tg.run("build")
- tg.run("install")
-}
-
-// Issue 15201.
-func TestSymlinksVendor15201(t *testing.T) {
- testenv.MustHaveSymlink(t)
-
- tg := testgo(t)
- defer tg.cleanup()
-
- tg.tempDir("gopath/src/x/y/_vendor/src/x")
- tg.must(os.Symlink("../../..", tg.path("gopath/src/x/y/_vendor/src/x/y")))
- tg.tempFile("gopath/src/x/y/w/w.go", "package w\nimport \"x/y/z\"\n")
- tg.must(os.Symlink("../_vendor/src", tg.path("gopath/src/x/y/w/vendor")))
- tg.tempFile("gopath/src/x/y/z/z.go", "package z\n")
-
- tg.setenv("GOPATH", tg.path("gopath/src/x/y/_vendor")+string(filepath.ListSeparator)+tg.path("gopath"))
- tg.cd(tg.path("gopath/src"))
- tg.run("list", "./...")
-}
-
-func TestSymlinksInternal(t *testing.T) {
- testenv.MustHaveSymlink(t)
-
- tg := testgo(t)
- defer tg.cleanup()
- tg.tempDir("gopath/src/dir1/internal/v")
- tg.tempFile("gopath/src/dir1/p.go", "package main\nimport _ `dir1/internal/v`\nfunc main(){}")
- tg.tempFile("gopath/src/dir1/internal/v/v.go", "package v")
- tg.must(os.Symlink(tg.path("gopath/src/dir1"), tg.path("symdir1")))
- tg.setenv("GOPATH", tg.path("gopath"))
- tg.cd(tg.path("symdir1"))
- tg.run("list", "-f", "{{.Root}}", ".")
- if strings.TrimSpace(tg.getStdout()) != tg.path("gopath") {
- t.Error("list confused by symlinks")
- }
-
- // All of these should succeed, not die in internal-handling code.
- tg.run("run", "p.go")
- tg.run("build")
- tg.run("install")
-}
-
// Issue 4515.
func TestInstallWithTags(t *testing.T) {
tooSlow(t)