Last active
August 14, 2023 13:24
-
-
Save jmhodges/a50ab84b13c2cd791571 to your computer and use it in GitHub Desktop.
Generating protobuf Go files with `go generate` and a vendored protobuf package (specifically, vendored with godep).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//go:generate protoc --go_out=import_prefix=github.com/your_github_acct/your_repo/Godeps/_workspace/src/:. your_proto_file.proto | |
package yourprotopkg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ pwd | |
/home/your_acct/src/github.com/your_github_acct/your_repo/ | |
$ ls | |
Godeps doc.go your_proto_file.proto | |
$ go generate . # or `go generate github.com/your_github_acct/your_repo/` | |
$ ls | |
Godeps doc.go your_proto_file.pb.go your_proto_file.proto | |
$ grep "import proto" ./your_proto_file.pb.go | |
import proto "github.com/your_github_acct/your_repo/Godeps/_workspace/src/github.com/golang/protobuf/proto" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With this, no more futzing with
godep save -r
every time you regenerate your protobufs.