summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/go/testdata/script/gopath_moved_repo.txt
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/cmd/go/testdata/script/gopath_moved_repo.txt')
-rw-r--r--libgo/go/cmd/go/testdata/script/gopath_moved_repo.txt68
1 files changed, 68 insertions, 0 deletions
diff --git a/libgo/go/cmd/go/testdata/script/gopath_moved_repo.txt b/libgo/go/cmd/go/testdata/script/gopath_moved_repo.txt
new file mode 100644
index 00000000000..869980da7c5
--- /dev/null
+++ b/libgo/go/cmd/go/testdata/script/gopath_moved_repo.txt
@@ -0,0 +1,68 @@
+env GO111MODULE=off
+
+# Test that 'go get -u' reports packages whose VCS configurations do not
+# match their import paths.
+
+[!net] skip
+[short] skip
+
+# We need to execute a custom Go program to break the config files.
+#
+# git will ask for a username and password when we run 'go get -d -f -u',
+# so we also need to set GIT_ASKPASS. Conveniently, a single binary can
+# perform both tasks!
+
+go build -o replace.exe replace
+env GIT_ASKPASS=$PWD/replace.exe
+
+
+# Test that 'go get -u' reports moved git packages.
+
+[exec:git] go get -d rsc.io/pdf
+[exec:git] go get -d -u rsc.io/pdf
+[exec:git] exec ./replace.exe pdf rsc.io/pdf/.git/config
+
+[exec:git] ! go get -d -u rsc.io/pdf
+[exec:git] stderr 'is a custom import path for'
+[exec:git] ! go get -d -f -u rsc.io/pdf
+[exec:git] stderr 'validating server certificate|[nN]ot [fF]ound'
+
+
+# Test that 'go get -u' reports moved Mercurial packages.
+
+[exec:hg] go get -d vcs-test.golang.org/go/custom-hg-hello
+[exec:hg] go get -d -u vcs-test.golang.org/go/custom-hg-hello
+[exec:hg] exec ./replace.exe custom-hg-hello vcs-test.golang.org/go/custom-hg-hello/.hg/hgrc
+
+[exec:hg] ! go get -d -u vcs-test.golang.org/go/custom-hg-hello
+[exec:hg] stderr 'is a custom import path for'
+[exec:hg] ! go get -d -f -u vcs-test.golang.org/go/custom-hg-hello
+[exec:hg] stderr 'validating server certificate|[nN]ot [fF]ound'
+
+
+-- replace/replace.go --
+package main
+
+import (
+ "bytes"
+ "io/ioutil"
+ "log"
+ "os"
+)
+
+func main() {
+ if len(os.Args) < 3 {
+ return
+ }
+
+ base := []byte(os.Args[1])
+ path := os.Args[2]
+ data, err := ioutil.ReadFile(path)
+ if err != nil {
+ log.Fatal(err)
+ }
+ err = ioutil.WriteFile(path, bytes.ReplaceAll(data, base, append(base, "XXX"...)), 0644)
+ if err != nil {
+ log.Fatal(err)
+ }
+}