##### **go env 关键数据是这样的 **
###### **GOPATH="/home/zzy/goProject"**
###### **GOROOT="/usr/local/go"**
###### 项目目录是这样的
```
goProject
├── bin
├── pkg
└── src
└── go_learn
└── day01
├── hello
│ ├── hello
│ └── hello.go
└── str_type
├── str.go
└── world.go
```
##### hello.go我的代码是这样的
```
package main
import (
"fmt"
"go_learn/day01/str_type/world" ## 这句导入包,一直报错
)
func main() {
fmt.Print("hello world")
test()
}
```
##### world.go代码是这样的
```
package main
import "fmt"
func test() {
fmt.Print("啦啦啦啦")
}
```
###### go build 报错是这样的
```
$ go build
hello.go:5:2: cannot find package "go_learn/day01/str_type/world" in any of:
/usr/local/go/src/go_learn/day01/str_type/world (from $GOROOT)
/home/zzy/goProject/src/go_learn/day01/str_type/world (from $GOPATH)
```
##### 我自己查路径,是有world 包的
##### 求 大神解释,感觉是很简单的问题啊,自己太菜了
<a href="/user/BlackBerryX" title="@BlackBerryX">@BlackBerryX</a> 恩恩,对,这个我也改了,现在可以运行了,谢谢你哇
#16
更多评论