whatcanGOwrong

This commit is contained in:
2024-09-19 21:38:24 -04:00
commit d0ae4d841d
17908 changed files with 4096831 additions and 0 deletions
@@ -0,0 +1,6 @@
-- want --
valid:
omitted:
invalid:
@@ -0,0 +1,20 @@
-- want --
valid:
$work/valid.go
omitted:
$work/.hg_archival.txt: file is inserted by 'hg archive' and is always omitted
$work/.git: directory is a version control repository
$work/sub: directory is in another module
$work/vendor/x/y: file is in vendor directory
invalid:
$work/GO.MOD: go.mod files must have lowercase names
$work/invalid.go': malformed file path "invalid.go'": invalid char '\''
-- valid.go --
-- GO.MOD --
-- invalid.go' --
-- vendor/x/y --
-- sub/go.mod --
-- .hg_archival.txt --
-- .git/x --
@@ -0,0 +1,6 @@
-- want --
valid:
omitted:
invalid:
@@ -0,0 +1,25 @@
-- want --
valid:
valid.go
omitted:
vendor/x/y: file is in vendor directory
sub/go.mod: file is in another module
.hg_archival.txt: file is inserted by 'hg archive' and is always omitted
invalid:
not/../clean: file path is not clean
GO.MOD: go.mod files must have lowercase names
invalid.go': malformed file path "invalid.go'": invalid char '\''
valid.go: multiple entries for file "valid.go"
-- valid.go --
-- not/../clean --
-- GO.MOD --
-- invalid.go' --
-- vendor/x/y --
-- sub/go.mod --
-- .hg_archival.txt --
-- valid.go --
duplicate
-- valid.go --
another duplicate
@@ -0,0 +1,8 @@
path=example.com/empty
version=v1.0.0
-- want --
valid:
omitted:
invalid:
@@ -0,0 +1,21 @@
path=example.com/various
version=v1.0.0
-- want --
valid:
example.com/various@v1.0.0/valid.go
omitted:
invalid:
noprefix: path does not have prefix "example.com/various@v1.0.0/"
example.com/various@v1.0.0/not/../clean: file path is not clean
example.com/various@v1.0.0/invalid.go': malformed file path "invalid.go'": invalid char '\''
example.com/various@v1.0.0/GO.MOD: go.mod files must have lowercase names
example.com/various@v1.0.0/valid.go: multiple entries for file "valid.go"
-- noprefix --
-- example.com/various@v1.0.0/valid.go --
-- example.com/various@v1.0.0/not/../clean --
-- example.com/various@v1.0.0/invalid.go' --
-- example.com/various@v1.0.0/GO.MOD --
-- example.com/various@v1.0.0/valid.go --
duplicate
@@ -0,0 +1,5 @@
path=example.com/m
version=v1.0.0
wantErr=malformed file path "bad.go'": invalid char '\''
-- bad.go' --
package bad
@@ -0,0 +1,5 @@
path=example.com/m
version=v1.0.0
wantErr=GO.MOD: go.mod files must have lowercase names
-- GO.MOD --
module example.com/m
@@ -0,0 +1,3 @@
path=cache
version=v1.0.0
wantErr=missing dot in first path element
@@ -0,0 +1,3 @@
path=example.com/m
version=v2.0.0
wantErr=invalid version: should be v0 or v1, not v2
@@ -0,0 +1,3 @@
path=example.com/m
version=v1.0.0+bad
wantErr=version "v1.0.0+bad" is not canonical (should be "v1.0.0")
@@ -0,0 +1,7 @@
path=example.com/m
version=v1.0.0
wantErr=multiple entries for file "dup.go"
-- dup.go --
package d1
-- dup.go --
package d2
@@ -0,0 +1,7 @@
path=example.com/m
version=v1.0.0
wantErr=entry "a.go" is both a file and a directory
-- a.go --
package a
-- a.go/b.go --
package b
@@ -0,0 +1,3 @@
path=example.com/empty
version=v1.0.0
hash=h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=
@@ -0,0 +1,9 @@
path=example.com/m
version=v1.0.0
hash=h1:xctQQey8/y7IcBjFZDP/onWLSXhlqcsC3i1fgSdpMHk=
-- a.go --
package a
-- b/GO.MOD --
MODULE EXAMPLE.COM/M/B
-- b/b.go --
package b
@@ -0,0 +1,11 @@
path=example.com/m
version=v1.0.0
hash=h1:XduFAgX/GaspZa8Jv4pfzoGEzNaU/r88PiCunijw5ok=
-- go.mod --
module example.com/m
go 1.13
-- sub/go.mod --
module example.com/m/sub
-- sub/x.go' --
invalid name, but this shouldn't be read
@@ -0,0 +1,14 @@
path=example.com/m
version=v1.0.0
hash=h1:5u93LDLN0Me+NGfZtRpA5mHxY8svfykHpq4CMSaBZyc=
-- go.mod --
module example.com/m
go 1.13
-- vendor/modules.txt --
included
see comment in isVendoredPackage and golang.org/issue/31562.
-- vendor/example.com/x/x.go --
excluded
-- sub/vendor/sub.txt --
excluded
@@ -0,0 +1,7 @@
path=example.com/m
version=v1.0.0
wantErr=case-insensitive file name collision: "m.go" and "M.GO"
-- m.go --
package m
-- M.GO --
package m
@@ -0,0 +1,5 @@
path=example.com/m
version=v1.0.0
hash=h1:Mun5l9cBlDnnV6JasTpio2aZJSbFj++h+814mnKC/OM=
-- go.mod/a.go --
package a
@@ -0,0 +1,3 @@
path=ÿ # 0xFF
version=v1.0.0
wantErr=malformed module path "\xff": invalid UTF-8
@@ -0,0 +1,22 @@
path=example.com/m
version=v1.0.0
hash=h1:tpqYOOmuilagXzyqoJ3roUjp8gneQeTv5YVpL6BG7/k=
-- go.mod --
module example.com/m
go 1.13
-- m.go --
package m
func Foo() int { return 42 }
-- cmd/hello/hello.go --
package main
import (
"fmt"
"example.com/m"
)
func main() {
fmt.Println(m.Foo())
}
@@ -0,0 +1,5 @@
path=example.com/m
version=v1.0.0
wantErr=malformed file path "bad.go'": invalid char '\''
-- bad.go' --
package bad
@@ -0,0 +1,5 @@
path=example.com/m
version=v1.0.0
wantErr=GO.MOD: go.mod files must have lowercase names
-- GO.MOD --
module example.com/m
@@ -0,0 +1,3 @@
path=cache
version=v1.0.0
wantErr=missing dot in first path element
@@ -0,0 +1,3 @@
path=example.com/m
version=v2.0.0
wantErr=invalid version: should be v0 or v1, not v2
@@ -0,0 +1,3 @@
path=example.com/m
version=v1.0.0+bad
wantErr=version "v1.0.0+bad" is not canonical (should be "v1.0.0")
@@ -0,0 +1,3 @@
path=example.com/empty
version=v1.0.0
hash=h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=
@@ -0,0 +1,11 @@
path=example.com/m
version=v1.0.0
hash=h1:XduFAgX/GaspZa8Jv4pfzoGEzNaU/r88PiCunijw5ok=
-- go.mod --
module example.com/m
go 1.13
-- sub/go.mod --
module example.com/m/sub
-- sub/x.go' --
invalid name, but this shouldn't be read
@@ -0,0 +1,11 @@
path=example.com/m
version=v1.0.0
hash=h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=
-- .bzr/exclude --
exclude
-- .git/exclude --
exclude
-- .hg/exclude --
exclude
-- .svn/exclude --
exclude
@@ -0,0 +1,14 @@
path=example.com/m
version=v1.0.0
hash=h1:5u93LDLN0Me+NGfZtRpA5mHxY8svfykHpq4CMSaBZyc=
-- go.mod --
module example.com/m
go 1.13
-- vendor/modules.txt --
included
see comment in isVendoredPackage and golang.org/issue/31562.
-- vendor/example.com/x/x.go --
excluded
-- sub/vendor/sub.txt --
excluded
@@ -0,0 +1,5 @@
path=example.com/m
version=v1.0.0
hash=h1:Mun5l9cBlDnnV6JasTpio2aZJSbFj++h+814mnKC/OM=
-- go.mod/a.go --
package a
@@ -0,0 +1,3 @@
path=ÿ # 0xFF
version=v1.0.0
wantErr=malformed module path "\xff": invalid UTF-8
@@ -0,0 +1,22 @@
path=example.com/m
version=v1.0.0
hash=h1:tpqYOOmuilagXzyqoJ3roUjp8gneQeTv5YVpL6BG7/k=
-- go.mod --
module example.com/m
go 1.13
-- m.go --
package m
func Foo() int { return 42 }
-- cmd/hello/hello.go --
package main
import (
"fmt"
"example.com/m"
)
func main() {
fmt.Println(m.Foo())
}
@@ -0,0 +1,5 @@
path=example.com/m
version=v1.0.0
wantErr=malformed file path "bad.go'": invalid char '\''
-- example.com/m@v1.0.0/bad.go' --
package bad
@@ -0,0 +1,5 @@
path=example.com/m
version=v1.0.0
wantErr=go.mod files must have lowercase names
-- example.com/m@v1.0.0/GO.MOD --
module example.com/m
@@ -0,0 +1,3 @@
path=cache
version=v1.0.0
wantErr=missing dot in first path element
@@ -0,0 +1,3 @@
path=example.com/m
version=v2.0.0
wantErr=invalid version: should be v0 or v1, not v2
@@ -0,0 +1,9 @@
path=example.com/m
version=v1.0.0
wantErr=go.mod file not in module root directory
-- example.com/m@v1.0.0/go.mod --
module example.com/m
go 1.13
-- example.com/m@v1.0.0/sub/go.mod --
module example.com/m/sub
@@ -0,0 +1,3 @@
path=example.com/m
version=v1.0.0+bad
wantErr=version "v1.0.0+bad" is not canonical (should be "v1.0.0")
@@ -0,0 +1,9 @@
path=example.com/m
version=v1.0.0
wantErr=go.mod file not in module root directory
-- example.com/m@v1.0.0/a.go --
package a
-- example.com/m@v1.0.0/b/GO.MOD --
MODULE EXAMPLE.COM/M/B
-- example.com/m@v1.0.0/b/b.go --
package b
@@ -0,0 +1,7 @@
path=example.com/m
version=v1.0.0
wantErr=multiple entries for file "dup.go"
-- example.com/m@v1.0.0/dup.go --
package d1
-- example.com/m@v1.0.0/dup.go --
package d2
@@ -0,0 +1,7 @@
path=example.com/m
version=v1.0.0
wantErr=entry "a.go" is both a file and a directory
-- example.com/m@v1.0.0/a.go --
package a
-- example.com/m@v1.0.0/a.go/b.go --
package b
@@ -0,0 +1,3 @@
path=example.com/empty
version=v1.0.0
hash=h1:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=
@@ -0,0 +1,7 @@
path=example.com/m
version=v1.0.0
wantErr=case-insensitive file name collision: "m.go" and "M.GO"
-- example.com/m@v1.0.0/m.go --
package m
-- example.com/m@v1.0.0/M.GO --
package m
@@ -0,0 +1,5 @@
path=example.com/m
version=v1.0.0
hash=h1:Mun5l9cBlDnnV6JasTpio2aZJSbFj++h+814mnKC/OM=
-- example.com/m@v1.0.0/go.mod/a.go --
package a
@@ -0,0 +1,3 @@
path=ÿ # 0xFF
version=v1.0.0
wantErr=malformed module path "\xff": invalid UTF-8
@@ -0,0 +1,6 @@
path=example.com/m
version=v1.0.0
wantErr=example.com/m@v1.0.0: path does not have prefix "example.com/m@v1.0.0/"
-- example.com/m@v1.0.0 --
-- example.com/m@v1.0.0/go.mod --
module example.com/m
@@ -0,0 +1,22 @@
path=example.com/m
version=v1.0.0
hash=h1:tpqYOOmuilagXzyqoJ3roUjp8gneQeTv5YVpL6BG7/k=
-- example.com/m@v1.0.0/go.mod --
module example.com/m
go 1.13
-- example.com/m@v1.0.0/m.go --
package m
func Foo() int { return 42 }
-- example.com/m@v1.0.0/cmd/hello/hello.go --
package main
import (
"fmt"
"example.com/m"
)
func main() {
fmt.Println(m.Foo())
}