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
Probably you've imported your module from some of *.go
files in github.com/USERNAME/micro-helix
as github.com/USERNAME/net
.
You must import all of subpackages (which you use in that file) by there full paths like
import (
"github.com/USERNAME/net/errors"
"github.com/USERNAME/net/proto"
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With