1
0
mirror of https://github.com/golang/go synced 2024-11-25 07:57:56 -07:00
This commit is contained in:
Yuki Osaki 2021-08-13 21:51:54 +09:00
parent e166048bdb
commit e259b563fd

View File

@ -1,11 +1,27 @@
env GO111MODULE=off
! go build
stderr 'cannot find package "\." in:\n\t.WORK/gopath/src/foo'
# Control case: in GOPATH mode,
# a/a.go can import package "./b" using a relative path.
go build a/a.go
! stderr .
-- main.go --
package main
# package "a" itself cannot import "./b": "a" has a non-local
# import path, so its imports must also have non-local import paths.
! go build a
stderr '^a[/\\]a.go:3:8: local import "./b" in non-local package$'
import _ "./foo"
# package "c" imports itself, which is not allowed.
! go build c
stderr '^c[/\\]c.go:3:8: .: cannot import current directory$'
func main() {}
-- a/a.go --
package a
import _ "./b"
-- a/b/b.go --
package b
-- c/c.go --
package c
import _ "."