aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/mod_get_errors.txt
blob: 7ce045ff82e422fbf3ea9febf5a09c49ab31f375 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
cp go.mod go.mod.orig


# Both 'go get' and 'go get -d' should fail, without updating go.mod,
# if the transitive dependencies of the requested package (by default,
# the package in the current directory) cannot be resolved.

! go get
stderr '^example.com/m imports\n\texample.com/badimport imports\n\texample.net/oops: import missing$'  # TODO: better error message
cmp go.mod.orig go.mod

! go get -d
stderr '^example.com/m imports\n\texample.com/badimport imports\n\texample.net/oops: import missing$'  # TODO: better error message
cmp go.mod.orig go.mod

cd importsyntax


# If 'go get' fails due to a compile error (such as a syntax error),
# it should not update the go.mod file.

! go get
stderr '^..[/\\]badimport[/\\]syntaxerror[/\\]syntaxerror.go:1:1: expected ''package'', found pack$'  # TODO: An import stack would be nice.
cmp ../go.mod.orig ../go.mod


# A syntax error in a dependency prevents the compiler from needing that
# dependency's imports, so 'go get -d' should not report an error when those
# imports cannot be resolved: it has all of the dependencies that the compiler
# needs, and the user did not request to run the compiler.

go get -d
cmp ../go.mod.syntax-d ../go.mod


-- go.mod --
module example.com/m

go 1.16

replace example.com/badimport v0.1.0 => ./badimport
-- go.mod.syntax-d --
module example.com/m

go 1.16

replace example.com/badimport v0.1.0 => ./badimport

require example.com/badimport v0.1.0
-- m.go --
package m

import _ "example.com/badimport"
-- importsyntax/importsyntax.go --
package importsyntax

import _ "example.com/badimport/syntaxerror"
-- badimport/go.mod --
module example.com/badimport

go 1.16
-- badimport/badimport.go --
package badimport

import "example.net/oops"
-- badimport/syntaxerror/syntaxerror.go --
pack-age syntaxerror // sic

import "example.net/oops"