GO运行时报错: cannot find package “.“ in:

GO运行时报错: cannot find package “.“ in:,第1张

improt导入文件的时候,路径的大小写没写对。Mac下编译通过,但是docker和centos下编译不了。

===

运行如下报错:

[root@localhost ginlaravel]# go run server.go
routes/route.go:19:2: cannot find package "." in:
	/home/wwwroot/go/src/ginlaravel/app/http/Controller
routes/route.go:20:2: cannot find package "." in:
	/home/wwwroot/go/src/ginlaravel/app/http/Controller/Gen1Controller

或运行如下会报错:

[root@localhost ginlaravel]# go build -mod=mod
routes/route.go:19:2: package ginlaravel/app/http/Controller is not in GOROOT (/usr/local/go/src/ginlaravel/app/http/Controller)
routes/route.go:20:2: package ginlaravel/app/http/Controller/Gen1Controller is not in GOROOT (/usr/local/go/src/ginlaravel/app/http/Controller/Gen1Controller)

如上两个实际上是将自定义的空间命名路径大写的Http写了小写。

-

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/994529.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存