Protobuf: protoc-gen-go: emit versioning information

Created on 21 Feb 2018  路  14Comments  路  Source: golang/protobuf

The generator currently emits the following:

// Code generated by protoc-gen-go. DO NOT EDIT.
// source: extension_user/extension_user.proto

We should improve this by adding information about the versions:
1) What go toolchain was used (e.g., go1.9.6)
2) What version of protoc was used (e.g., libprotoc 3.5.1)
3) What version of protoc-gen-go was used

The 3rd item is harder to do, but the upcoming version control features in the Go toolchain will help with this. My understanding is that one of the features it will provide is a cryptographic signing of all the Go packages that went into building that binary.

For now, I would be happy to just see items 1 and 2 start being encoded in the generated infolog.

Most helpful comment

@dsnet Any update on this?

All 14 comments

Furthermore, any special options passed to protoc-gen-go should probably be provided in that log. For example, whether the grpc plugin is used.

Related: #384

If we do this, we should also make "make regenerate" produce an error when run with the "wrong" (non-canonical) version of the toolchain.

If we do this, we should also make "make regenerate" produce an error when run with the "wrong" (non-canonical) version of the toolchain.

That sounds fine to me. However, I don't think that's this issue, but what @tamird is trying address in #521.

If it wasn't clear, this issue should address both generated code and also provide a command-line flag to check this information, but we will wait for vgo support before doing this.

What is the status on the command line flag?

Still blocked on golang/go#26404, which is slated for release in Go1.12.

Sounds like it is unblocked now, with go 1.12 released & golang/go#24604 closed?

Any updates on this?

@dsnet Any update on this?

@dsnet any update on this?

This is already resolved in the v2 branch. The v2 release is targeting end of Q1.

This is fixed in the v1.20.0 release of protoc-gen-go.

$ ./protoc-gen-go --version
protoc-gen-go v1.20.0
Was this page helpful?
0 / 5 - 0 ratings