rules_go icon indicating copy to clipboard operation
rules_go copied to clipboard

don't delete go_embed_data yet

Open ribrdb opened this issue 3 years ago • 6 comments
trafficstars

We tried to migrate from using go_embed_data to go:embed and ran into an issue:

We use go_ path rules to package our code for Google App Engine. However there's a bug in the gcloud tool: it won't deploy code using go:embed when using GOPATH. https://issuetracker.google.com/issues/238368991

Would it be possible to keep go_embed_data around until this is fixed?

An alternative would be to have something like go_path that uses go modules, but that seems like a much bigger project.

ribrdb avatar Jul 11 '22 17:07 ribrdb

Would it be possible to keep go_embed_data around until this is fixed?

Unfortunately, we are only going to keep it around until the 0.35 release. We're trying to cut down the number of duplicate implementations of the same feature. Especially the ones that are implemented in the standard library.

At the point we remove it (or at any time before then) you can copy the body of this file and this file into your repo and change your load statement to read it from the first and modify the .bzl file to point at a new target that looks like this. That's all that's going on in there. It should be pretty painless to vendor and then you won't have to worry about it.

An alternative would be to have something like go_path that uses go modules, but that seems like a much bigger project.

Yeah, we've had conversations about that, but given that GOMOD is the presumptive victor we are unlikely to implement something like that. Sorry.

Happy to answer any specific questions you might have if you need some help. Cheers!

achew22 avatar Jul 12 '22 21:07 achew22

Yeah, we've had conversations about that, but given that GOMOD is the presumptive victor we are unlikely to implement something like that. Sorry.

Can you explain what you mean by that?

Since GOMOD is the presumptive victor it seems like it would be good to have a modules equivalent of go_path: ie a way to bundle up all the same code bazel would build (including generated files and bazel's hermetic dependencies) into an archive that can work with standard go tools in module mode.

ribrdb avatar Jul 12 '22 21:07 ribrdb

Go mod doesn't really work in the same way as the old go_path stuff. There isn't really a compact single directory we can make that has the same behavior. Given that, I'm not sure that there is a meaningful equivalent version of go_path.

achew22 avatar Jul 12 '22 21:07 achew22

Can't bazel generate a go.mod containing replace directives to create what ever directory structure it wants? I imagine it could be pretty similar to what go_path currently builds, with the addition of generated go.mod files.

ribrdb avatar Jul 13 '22 14:07 ribrdb

It's very possble that would work. It's been a couple of years since I really looked into this and decided it wasn't possible. Would you like to try putting together a PR?

achew22 avatar Jul 13 '22 16:07 achew22

Sure, I'll see if I can get something to work.

ribrdb avatar Jul 14 '22 20:07 ribrdb