summaryrefslogtreecommitdiffstats
path: root/src/cmd/go/testdata/script/vet_internal.txt
blob: 85f709302c893588125eb31f232f039a0de675f5 (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
70
71
env GO111MODULE=off

# Issue 36173. Verify that "go vet" prints line numbers on load errors.

! go vet a/a.go
stderr '^package command-line-arguments\n\ta[/\\]a.go:5:3: use of internal package'

! go vet a/a_test.go
stderr '^package command-line-arguments \(test\)\n\ta[/\\]a_test.go:4:3: use of internal package'

! go vet a
stderr '^package a\n\ta[/\\]a.go:5:3: use of internal package'

go vet b/b.go
! stderr 'use of internal package'

! go vet b/b_test.go
stderr '^package command-line-arguments \(test\)\n\tb[/\\]b_test.go:4:3: use of internal package'

! go vet depends-on-a/depends-on-a.go
stderr '^package command-line-arguments\n\timports a\n\ta[/\\]a.go:5:3: use of internal package'

! go vet depends-on-a/depends-on-a_test.go
stderr '^package command-line-arguments \(test\)\n\timports a\n\ta[/\\]a.go:5:3: use of internal package a/x/internal/y not allowed'

! go vet depends-on-a
stderr '^package depends-on-a\n\timports a\n\ta[/\\]a.go:5:3: use of internal package'

-- a/a.go --
// A package with bad imports in both src and test
package a

import (
  _ "a/x/internal/y"
)

-- a/a_test.go --
package a

import (
  _ "a/x/internal/y"
)

-- b/b.go --
// A package with a bad import in test only
package b

-- b/b_test.go --
package b

import (
  _ "a/x/internal/y"
)

-- depends-on-a/depends-on-a.go --
// A package that depends on a package with a bad import
package depends

import (
  _ "a"
)

-- depends-on-a/depends-on-a_test.go --
package depends

import (
  _ "a"
)

-- a/x/internal/y/y.go --
package y