Comments (7)
Have you tried
# gazelle:map_kind go_binary go_image @io_bazel_rules_docker//go:image.bzl
I've been using this in my repo for a long time to great success. Where it would have generated a go_binary
it generates a go_image
imported from @io_bazel_rules_docker//go:image.bzl
.
from bazel-gazelle.
If you're looking for some inspiration, there are a couple of simple plugins that are pretty easy to work through. The easiest is one that makes a filegroup
for every file in the repo[0]. A slightly more involved one is the xlang
[1] that you can use as a sample as well.
[0] https://github.com/bazelbuild/bazel-gazelle/blob/master/internal/language/test_filegroup/lang.go
[1] https://github.com/bazelbuild/bazel-gazelle/blob/master/internal/gazellebinarytest/xlang.go
from bazel-gazelle.
This would also be useful for bazel-integration-testing's bazel_go_integration_test
from bazel-gazelle.
This would be very useful also to allow gazelle to generate predefined go_image
and container_push
targets from rules_docker together with go_binary
, instead of having to manually write those.
Any ideas on how to do that? Where to start? I would love to help.
from bazel-gazelle.
@achew22 I didn't now about that. Worked here, thanks a lot.
About container_push
, do you know if there is a similar approach or for that case we have to manually write on all targets?
from bazel-gazelle.
What would the container_push
wrap? If you want one next to every go_image
you could make a macro that has the rules_docker
go_image
in addition to a container_push
and then you'd get it at the same time. That said, macros that silently create resources that you probably want to run are suboptimal from a usability standpoint. It's very nice to be able to see all the targets that you care about explicitly listed in a BUILD
.
You could pretty easily put together a Gazelle plugin to create a container_push
automatically for every *_image
that it finds.
from bazel-gazelle.
Thanks. Yes, that was my goal: to have container_push
next to each go_image
. I will try to write a Gazelle plugin. If I succeed I will post here. It might be useful, because I didn't find anything similar to that atm.
from bazel-gazelle.
Related Issues (20)
- Tables in the documentation are difficult to read HOT 2
- Expose bazel_deps to go_deps extension HOT 1
- new gazelle v0.36.0 fails with Go sum mismatches HOT 10
- go.mod FilePath ReplaceDirective is missing when using the go-deps bzlmod extension HOT 1
- gazelle_binary fails nogo linting
- 'invalid use of internal package' in IDE in external tests HOT 4
- Failing to upgrade to gazelle 0.36 HOT 1
- Gazelle ignores several GIT_CONFIG environment variables
- Gazelle fails on macOS when using `apple_support` and go version 1.22+ HOT 7
- Cyclical Indirect Dependencies & Go.work can cause divergence HOT 1
- Add support for generated files in gazelle HOT 1
- Gazelle should extract module mappings from imported foo.MODULE.bazel files
- Passing debug_mode via go_deps to go_repository is not supported HOT 2
- Latest gazelle breaks grpc/grpc HOT 5
- Gazelle crashes in repository with MODULE but no WORKSPACE HOT 2
- `go_repository_cache` repository rule doesn't handle MacOS arm64 platform HOT 2
- How to create go_proto_library automatically
- Optimize Gazelle's filesystem walk
- gazelle:resolve_regexp should support regex in label HOT 2
- Using the repo name rules_go removes proto embed from all go_library rules HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bazel-gazelle.