I feel like this is probably an over-asked question on SO yet here it is again. I'm finding this simple task incredibly tedious in Go. Note that I have GO11MODULES set to ON, I'm not sure if this effects the whole package system (it shouldn't is what I'm assuming).
I have a package called "users" which contains a compiled Protocol Buffer (from a .proto file). I want to store it alongside a number of other definitions in a folder called protos
. So that my structure looks like so:
- main.go
- protos
- users.go
- users.proto
- analytics.go
- analytics.proto
Pretty simple structure. Within the users.go file I'm defining package protos
. Within main.go I'd like to import users "protos/users"
. When I do so I get this: build command-line-arguments: cannot load protos/users: cannot find module providing package protos/users
.
I've followed (I think) other sample code that has done the same thing. Note that the folder structure is within $GOPATH/src/myapi
.
Why is this more complicated than its proving to be?