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

Compile google/protobuf/*.proto files into golang structs and add to a new package #50

Closed
bufdev opened this issue Jul 16, 2015 · 13 comments
Assignees

Comments

@bufdev
Copy link

bufdev commented Jul 16, 2015

I would be happy to do the work and commit it over, but before doing any work on this, wanted to see how open the maintainers were to it. Thoughts?

Also addresses #49

@grepory
Copy link

grepory commented Sep 15, 2015

@peter-edge Hi. Sorry for this, but I just started doing:

sed -i 's/import google_protobuf "google\/protobuf"/import google_protobuf "github.com\/peter-edge\/go-google-protobuf"/' ${proto_dir}/checker.pb.go

Because works. Let me know if I can do anything to help maintain. I'm not sure of how it might be integrated into this project, exactly. But yeah... I have this problem, too.

@grepory
Copy link

grepory commented Sep 15, 2015

Why are you so awesome? Thanks. ❤️

@chancez
Copy link

chancez commented Sep 29, 2015

This would be awesome. It would make using protobuf with Go significantly easier

@chai2010
Copy link

build type.proto failed:

protoc version:

protoc --version
libprotoc 3.0.0

error message:

protoc --go_out=. any.proto source_context.proto type.proto
google/protobuf/any.proto:94:10: "google.protobuf.Any.type_url" is already defined in file "any.proto".
google/protobuf/any.proto:97:9: "google.protobuf.Any.value" is already defined in file "any.proto".
google/protobuf/any.proto:73:9: "google.protobuf.Any" is already defined in file "any.proto".
google/protobuf/source_context.proto:46:10: "google.protobuf.SourceContext.file_name" is already defined in file "source_context.proto".
google/protobuf/source_context.proto:43:9: "google.protobuf.SourceContext" is already defined in file "source_context.proto".
type.proto: Import "google/protobuf/any.proto" was not found or had errors.
type.proto: Import "google/protobuf/source_context.proto" was not found or had errors.
type.proto:55:3: "google.protobuf.SourceContext" seems to be defined in "source_context.proto", which is not imported by "type.proto".  To use it here, please add the necessary import.
type.proto:147:3: "google.protobuf.SourceContext" seems to be defined in "source_context.proto", which is not imported by "type.proto".  To use it here, please add the necessary import.
type.proto:167:3: "google.protobuf.Any" seems to be defined in "any.proto", which is not imported by "type.proto".  To use it here, please add the necessary import.

@grepory
Copy link

grepory commented Dec 1, 2015

😽

@LK4D4
Copy link

LK4D4 commented Dec 10, 2015

It would be really nice to have those packages compiled

dsymonds added a commit that referenced this issue Feb 10, 2016
This introduces supported Go packages for each well-known type,
and a placeholder support package for interacting with them.

This commit adds Any, Duration and Empty; more types will follow.

Updates #50.
@dsymonds
Copy link
Contributor

8ea33d2 adds some initial types. I'll add more shortly.

@dsymonds
Copy link
Contributor

There's zero diff from the google/protobuf .proto files (except for adding a go_package option to make protoc-gen-go generate a good package name, which I hope to upstream).

I put them in separate Go packages since that seemed to make more sense to me, and couldn't think of compelling reasons for them to all be in the same package (their existing package declarations notwithstanding). But I'm happy to hear arguments for them all going together.

@dsymonds
Copy link
Contributor

Any arguments, @peter-edge?

@dsymonds
Copy link
Contributor

Okay, I'll leave it as I have it now. Neither approach is perfect, and we can consider changing it in the future, but the current state should be fine.

@azr
Copy link

azr commented May 16, 2017

About date/durations,

how about creating some func to get/set timestamps from golang time ?

Like func NewTimestamp(time.Time) *Timestamp and func (t *Timestamp) Time() time.Time & same for Durations ?

Directly in the timestamp pkg, I think it's fine if it's not generated.

@cybrcodr
Copy link
Contributor

I think you are looking for...
https://godoc.org/github.com/golang/protobuf/ptypes#Timestamp
https://godoc.org/github.com/golang/protobuf/ptypes#TimestampProto

Btw, I don't think your comment is related to the original issue.

@azr
Copy link

azr commented May 24, 2017

Ah, thx @cybrcodr.
I put it here bcs #49 redirects here, not that much related, yes, sry ! Cheers !

@golang golang locked as resolved and limited conversation to collaborators Jun 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants