codekingpro commited on
Commit
4929087
·
verified ·
1 Parent(s): d7a5f2f

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. go/src/cmd/go/testdata/addmod.go +154 -0
  2. go/src/cmd/go/testdata/mod/README +36 -0
  3. go/src/cmd/go/testdata/mod/example.com_ambiguous_a_b_v0.0.0-empty.txt +12 -0
  4. go/src/cmd/go/testdata/mod/example.com_ambiguous_a_v1.0.0.txt +18 -0
  5. go/src/cmd/go/testdata/mod/example.com_badchain_a_v1.0.0.txt +12 -0
  6. go/src/cmd/go/testdata/mod/example.com_badchain_a_v1.1.0.txt +12 -0
  7. go/src/cmd/go/testdata/mod/example.com_badchain_b_v1.0.0.txt +12 -0
  8. go/src/cmd/go/testdata/mod/example.com_badchain_b_v1.1.0.txt +12 -0
  9. go/src/cmd/go/testdata/mod/example.com_badchain_c_v1.0.0.txt +8 -0
  10. go/src/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt +8 -0
  11. go/src/cmd/go/testdata/mod/example.com_cmd_v1.0.0-exclude.txt +28 -0
  12. go/src/cmd/go/testdata/mod/example.com_cmd_v1.0.0-newerself.txt +28 -0
  13. go/src/cmd/go/testdata/mod/example.com_cmd_v1.0.0-replace.txt +28 -0
  14. go/src/cmd/go/testdata/mod/example.com_cmd_v1.0.0.txt +31 -0
  15. go/src/cmd/go/testdata/mod/example.com_cmd_v1.9.0.txt +30 -0
  16. go/src/cmd/go/testdata/mod/example.com_depends_on_generics_v1.0.0.txt +23 -0
  17. go/src/cmd/go/testdata/mod/example.com_deprecated_a_v1.0.0.txt +19 -0
  18. go/src/cmd/go/testdata/mod/example.com_deprecated_a_v1.9.0.txt +21 -0
  19. go/src/cmd/go/testdata/mod/example.com_deprecated_b_v1.0.0.txt +12 -0
  20. go/src/cmd/go/testdata/mod/example.com_deprecated_b_v1.9.0.txt +14 -0
  21. go/src/cmd/go/testdata/mod/example.com_dotgo.go_v1.0.0.txt +16 -0
  22. go/src/cmd/go/testdata/mod/example.com_dotname_v1.0.0.txt +12 -0
  23. go/src/cmd/go/testdata/mod/example.com_downgrade_v2.0.0.txt +9 -0
  24. go/src/cmd/go/testdata/mod/example.com_downgrade_v2_v2.0.1.txt +13 -0
  25. go/src/cmd/go/testdata/mod/example.com_fuzzfail_v0.1.0.txt +20 -0
  26. go/src/cmd/go/testdata/mod/example.com_fuzzfail_v0.2.0.txt +23 -0
  27. go/src/cmd/go/testdata/mod/example.com_generics_v1.0.0.txt +21 -0
  28. go/src/cmd/go/testdata/mod/example.com_ignore_v1.0.0.txt +11 -0
  29. go/src/cmd/go/testdata/mod/example.com_incompatiblewithsub_v1.0.0.txt +8 -0
  30. go/src/cmd/go/testdata/mod/example.com_incompatiblewithsub_v2.0.0+incompatible.txt +8 -0
  31. go/src/cmd/go/testdata/mod/example.com_invalidpath_v1_v1.0.0.txt +13 -0
  32. go/src/cmd/go/testdata/mod/example.com_join_subpkg_v1.0.0.txt +9 -0
  33. go/src/cmd/go/testdata/mod/example.com_join_subpkg_v1.1.0.txt +9 -0
  34. go/src/cmd/go/testdata/mod/example.com_join_v1.0.0.txt +7 -0
  35. go/src/cmd/go/testdata/mod/example.com_join_v1.1.0.txt +9 -0
  36. go/src/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.0.txt +14 -0
  37. go/src/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.1.txt +20 -0
  38. go/src/cmd/go/testdata/mod/example.com_missingpkg_v1.0.0.txt +11 -0
  39. go/src/cmd/go/testdata/mod/example.com_missingpkg_v1.0.1-beta.txt +8 -0
  40. go/src/cmd/go/testdata/mod/example.com_nest_sub_v1.0.0.txt +12 -0
  41. go/src/cmd/go/testdata/mod/example.com_nest_v1.0.0.txt +12 -0
  42. go/src/cmd/go/testdata/mod/example.com_nest_v1.1.0.txt +12 -0
  43. go/src/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.0.txt +10 -0
  44. go/src/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.1.txt +10 -0
  45. go/src/cmd/go/testdata/mod/example.com_newcycle_b_v1.0.0.txt +8 -0
  46. go/src/cmd/go/testdata/mod/example.com_noroot_v1.0.0.txt +8 -0
  47. go/src/cmd/go/testdata/mod/example.com_noroot_v1.0.1.txt +8 -0
  48. go/src/cmd/go/testdata/mod/example.com_notags_v0.0.0-20190507143103-cc8cbe209b64.txt +9 -0
  49. go/src/cmd/go/testdata/mod/example.com_printversion_v0.1.0.txt +33 -0
  50. go/src/cmd/go/testdata/mod/example.com_printversion_v1.0.0.txt +41 -0
go/src/cmd/go/testdata/addmod.go ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2018 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ //go:build ignore
6
+ // +build ignore
7
+
8
+ // Addmod adds a module as a txtar archive to the testdata/mod directory.
9
+ //
10
+ // Usage:
11
+ //
12
+ // go run addmod.go path@version...
13
+ //
14
+ // It should only be used for very small modules - we do not want to check
15
+ // very large files into testdata/mod.
16
+ //
17
+ // It is acceptable to edit the archive afterward to remove or shorten files.
18
+ // See mod/README for more information.
19
+ package main
20
+
21
+ import (
22
+ "bytes"
23
+ "cmd/go/internal/str"
24
+ "flag"
25
+ "fmt"
26
+ "internal/txtar"
27
+ "io/fs"
28
+ "log"
29
+ "os"
30
+ "os/exec"
31
+ "path/filepath"
32
+ "strings"
33
+ )
34
+
35
+ func usage() {
36
+ fmt.Fprintf(os.Stderr, "usage: go run addmod.go path@version...\n")
37
+ os.Exit(2)
38
+ }
39
+
40
+ var tmpdir string
41
+
42
+ func fatalf(format string, args ...any) {
43
+ os.RemoveAll(tmpdir)
44
+ log.Fatalf(format, args...)
45
+ }
46
+
47
+ const goCmd = "go"
48
+
49
+ func main() {
50
+ flag.Usage = usage
51
+ flag.Parse()
52
+ if flag.NArg() == 0 {
53
+ usage()
54
+ }
55
+
56
+ log.SetPrefix("addmod: ")
57
+ log.SetFlags(0)
58
+
59
+ var err error
60
+ tmpdir, err = os.MkdirTemp("", "addmod-")
61
+ if err != nil {
62
+ log.Fatal(err)
63
+ }
64
+
65
+ run := func(command string, args ...string) string {
66
+ cmd := exec.Command(command, args...)
67
+ cmd.Dir = tmpdir
68
+ var stderr bytes.Buffer
69
+ cmd.Stderr = &stderr
70
+ out, err := cmd.Output()
71
+ if err != nil {
72
+ fatalf("%s %s: %v\n%s", command, strings.Join(args, " "), err, stderr.Bytes())
73
+ }
74
+ return string(out)
75
+ }
76
+
77
+ gopath := strings.TrimSpace(run("go", "env", "GOPATH"))
78
+ if gopath == "" {
79
+ fatalf("cannot find GOPATH")
80
+ }
81
+
82
+ exitCode := 0
83
+ for _, arg := range flag.Args() {
84
+ if err := os.WriteFile(filepath.Join(tmpdir, "go.mod"), []byte("module m\n"), 0666); err != nil {
85
+ fatalf("%v", err)
86
+ }
87
+ run(goCmd, "get", "-d", arg)
88
+ path := arg
89
+ if i := strings.Index(path, "@"); i >= 0 {
90
+ path = path[:i]
91
+ }
92
+ out := run(goCmd, "list", "-m", "-f={{.Path}} {{.Version}} {{.Dir}}", path)
93
+ f := strings.Fields(out)
94
+ if len(f) != 3 {
95
+ log.Printf("go list -m %s: unexpected output %q", arg, out)
96
+ exitCode = 1
97
+ continue
98
+ }
99
+ path, vers, dir := f[0], f[1], f[2]
100
+ mod, err := os.ReadFile(filepath.Join(gopath, "pkg/mod/cache/download", path, "@v", vers+".mod"))
101
+ if err != nil {
102
+ log.Printf("%s: %v", arg, err)
103
+ exitCode = 1
104
+ continue
105
+ }
106
+ info, err := os.ReadFile(filepath.Join(gopath, "pkg/mod/cache/download", path, "@v", vers+".info"))
107
+ if err != nil {
108
+ log.Printf("%s: %v", arg, err)
109
+ exitCode = 1
110
+ continue
111
+ }
112
+
113
+ a := new(txtar.Archive)
114
+ title := arg
115
+ if !strings.Contains(arg, "@") {
116
+ title += "@" + vers
117
+ }
118
+ a.Comment = []byte(fmt.Sprintf("module %s\n\n", title))
119
+ a.Files = []txtar.File{
120
+ {Name: ".mod", Data: mod},
121
+ {Name: ".info", Data: info},
122
+ }
123
+ dir = filepath.Clean(dir)
124
+ err = filepath.WalkDir(dir, func(path string, info fs.DirEntry, err error) error {
125
+ if !info.Type().IsRegular() {
126
+ return nil
127
+ }
128
+ name := info.Name()
129
+ if name == "go.mod" || strings.HasSuffix(name, ".go") {
130
+ data, err := os.ReadFile(path)
131
+ if err != nil {
132
+ return err
133
+ }
134
+ a.Files = append(a.Files, txtar.File{Name: str.TrimFilePathPrefix(path, dir), Data: data})
135
+ }
136
+ return nil
137
+ })
138
+ if err != nil {
139
+ log.Printf("%s: %v", arg, err)
140
+ exitCode = 1
141
+ continue
142
+ }
143
+
144
+ data := txtar.Format(a)
145
+ target := filepath.Join("mod", strings.ReplaceAll(path, "/", "_")+"_"+vers+".txt")
146
+ if err := os.WriteFile(target, data, 0666); err != nil {
147
+ log.Printf("%s: %v", arg, err)
148
+ exitCode = 1
149
+ continue
150
+ }
151
+ }
152
+ os.RemoveAll(tmpdir)
153
+ os.Exit(exitCode)
154
+ }
go/src/cmd/go/testdata/mod/README ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This directory holds Go modules served by a Go module proxy
2
+ that runs on localhost during tests, both to make tests avoid
3
+ requiring specific network servers and also to make them
4
+ significantly faster.
5
+
6
+ A small go get'able test module can be added here by running
7
+
8
+ cd cmd/go/testdata
9
+ go run addmod.go path@vers
10
+
11
+ where path and vers are the module path and version to add here.
12
+
13
+ For interactive experimentation using this set of modules, run:
14
+
15
+ cd cmd/go
16
+ go test -proxy=localhost:1234 &
17
+ export GOPROXY=http://localhost:1234/mod
18
+
19
+ and then run go commands as usual.
20
+
21
+ Modules saved to this directory should be small: a few kilobytes at most.
22
+ It is acceptable to edit the archives created by addmod.go to remove
23
+ or shorten files. It is also acceptable to write module archives by hand:
24
+ they need not be backed by some public git repo.
25
+
26
+ Each module archive is named path_vers.txt, where slashes in path
27
+ have been replaced with underscores. The archive must contain
28
+ two files ".info" and ".mod", to be served as the info and mod files
29
+ in the proxy protocol (see https://research.swtch.com/vgo-module).
30
+ The remaining files are served as the content of the module zip file.
31
+ The path@vers prefix required of files in the zip file is added
32
+ automatically by the proxy: the files in the archive have names without
33
+ the prefix, like plain "go.mod", "x.go", and so on.
34
+
35
+ See ../addmod.go and ../savedir.go for tools to generate txtar files,
36
+ although again it is also fine to write them by hand.
go/src/cmd/go/testdata/mod/example.com_ambiguous_a_b_v0.0.0-empty.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Module example.com/ambiguous/a/b is a suffix of example.com/a.
2
+ This version contains no package.
3
+ -- .mod --
4
+ module example.com/ambiguous/a/b
5
+
6
+ go 1.16
7
+ -- .info --
8
+ {"Version":"v0.0.0-empty"}
9
+ -- go.mod --
10
+ module example.com/ambiguous/a/b
11
+
12
+ go 1.16
go/src/cmd/go/testdata/mod/example.com_ambiguous_a_v1.0.0.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Module example.com/ambiguous/a is a prefix of example.com/a/b.
2
+ It contains package example.com/a/b.
3
+ -- .mod --
4
+ module example.com/ambiguous/a
5
+
6
+ go 1.16
7
+
8
+ require example.com/ambiguous/a/b v0.0.0-empty
9
+ -- .info --
10
+ {"Version":"v1.0.0"}
11
+ -- go.mod --
12
+ module example.com/ambiguous/a
13
+
14
+ go 1.16
15
+
16
+ require example.com/ambiguous/a/b v0.0.0-empty
17
+ -- b/b.go --
18
+ package b
go/src/cmd/go/testdata/mod/example.com_badchain_a_v1.0.0.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/badchain/a v1.0.0
2
+
3
+ -- .mod --
4
+ module example.com/badchain/a
5
+
6
+ require example.com/badchain/b v1.0.0
7
+ -- .info --
8
+ {"Version":"v1.0.0"}
9
+ -- a.go --
10
+ package a
11
+
12
+ import _ "example.com/badchain/b"
go/src/cmd/go/testdata/mod/example.com_badchain_a_v1.1.0.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/badchain/a v1.1.0
2
+
3
+ -- .mod --
4
+ module example.com/badchain/a
5
+
6
+ require example.com/badchain/b v1.1.0
7
+ -- .info --
8
+ {"Version":"v1.1.0"}
9
+ -- a.go --
10
+ package a
11
+
12
+ import _ "example.com/badchain/b"
go/src/cmd/go/testdata/mod/example.com_badchain_b_v1.0.0.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/badchain/b v1.0.0
2
+
3
+ -- .mod --
4
+ module example.com/badchain/b
5
+
6
+ require example.com/badchain/c v1.0.0
7
+ -- .info --
8
+ {"Version":"v1.0.0"}
9
+ -- b.go --
10
+ package b
11
+
12
+ import _ "example.com/badchain/c"
go/src/cmd/go/testdata/mod/example.com_badchain_b_v1.1.0.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/badchain/b v1.1.0
2
+
3
+ -- .mod --
4
+ module example.com/badchain/b
5
+
6
+ require example.com/badchain/c v1.1.0
7
+ -- .info --
8
+ {"Version":"v1.1.0"}
9
+ -- b.go --
10
+ package b
11
+
12
+ import _ "example.com/badchain/c"
go/src/cmd/go/testdata/mod/example.com_badchain_c_v1.0.0.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ example.com/badchain/c v1.0.0
2
+
3
+ -- .mod --
4
+ module example.com/badchain/c
5
+ -- .info --
6
+ {"Version":"v1.0.0"}
7
+ -- c.go --
8
+ package c
go/src/cmd/go/testdata/mod/example.com_badchain_c_v1.1.0.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ example.com/badchain/c v1.1.0
2
+
3
+ -- .mod --
4
+ module badchain.example.com/c
5
+ -- .info --
6
+ {"Version":"v1.1.0"}
7
+ -- c.go --
8
+ package c
go/src/cmd/go/testdata/mod/example.com_cmd_v1.0.0-exclude.txt ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/cmd contains main packages.
2
+
3
+ -- .info --
4
+ {"Version":"v1.0.0-exclude"}
5
+ -- .mod --
6
+ module example.com/cmd
7
+
8
+ go 1.16
9
+
10
+ exclude rsc.io/quote v1.5.2
11
+ -- go.mod --
12
+ module example.com/cmd
13
+
14
+ go 1.16
15
+
16
+ exclude rsc.io/quote v1.5.2
17
+ -- a/a.go --
18
+ package main
19
+
20
+ func main() {}
21
+ -- b/b.go --
22
+ package main
23
+
24
+ func main() {}
25
+ -- err/err.go --
26
+ package err
27
+
28
+ var X = DoesNotCompile
go/src/cmd/go/testdata/mod/example.com_cmd_v1.0.0-newerself.txt ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/cmd contains main packages.
2
+
3
+ -- .info --
4
+ {"Version":"v1.0.0-newerself"}
5
+ -- .mod --
6
+ module example.com/cmd
7
+
8
+ go 1.16
9
+
10
+ require example.com/cmd v1.0.0
11
+ -- go.mod --
12
+ module example.com/cmd
13
+
14
+ go 1.16
15
+
16
+ require example.com/cmd v1.0.0
17
+ -- a/a.go --
18
+ package main
19
+
20
+ func main() {}
21
+ -- b/b.go --
22
+ package main
23
+
24
+ func main() {}
25
+ -- err/err.go --
26
+ package err
27
+
28
+ var X = DoesNotCompile
go/src/cmd/go/testdata/mod/example.com_cmd_v1.0.0-replace.txt ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/cmd contains main packages.
2
+
3
+ -- .info --
4
+ {"Version":"v1.0.0-replace"}
5
+ -- .mod --
6
+ module example.com/cmd
7
+
8
+ go 1.16
9
+
10
+ replace rsc.io/quote => rsc.io/quote v1.5.2
11
+ -- go.mod --
12
+ module example.com/cmd
13
+
14
+ go 1.16
15
+
16
+ replace rsc.io/quote => rsc.io/quote v1.5.2
17
+ -- a/a.go --
18
+ package main
19
+
20
+ func main() {}
21
+ -- b/b.go --
22
+ package main
23
+
24
+ func main() {}
25
+ -- err/err.go --
26
+ package err
27
+
28
+ var X = DoesNotCompile
go/src/cmd/go/testdata/mod/example.com_cmd_v1.0.0.txt ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/cmd contains main packages.
2
+
3
+ v1.0.0 is the latest non-retracted version. Other versions contain errors or
4
+ detectable problems.
5
+
6
+ -- .info --
7
+ {"Version":"v1.0.0"}
8
+ -- .mod --
9
+ module example.com/cmd
10
+
11
+ go 1.16
12
+ -- go.mod --
13
+ module example.com/cmd
14
+
15
+ go 1.16
16
+ -- a/a.go --
17
+ package main
18
+
19
+ import "fmt"
20
+
21
+ func main() { fmt.Println("a@v1.0.0") }
22
+ -- b/b.go --
23
+ package main
24
+
25
+ import "fmt"
26
+
27
+ func main() { fmt.Println("b@v1.0.0") }
28
+ -- err/err.go --
29
+ package err
30
+
31
+ var X = DoesNotCompile
go/src/cmd/go/testdata/mod/example.com_cmd_v1.9.0.txt ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/cmd contains main packages.
2
+
3
+ -- .info --
4
+ {"Version":"v1.9.0"}
5
+ -- .mod --
6
+ module example.com/cmd
7
+
8
+ go 1.16
9
+
10
+ // this is a bad version
11
+ retract v1.9.0
12
+ -- go.mod --
13
+ module example.com/cmd
14
+
15
+ go 1.16
16
+
17
+ // this is a bad version
18
+ retract v1.9.0
19
+ -- a/a.go --
20
+ package main
21
+
22
+ func main() {}
23
+ -- b/b.go --
24
+ package main
25
+
26
+ func main() {}
27
+ -- err/err.go --
28
+ package err
29
+
30
+ var X = DoesNotCompile
go/src/cmd/go/testdata/mod/example.com_depends_on_generics_v1.0.0.txt ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/depends/on/generics v1.0.0
2
+ written by hand
3
+
4
+ -- .mod --
5
+ module example.com/depends/on/generics
6
+
7
+ go 1.18
8
+
9
+ require example.com/generics v1.0.0
10
+ -- .info --
11
+ {"Version":"v1.0.0"}
12
+ -- go.mod --
13
+ module example.com/depends/on/generics
14
+
15
+ go 1.18
16
+
17
+ require example.com/generics v1.0.0
18
+ -- main.go --
19
+ package main
20
+
21
+ import "example.com/generics"
22
+
23
+ func main() {generics.Bar()}
go/src/cmd/go/testdata/mod/example.com_deprecated_a_v1.0.0.txt ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- .info --
2
+ {"Version":"v1.0.0"}
3
+ -- .mod --
4
+ module example.com/deprecated/a
5
+
6
+ go 1.17
7
+ -- go.mod --
8
+ module example.com/deprecated/a
9
+
10
+ go 1.17
11
+ -- a.go --
12
+ package a
13
+
14
+ -- cmd/a/a.go --
15
+ package main
16
+
17
+ import "fmt"
18
+
19
+ func main() { fmt.Println("a@v1.0.0") }
go/src/cmd/go/testdata/mod/example.com_deprecated_a_v1.9.0.txt ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- .info --
2
+ {"Version":"v1.9.0"}
3
+ -- .mod --
4
+ // Deprecated: in example.com/deprecated/a@v1.9.0
5
+ module example.com/deprecated/a
6
+
7
+ go 1.17
8
+ -- go.mod --
9
+ // Deprecated: in example.com/deprecated/a@v1.9.0
10
+ module example.com/deprecated/a
11
+
12
+ go 1.17
13
+ -- a.go --
14
+ package a
15
+
16
+ -- cmd/a/a.go --
17
+ package main
18
+
19
+ import "fmt"
20
+
21
+ func main() { fmt.Println("a@v1.9.0") }
go/src/cmd/go/testdata/mod/example.com_deprecated_b_v1.0.0.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- .info --
2
+ {"Version":"v1.0.0"}
3
+ -- .mod --
4
+ module example.com/deprecated/b
5
+
6
+ go 1.17
7
+ -- go.mod --
8
+ module example.com/deprecated/b
9
+
10
+ go 1.17
11
+ -- b.go --
12
+ package b
go/src/cmd/go/testdata/mod/example.com_deprecated_b_v1.9.0.txt ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- .info --
2
+ {"Version":"v1.9.0"}
3
+ -- .mod --
4
+ // Deprecated: in example.com/deprecated/b@v1.9.0
5
+ module example.com/deprecated/b
6
+
7
+ go 1.17
8
+ -- go.mod --
9
+ // Deprecated: in example.com/deprecated/b@v1.9.0
10
+ module example.com/deprecated/b
11
+
12
+ go 1.17
13
+ -- b.go --
14
+ package b
go/src/cmd/go/testdata/mod/example.com_dotgo.go_v1.0.0.txt ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This module's path ends with ".go".
2
+ Based on github.com/nats-io/nats.go.
3
+ Used in regression tests for golang.org/issue/32483.
4
+
5
+ -- .mod --
6
+ module example.com/dotgo.go
7
+
8
+ go 1.13
9
+ -- .info --
10
+ {"Version":"v1.0.0"}
11
+ -- go.mod --
12
+ module example.com/dotgo.go
13
+
14
+ go 1.13
15
+ -- dotgo.go --
16
+ package dotgo
go/src/cmd/go/testdata/mod/example.com_dotname_v1.0.0.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- .info --
2
+ {"Version":"v1.0.0"}
3
+ -- .mod --
4
+ module example.com/dotname
5
+
6
+ go 1.16
7
+ -- go.mod --
8
+ module example.com/dotname
9
+
10
+ go 1.16
11
+ -- .dot/dot.go --
12
+ package dot
go/src/cmd/go/testdata/mod/example.com_downgrade_v2.0.0.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ example.com/downgrade v2.0.0
2
+ written by hand
3
+
4
+ -- .mod --
5
+ module example.com/downgrade
6
+
7
+ require rsc.io/quote v1.5.2
8
+ -- .info --
9
+ {"Version":"v2.0.0"}
go/src/cmd/go/testdata/mod/example.com_downgrade_v2_v2.0.1.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/downgrade/v2 v2.0.1
2
+ written by hand
3
+
4
+ -- .mod --
5
+ module example.com/downgrade/v2
6
+
7
+ require rsc.io/quote v1.5.2
8
+ -- .info --
9
+ {"Version":"v2.0.1"}
10
+ -- go.mod --
11
+ module example.com/downgrade/v2
12
+
13
+ require rsc.io/quote v1.5.2
go/src/cmd/go/testdata/mod/example.com_fuzzfail_v0.1.0.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- .mod --
2
+ module example.com/fuzzfail
3
+
4
+ go 1.18
5
+ -- .info --
6
+ {"Version":"v0.1.0"}
7
+ -- go.mod --
8
+ module example.com/fuzzfail
9
+
10
+ go 1.18
11
+ -- fuzzfail_test.go --
12
+ package fuzzfail
13
+
14
+ import "testing"
15
+
16
+ func FuzzFail(f *testing.F) {
17
+ f.Fuzz(func(t *testing.T, b []byte) {
18
+ t.Fatalf("oops: %q", b)
19
+ })
20
+ }
go/src/cmd/go/testdata/mod/example.com_fuzzfail_v0.2.0.txt ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- .mod --
2
+ module example.com/fuzzfail
3
+
4
+ go 1.18
5
+ -- .info --
6
+ {"Version":"v0.2.0"}
7
+ -- go.mod --
8
+ module example.com/fuzzfail
9
+
10
+ go 1.18
11
+ -- fuzzfail_test.go --
12
+ package fuzzfail
13
+
14
+ import "testing"
15
+
16
+ func FuzzFail(f *testing.F) {
17
+ f.Fuzz(func(t *testing.T, b []byte) {
18
+ t.Fatalf("oops: %q", b)
19
+ })
20
+ }
21
+ -- testdata/fuzz/FuzzFail/bbb0c2d22aa1a24617301566dc7486f8b625d38024603ba62757c1124013b49a --
22
+ go test fuzz v1
23
+ []byte("\x05")
go/src/cmd/go/testdata/mod/example.com_generics_v1.0.0.txt ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/generics v1.0.0
2
+ written by hand
3
+
4
+ -- .mod --
5
+ module example.com/generics
6
+
7
+ go 1.18
8
+ -- .info --
9
+ {"Version":"v1.0.0"}
10
+ -- go.mod --
11
+ module example.com/generics
12
+
13
+ go 1.18
14
+ -- generics.go --
15
+ package generics
16
+
17
+ type Int interface {
18
+ ~int
19
+ }
20
+
21
+ func Bar() {}
go/src/cmd/go/testdata/mod/example.com_ignore_v1.0.0.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- .mod --
2
+ module example.com/ignore
3
+
4
+ ignore ./foo
5
+ -- .info --
6
+ {"Version":"v1.0.0"}
7
+
8
+ -- foo/foo.go --
9
+ package foo
10
+
11
+ const Bar = "Hello from foo!"
go/src/cmd/go/testdata/mod/example.com_incompatiblewithsub_v1.0.0.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ Module example.com/incompatiblewithsub has an incompatible version
2
+ and a package in a subdirectory.
3
+ -- .info --
4
+ {"Version":"v1.0.0"}
5
+ -- .mod --
6
+ module example.com/incompatiblewithsub
7
+ -- sub/sub.go --
8
+ package sub
go/src/cmd/go/testdata/mod/example.com_incompatiblewithsub_v2.0.0+incompatible.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ Module example.com/incompatiblewithsub has an incompatible version
2
+ and a package in a subdirectory.
3
+ -- .info --
4
+ {"Version":"v2.0.0+incompatible"}
5
+ -- .mod --
6
+ module example.com/incompatiblewithsub
7
+ -- sub/sub.go --
8
+ package sub
go/src/cmd/go/testdata/mod/example.com_invalidpath_v1_v1.0.0.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/invalidpath/v1 v1.0.0
2
+ written by hand
3
+
4
+ -- .mod --
5
+ module example.com/invalidpath/v1
6
+ -- .info --
7
+ {"Version":"v1.0.0"}
8
+ -- go.mod --
9
+ module example.com/invalidpath/v1
10
+ -- version.go --
11
+ package version
12
+
13
+ const V = "v1.0.0"
go/src/cmd/go/testdata/mod/example.com_join_subpkg_v1.0.0.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ Written by hand.
2
+ Test case for package moved into a parent module.
3
+
4
+ -- .mod --
5
+ module example.com/join/subpkg
6
+ -- .info --
7
+ {"Version": "v1.0.0"}
8
+ -- x.go --
9
+ package subpkg
go/src/cmd/go/testdata/mod/example.com_join_subpkg_v1.1.0.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ Written by hand.
2
+ Test case for package moved into a parent module.
3
+
4
+ -- .mod --
5
+ module example.com/join/subpkg
6
+
7
+ require example.com/join v1.1.0
8
+ -- .info --
9
+ {"Version": "v1.1.0"}
go/src/cmd/go/testdata/mod/example.com_join_v1.0.0.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ Written by hand.
2
+ Test case for package moved into a parent module.
3
+
4
+ -- .mod --
5
+ module example.com/join
6
+ -- .info --
7
+ {"Version": "v1.0.0"}
go/src/cmd/go/testdata/mod/example.com_join_v1.1.0.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ Written by hand.
2
+ Test case for package moved into a parent module.
3
+
4
+ -- .mod --
5
+ module example.com/join
6
+ -- .info --
7
+ {"Version": "v1.1.0"}
8
+ -- subpkg/x.go --
9
+ package subpkg
go/src/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.0.txt ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/latemigrate/v2 v2.0.0
2
+ written by hand
3
+
4
+ This repository migrated to modules in v2.0.1 after v2.0.0 was already tagged.
5
+ All versions require rsc.io/quote so we can test downgrades.
6
+
7
+ v2.0.0 is technically part of example.com/latemigrate as v2.0.0+incompatible.
8
+ Proxies may serve it as part of the version list for example.com/latemigrate/v2.
9
+ 'go get' must be able to ignore these versions.
10
+
11
+ -- .mod --
12
+ module example.com/latemigrate
13
+ -- .info --
14
+ {"Version":"v2.0.0"}
go/src/cmd/go/testdata/mod/example.com_latemigrate_v2_v2.0.1.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/latemigrate/v2 v2.0.1
2
+ written by hand
3
+
4
+ This repository migrated to modules in v2.0.1 after v2.0.0 was already tagged.
5
+ All versions require rsc.io/quote so we can test downgrades.
6
+
7
+ v2.0.1 belongs to example.com/latemigrate/v2.
8
+
9
+ -- .mod --
10
+ module example.com/latemigrate/v2
11
+
12
+ require rsc.io/quote v1.3.0
13
+ -- .info --
14
+ {"Version":"v2.0.1"}
15
+ -- go.mod --
16
+ module example.com/latemigrate/v2
17
+
18
+ require rsc.io/quote v1.3.0
19
+ -- late.go --
20
+ package late
go/src/cmd/go/testdata/mod/example.com_missingpkg_v1.0.0.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The deprecated package is present in this version (which is @latest) but
2
+ is deleted in a newer prerelease version.
3
+
4
+ -- .mod --
5
+ module example.com/missingpkg
6
+ -- .info --
7
+ {"Version":"v1.0.0"}
8
+ -- lib.go --
9
+ package lib
10
+ -- deprecated/deprecated.go --
11
+ package deprecated
go/src/cmd/go/testdata/mod/example.com_missingpkg_v1.0.1-beta.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ The deprecated package is deleted in this version.
2
+
3
+ -- .mod --
4
+ module example.com/missingpkg
5
+ -- .info --
6
+ {"Version":"v1.0.1-beta"}
7
+ -- lib.go --
8
+ package lib
go/src/cmd/go/testdata/mod/example.com_nest_sub_v1.0.0.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Written by hand.
2
+ Test case for nested modules without an explicit relationship.
3
+ This is nested below the top-level module.
4
+
5
+ -- .mod --
6
+ module example.com/nest/sub
7
+ -- .info --
8
+ {"Version": "v1.0.0"}
9
+ -- go.mod --
10
+ module example.com/nest/sub
11
+ -- y/y.go --
12
+ package y
go/src/cmd/go/testdata/mod/example.com_nest_v1.0.0.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Written by hand.
2
+ Test case for nested modules without an explicit relationship.
3
+ This is the top-level module.
4
+
5
+ -- .mod --
6
+ module example.com/nest
7
+ -- .info --
8
+ {"Version": "v1.0.0"}
9
+ -- go.mod --
10
+ module example.com/nest
11
+ -- sub/x/x.go --
12
+ package x
go/src/cmd/go/testdata/mod/example.com_nest_v1.1.0.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Written by hand.
2
+ Test case for nested modules without an explicit relationship.
3
+ This is the top-level module.
4
+
5
+ -- .mod --
6
+ module example.com/nest
7
+ -- .info --
8
+ {"Version": "v1.1.0"}
9
+ -- go.mod --
10
+ module example.com/nest
11
+ -- sub/x/x.go --
12
+ package x
go/src/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.0.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/newcycle/a v1.0.0
2
+
3
+ Transitively requires v1.0.1 of itself via example.com/newcycle/b
4
+
5
+ -- .mod --
6
+ module example.com/newcycle/a
7
+
8
+ require example.com/newcycle/b v1.0.0
9
+ -- .info --
10
+ {"Version":"v1.0.0"}
go/src/cmd/go/testdata/mod/example.com_newcycle_a_v1.0.1.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/newcycle/a v1.0.1
2
+
3
+ Transitively requires itself via example.com/newcycle/b
4
+
5
+ -- .mod --
6
+ module example.com/newcycle/a
7
+
8
+ require example.com/newcycle/b v1.0.0
9
+ -- .info --
10
+ {"Version":"v1.0.1"}
go/src/cmd/go/testdata/mod/example.com_newcycle_b_v1.0.0.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ example.com/newcycle/b v1.0.0
2
+
3
+ -- .mod --
4
+ module example.com/newcycle/b
5
+
6
+ require example.com/newcycle/a v1.0.1
7
+ -- .info --
8
+ {"Version":"v1.0.0"}
go/src/cmd/go/testdata/mod/example.com_noroot_v1.0.0.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ A module which has no root package.
2
+
3
+ -- .mod --
4
+ module example.com/noroot
5
+ -- .info --
6
+ {"Version":"v1.0.0"}
7
+ -- pkg/pkg.go --
8
+ package pkg
go/src/cmd/go/testdata/mod/example.com_noroot_v1.0.1.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ A module which has no root package.
2
+
3
+ -- .mod --
4
+ module example.com/noroot
5
+ -- .info --
6
+ {"Version":"v1.0.1"}
7
+ -- pkg/pkg.go --
8
+ package pkg
go/src/cmd/go/testdata/mod/example.com_notags_v0.0.0-20190507143103-cc8cbe209b64.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ Written by hand.
2
+ The "latest" version of a module without any tags.
3
+
4
+ -- .mod --
5
+ module example.com/notags
6
+ -- .info --
7
+ {"Version":"v0.0.0-20190507143103-cc8cbe209b64","Time":"2019-05-07T07:31:03-07:00"}
8
+ -- notags.go --
9
+ package notags
go/src/cmd/go/testdata/mod/example.com_printversion_v0.1.0.txt ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/printversion v0.1.0
2
+
3
+ -- .mod --
4
+ module example.com/printversion
5
+ -- .info --
6
+ {"Version":"v0.1.0"}
7
+ -- README.txt --
8
+ There is no go.mod file for this version of the module.
9
+ -- printversion.go --
10
+ package main
11
+
12
+ import (
13
+ "fmt"
14
+ "os"
15
+ "runtime/debug"
16
+
17
+ _ "example.com/version"
18
+ )
19
+
20
+ func main() {
21
+ info, _ := debug.ReadBuildInfo()
22
+ fmt.Fprintf(os.Stdout, "path is %s\n", info.Path)
23
+ fmt.Fprintf(os.Stdout, "main is %s %s\n", info.Main.Path, info.Main.Version)
24
+ if r := info.Main.Replace; r != nil {
25
+ fmt.Fprintf(os.Stdout, "\t(replaced by %s %s)\n", r.Path, r.Version)
26
+ }
27
+ for _, m := range info.Deps {
28
+ fmt.Fprintf(os.Stdout, "using %s %s\n", m.Path, m.Version)
29
+ if r := m.Replace; r != nil {
30
+ fmt.Fprintf(os.Stdout, "\t(replaced by %s %s)\n", r.Path, r.Version)
31
+ }
32
+ }
33
+ }
go/src/cmd/go/testdata/mod/example.com_printversion_v1.0.0.txt ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ example.com/printversion v1.0.0
2
+
3
+ -- .mod --
4
+ module example.com/printversion
5
+
6
+ require example.com/version v1.0.0
7
+ replace example.com/version v1.0.0 => ../oops v0.0.0
8
+ exclude example.com/version v1.1.0
9
+ -- .info --
10
+ {"Version":"v1.0.0"}
11
+ -- go.mod --
12
+ module example.com/printversion
13
+
14
+ require example.com/version v1.0.0
15
+ replace example.com/version v1.0.0 => ../oops v0.0.0
16
+ exclude example.com/version v1.0.1
17
+ -- printversion.go --
18
+ package main
19
+
20
+ import (
21
+ "fmt"
22
+ "os"
23
+ "runtime/debug"
24
+
25
+ _ "example.com/version"
26
+ )
27
+
28
+ func main() {
29
+ info, _ := debug.ReadBuildInfo()
30
+ fmt.Fprintf(os.Stdout, "path is %s\n", info.Path)
31
+ fmt.Fprintf(os.Stdout, "main is %s %s\n", info.Main.Path, info.Main.Version)
32
+ if r := info.Main.Replace; r != nil {
33
+ fmt.Fprintf(os.Stdout, "\t(replaced by %s %s)\n", r.Path, r.Version)
34
+ }
35
+ for _, m := range info.Deps {
36
+ fmt.Fprintf(os.Stdout, "using %s %s\n", m.Path, m.Version)
37
+ if r := m.Replace; r != nil {
38
+ fmt.Fprintf(os.Stdout, "\t(replaced by %s %s)\n", r.Path, r.Version)
39
+ }
40
+ }
41
+ }