Skip to content

Commit

Permalink
Demo that needs a Gazelle run to happen
Browse files Browse the repository at this point in the history
If you upgrade the Gazelle dependency, this repo will need a small
change in /demo/BUILD.bazel to use `go_deployable` instead of the
standard `go_binary` which is defined in tools/go/def.bzl (as a wrapper
of go_binary.
  • Loading branch information
achew22 committed Mar 11, 2019
1 parent 957dc6c commit d73b7ce
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load("@bazel_gazelle//:def.bzl", "gazelle")

# gazelle:prefix github.com/achew22/renovatedemo
gazelle(name = "gazelle")
23 changes: 23 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "6776d68ebb897625dead17ae510eac3d5f6342367327875210df44dbe2aeeb19",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.1/rules_go-0.17.1.tar.gz"],
)

http_archive(
name = "bazel_gazelle",
sha256 = "7949fc6cc17b5b191103e97481cf8889217263acf52e00b560683413af204fcb",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.16.0/bazel-gazelle-0.16.0.tar.gz"],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")

go_rules_dependencies()

go_register_toolchains()

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")

gazelle_dependencies()
10 changes: 10 additions & 0 deletions demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

# gazelle:map_kind go_binary go_deployable //tools/go:def.bzl

go_library(
name = "go_default_library",
srcs = ["demo.go"],
importpath = "github.com/achew22/renovatedemo/demo",
visibility = ["//visibility:private"],
)
7 changes: 7 additions & 0 deletions demo/demo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "fmt"

func main() {
fmt.Printf("Hello world")
}
5 changes: 5 additions & 0 deletions tools/go/def.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary")

def go_deployable(**kwargs):
print("Wrapped go_binary")
go_binary(**kwargs)

0 comments on commit d73b7ce

Please sign in to comment.