Skip to content
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

Google's timestamppb only imported for side effects in generated file. #224

Open
raypendergraph opened this issue Jan 25, 2022 · 0 comments

Comments

@raypendergraph
Copy link

raypendergraph commented Jan 25, 2022

Just using the google.protobuf.Timestamp in a message causes timestamppb to be imported but only for side effects _ "google.golang.org/protobuf/types/known/timestamppb". This causes build errors as this package is referenced in the code when dealing with these properties. Removing the generated _ completely solves the issue but this is such a common use case I'm wondering if I'm doing something wrong.

import "google/protobuf/timestamp.proto";

message MyMessage {
    ...
     google.protobuf.Timestamp start_time = 3;
     string preferences = 4 [(gorm.field).tag = {not_null: true}];
     ...
}

Is there any way to force this to import? I'm on Go 1.17x if it's important. And building with buf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant