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
