-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Support protobufs under gopherjs #154
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
Comments
I think |
@bradfitz that then becomes a new convention. I'm not opposed, but I would like to see App Engine adhere to the convention if we go down that road. |
I side with @bradfitz |
And that we add support for it wherever appropriate? |
The "apppengine" build tag doesn't mean "avoid unsafe". It means code that is suitable for running on App Engine. Sometimes that means "version of code that doesn't use unsafe". Sometimes that means "version of code that doesn't use syscall". Sometimes that means "version of code that uses the urlfetch API". There's a panoply of meaning, but they are all about the App Engine environment specifically. I don't know anything about GopherJS. Is avoiding "unsafe" the only aspect for which one might want a build tag? Or is there going to be other things? |
I don't know. But is that relevant here? The distinction between I'd like to either make the same concession for GopherJS or establish a new convention that we can use in its place. @robpike and @bradfitz seem keen to establish a new convention. I don't care either way. I am happy to do the work either way. I just need a decision. |
If we're talking about a new build tag that's going to be used as a new convention, the semantics matter. App Engine isn't going to follow along with a simple "unsafe" vs. "safe" distinction since (a) that only captures one part of the environmental difference, and (b) isn't necessarily a permanent or fundamental distinction. I would much rather see "js" or "gopherjs" or whatever than trying to reform the world and make "safe"/"unsafe" happen, plus all the other aspects that would need to be split out. |
App Engine doesn't have to follow along. We don't have to change the I'd like to just add the |
A |
I agree that Creating a new convention of using In short, I agree with this (and everything else that was said above):
Based on @neelance's response above, it sounds like he's happy to have GopherJS use the |
@dsymonds To answer your question, from what I know about protobuf, I don't expect there to be anything else needed to achieve working functionality (with about 80-95% certainty). |
@shurcooL: My question isn't protobuf-specific. It's asking if GopherJS might want to select between files for other reasons, in places other than protobuf. Might some library somewhere want to switch out code when it is being built by GopherJS? Is that going to be only ever due to using "unsafe"? |
GopherJS compiles for a pretty specific To give a concrete example of that being done, take a look at this package's 2 .go files: https://github.com/goxjs/websocket It has If you want a more complex example with 3 sets of build constraints (targeting desktop OSes, mobile OSes, and browsers), you can look at https://github.com/goxjs/gl. |
Oh, so there's already "js" as a build tag for this? Sounds like we should just be following along with that. |
Yes. It's explained here. It's not necessarily specific to GopherJS, but rather to the fact its executable output is JavaScript code (that can run in environments that can only execute JavaScript code). |
Okay, I'll cave. That's a satisfactory argument for using |
(... but I'd still prefer |
This might also be useful |
So, @dsymonds should I prepare a pull request? Or is there a better way to contribute to this repo? (It has no |
Make it internally and I'll push it out. This repo isn't really geared for taking contributions. |
Like App Engine, gopherjs does not support package
unsafe
.The work-around on App Engine is to provide a slower, reflection-based version of the protobuf codec that is only built when the
appengine
build tag is specified.I propose adding the
js
build tag (specified when building Go code withgopherjs
) to thepointer_reflect.go
andpointer_unsafe.go
files alongside theappengine
tag.Any objections?
cc @dsymonds @robpike
The text was updated successfully, but these errors were encountered: