I am trying to create a microservice application, which depends on my net
module which contains general errors (so i don't have to "replicate" them across all of my modules).
The issue is that for some reason it is able to find the module, but then telling me that the modules has no package (the net
module does not have the main.go
file, since it is just a group of files which are used across other projects)
go: finding github.com/USERNAME/net latest
build github.com/USERNAME/micro-helix: cannot load github.com/USERNAME/net: module github.com/USERNAME/net@latest found (v0.0.0-20191209010811-97a65ac0928c), but does not contain package github.com/USERNAME/net
And here is the go.mod
file containing all the necessary requirements (as far as i am concerned):
module github.com/USERNAME/micro-helix
go 1.13
require (
github.com/USERNAME/net v0.0.0-20191209010811-97a65ac0928c
github.com/USERNAME/service v0.0.0-20191209005400-57ee0eb02082
github.com/golang/protobuf v1.3.2
github.com/hashicorp/consul/api v1.3.0 // indirect
github.com/micro/go-micro v1.17.1
github.com/micro/go-plugins v1.5.1 // indirect
github.com/nats-io/nats-streaming-server v0.16.2 // indirect
github.com/nats-io/stan.go v0.5.2 // indirect
github.com/nicklaw5/helix v0.5.4
github.com/spf13/viper v1.5.0 // indirect
)
The go.mod
file for the net
module is as simple as:
module github.com/USERNAME/net
go 1.13
If you need any further clarification, i am here to provide. I know that this might be some rookie mistake (misconfiguration) but this is my first week actually trying to write something in Go.
Update #1
This is the structure of the github.com/USERNAME/net
module
/-
errors/
- error.go // github.com/USERNAME/net/errors
- code.go // github.com/USERNAME/net/errors
proto/
- error.pb.go // github.com/USERNAME/net/proto
- response.pb.go // github.com/USERNAME/net/proto
errors.proto
go.mod // module github.com/USERNAME/net
response.proto
net
declare? – Cornetistnet
module, i hope it helps, if not, could you please elaborate on your question as i am a bit confused – Ridgleynet
module and pushed it to github, then i moved to the other application which is using thenet
, and i've installed it using thego get -u github.com/USERNAME/net
, the thing is, second application is perfectly fine with importing the files (i can Shift + RClick on the file name in Goland and go the thenet
implementation), but the build fails with the error in the question – Ridgleyerrors.go
haspackage errors
. Do you import this asgithub.com/username/net/errors
? – Cornetistpackage errors
– Ridgleygo build
– Ridgleyversion.env
file to see if i am actually getting latest version from the github and not the local cached one – Ridgleyreplace
in thego.mod
works just fine, issue arises only when i am trying to load modules from git – Ridgleyimport "github.com/USERNAME/net"
, which isn't going to work sincegithub.com/USERNAME/net
contains no Go source files. I would search all your source forgithub.com/USERNAME/net
and make sure you aren't trying to import that directly anywhere, that you're only importing packages under it. – Sporophyll