blob: ae93b539506e6300ad52800c69440726d63e8a87 [file] [log] [blame] [view]
Hendrik Hofstadt4b0e5c02019-11-07 20:21:24 +01001##Bindata
2
3This rule uses [go-bindata](https://github.com/kevinburke/go-bindata) to package arbitrary go files.
4Please refer to the documentation there on how to use the packaged data.
5
6Generally this rule is very similar to the `bindata` rule in the default go bazel package.
7However this rule also creates an embeddable go library right away.
8
9###How to use
10
11Add the files you want to package to the `srcs` attribute, set the `package` attribute to the
12go package you want the result to be in and embed the rule into a `go_library`.
13
14####Example: Packaging sql migrations
15
16These rules package all `.sql` files into the target and make it accessible at `importpath` in the package `models`.
17```
18
19go_library(
20 name = "go_default_library",
21 embed = [
22 ":migrations_pack",
23 ],
24 importpath = "git.monogon.dev/source/nexantic.git/golibs/minijob/generated/sql",
25 visibility = ["//visibility:public"],
26)
27
28bindata(
29 name = "migrations_pack",
30 package = "models",
31 srcs = glob(["*.sql"]),
32)
33
34```