I have a project structure like this:
project
│
├── go.mod
├── main.go
└── adds
└── services.go
When I try to connect services.go
to main.go
, I encounter the following error:
package port/scan is not in std (/usr/local/go/src/port/scan)
Here are the details:
-
The content of my
go.mod
file is:module port go 1.22.4
-
The package declaration in
main.go
ispackage main
. -
The package declaration in
services.go
ispackage scan
.
I am trying to use the services.go
file in main.go
, but I’m having trouble with the package import. How can I resolve this issue?
New contributor
justzesil is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.