Giter Club home page Giter Club logo

Comments (7)

achew22 avatar achew22 commented on June 15, 2024 2

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.

achew22 avatar achew22 commented on June 15, 2024 1

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.

achew22 avatar achew22 commented on June 15, 2024

This would also be useful for bazel-integration-testing's bazel_go_integration_test

from bazel-gazelle.

AFMiziara avatar AFMiziara commented on June 15, 2024

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.

AFMiziara avatar AFMiziara commented on June 15, 2024

@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.

achew22 avatar achew22 commented on June 15, 2024

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.

AFMiziara avatar AFMiziara commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.