I am trying to import utility
into github_events.go
.
utility.go
is placed in the services
directory.
utility.go
looks like this:
package utility import ( "os" "regexp" )
My project structure is as follows:
This is how to import from github_events.go
import ( "encoding/json" "fmt" "io/ioutil" "net/http" "sync" "time" "sort" "github-app/services/utility" )
I also tried using the alias utility "github-app/services/utility"
But I get the following error Unable to import github-app/services/utility (No required module provides package "github-app/services/utility") compilerbrokenimport
My go.mod
File:
module github-app go 1.18
What did i do wrong?
Just import "github-app/services".
The above is the detailed content of Import files from another directory. For more information, please follow other related articles on the PHP Chinese website!