Reputation: 15957
I have the following project structure
.
├── README.md
├── protos
│ ├── my-proto-output.pb.go
│ └── my-proto.proto
└── grpc-backend
├── client
│ └── client.go
├── go.mod
├── go.sum
├── main.go
└── a-submodule
Inside grpc-backend/main.go I have:
package main
import (
pb "github.com/my-user/my-repo/protos"
"google.golang.org/api/option"
"google.golang.org/grpc"
)
Inside go.mod I have
go 1.13
require (
google.golang.org/api v0.14.0
google.golang.org/grpc v1.21.1
)
module github.com/my-user/my-repo/grpc-backend
However, when I run cd grpc-backend && go build
I get
go: finding github.com/my-user/my-repo latest
go: finding github.com/my-user/my-repo/protos latest
go: downloading github.com/my-user/my-repo v0.0.0-20200103231607-5a754c449f99
verifying github.com/my-user/[email protected]: github.com/my-user/[email protected]: reading https://sum.golang.org/lookup/github.com/my-user/[email protected]: 410 Gone
I don't have any tags like that, I'm in a private repo only commiting to master at the moment. Furthermore, proto's are in this same git repo under the package myrepo
.
Questions:
Did I organize this incorrectly?
Where did that version come from? It's not in go.sum
Upvotes: 0
Views: 161
Reputation: 51467
Your module does not include the protos
package, and thus, the generated grpc source. Move your go.mod
one level up, and change the module name to github.com/my-user/my-repo
so the module includes all packages.
Upvotes: 1