| 1 |
# This test verifies that line numbers are included in module import errors. |
| 2 |
# Verifies golang.org/issue/34393. |
| 3 |
|
| 4 |
go list -e -mod=mod -deps -f '{{with .Error}}{{.Pos}}: {{.Err}}{{end}}' ./main |
| 5 |
stdout '^bad[/\\]bad.go:3:8: malformed import path "š§.example.com/string": invalid char ''š§''$' |
| 6 |
|
| 7 |
# TODO(#26909): This should include an import stack. |
| 8 |
# (Today it includes only a file and line.) |
| 9 |
! go build ./main |
| 10 |
stderr '^bad[/\\]bad.go:3:8: malformed import path "š§.example.com/string": invalid char ''š§''$' |
| 11 |
|
| 12 |
# TODO(#41688): This should include a file and line, and report the reason for the error.. |
| 13 |
# (Today it includes only an import stack.) |
| 14 |
! go get ./main |
| 15 |
stderr '^go: m/main imports\n\tm/bad imports\n\tš§.example.com/string: malformed import path "š§.example.com/string": invalid char ''š§''$' |
| 16 |
|
| 17 |
|
| 18 |
-- go.mod -- |
| 19 |
module m |
| 20 |
|
| 21 |
go 1.13 |
| 22 |
|
| 23 |
-- main/main.go -- |
| 24 |
package main |
| 25 |
|
| 26 |
import _ "m/bad" |
| 27 |
|
| 28 |
func main() {} |
| 29 |
|
| 30 |
-- bad/bad.go -- |
| 31 |
package bad |
| 32 |
|
| 33 |
import _ "š§.example.com/string" |