Error in go running: cannot find package “

When the file is imported, the case of the path is not correct. It was compiled under Mac, but not under docker and CentOS.

===

An error is reported in the operation as follows:

[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

Or an error will be reported when running as follows:

[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)

In fact, the above two are written in lowercase for the uppercase HTTP of the custom space naming path.

Read More: