...

Text file src/cmd/go/testdata/script/mod_bad_domain.txt

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2
     3# explicit get should report errors about bad names
     4! go get appengine
     5stderr '^go: malformed module path "appengine": missing dot in first path element$'
     6! go get x/y.z
     7stderr 'malformed module path "x/y.z": missing dot in first path element'
     8
     9
    10# 'go list -m' should report errors about module names, never GOROOT.
    11! go list -m -versions appengine
    12stderr 'malformed module path "appengine": missing dot in first path element'
    13! go list -m -versions x/y.z
    14stderr 'malformed module path "x/y.z": missing dot in first path element'
    15
    16
    17# build should report all unsatisfied imports,
    18# but should be more definitive about non-module import paths
    19! go build ./useappengine
    20stderr '^useappengine[/\\]x.go:2:8: cannot find package$'
    21! go build ./usenonexistent
    22stderr '^usenonexistent[/\\]x.go:2:8: no required module provides package nonexistent.rsc.io; to add it:\n\tgo get nonexistent.rsc.io$'
    23
    24
    25# 'get -d' should be similarly definitive
    26
    27go get ./useappengine  # TODO(#41315): This should fail.
    28 # stderr '^useappengine[/\\]x.go:2:8: cannot find package$'
    29
    30! go get  ./usenonexistent
    31stderr '^go: x/usenonexistent imports\n\tnonexistent.rsc.io: cannot find module providing package nonexistent.rsc.io$'
    32
    33
    34# go mod vendor and go mod tidy should ignore appengine imports.
    35rm usenonexistent/x.go
    36go mod tidy
    37go mod vendor
    38
    39-- go.mod --
    40module x
    41
    42-- useappengine/x.go --
    43package useappengine
    44import _ "appengine" // package does not exist
    45-- usenonexistent/x.go --
    46package usenonexistent
    47import _ "nonexistent.rsc.io" // domain does not exist

View as plain text