-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
protoc-gen-go: import_path flag doesn't do anything #63
Comments
PR with a proposed fix ready. We checked and it seems to be doing exactly as advertised :) |
What do you mean it isn't used? It's used in the But if you want to control the import path on a per-input basis, that's what the |
Apologies, I haven't made the connection between I thought that when I specify import proto "github.com/golang/protobuf/proto"
// discarding unused import google_api1 "mygit.com/autogen/google/api"
import google_protobuf1 "mygit.com/autogen/google/protobuf"
import base1 "mygit.com/autogen/base" (where in a file generated from Instead I get: import proto "github.com/golang/protobuf/proto"
// discarding unused import google_api1 "google/api"
import google_protobuf1 "google/protobuf"
import base1 "base" If, I use import proto "mygit.com/autogen/github.com/golang/protobuf/proto"
// discarding unused import google_api1 "mygit.com/autogen/google/api"
import google_protobuf1 "mygit.com/autogen/google/protobuf"
import base1 "mygit.com/autogen/base" So basically, there's no way to be able to say: prefix all the Go import paths that are an output of protoc. This is really useful when you use the |
The |
Currently we use Since we use the "single repo" GOPATH approach (with vendoring done through subtrees), it would be incredibly useful for us to not have to hack our way around postprocessing and have a flag that would add a Go import "base protobuf" prefix. I tried the |
I also have the same problem as @mwitkow-io. We currently are using protobufs with Python but are looking to make the move to Go for some of our services. Something like #64 would fix our problem immediately. Using the mapping parameter is possible, but a large pain for both existing and new message packages. Regarding vendoring, having this package do it's own vendoring seems counterproductive given various 3rd party vendoring tools and the |
@dsymonds any comment on maybe introducing a different |
Im currently fighting with this issue as well, however mwitkow's PR does not seems to change anything? |
Same problem here - I would like a way to change the import_prefex for the pb.go files I am generating, but leave the "github.com/golang/protobuf/proto" import alone. import_prefix changes both, which is not what I would like. |
I also have the same problem, any update here? |
Is there any resolution to this issue? |
import_path
parameter doesn't do anything
The title of this issue is clearly incorrect-- I think the underlying problem described here was addressed by #139, which permits specifying the import path for files in the There are a couple additional comments here about |
We'd like to add a
go get
like prefix to all of our generated protobuf packages.The option in
generator.go
calledPackageImportPath
seems like it should do what we want:However, that value is never used in the codebase.
The
ImportPrefix
, unfortunately, prefixes all imports, including the fullgo get
paths internal to protobufs.The text was updated successfully, but these errors were encountered: