You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that when repeatedly running protoc with zap, the import order in the go code changes, despite nothing changing in the source proto files. It would be nice if it were always generating in the same order that gofmt sets.
$ protoc --zap-marshaler_out=. main.proto && cat main.zap.go
main.proto:5:1: warning: Import google/protobuf/struct.proto is unused.
main.proto:6:1: warning: Import google/protobuf/timestamp.proto is unused.
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: main.proto
package test
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "google.golang.org/protobuf/types/known/timestamppb"<<<<---- timestamp first
_ "google.golang.org/protobuf/types/known/structpb"<<<<---- structpb second
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
$ protoc --zap-marshaler_out=. main.proto && cat main.zap.go
main.proto:5:1: warning: Import google/protobuf/struct.proto is unused.
main.proto:6:1: warning: Import google/protobuf/timestamp.proto is unused.
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: main.proto
package test
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "google.golang.org/protobuf/types/known/structpb"<<<<---- structpb first
_ "google.golang.org/protobuf/types/known/timestamppb"<<<<---- timestamp second
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
The text was updated successfully, but these errors were encountered:
Hi, thanks for the project.
I noticed that when repeatedly running
protoc
with zap, the import order in the go code changes, despite nothing changing in the source proto files. It would be nice if it were always generating in the same order that gofmt sets.For example with this small proto file.
main.proto
If I run it twice, I get a diff like this.
A full log is below.
The text was updated successfully, but these errors were encountered: