blob: dc7d7ca0953ccbc2936ab7ac72cfba82f8741a60 [file] [log] [blame] [view]
Serge Bazanskibb7db922020-04-30 12:43:10 +02001Go dependency managment
2=======================
3
Serge Bazanskiee4bfdb2022-04-06 15:30:52 +02004Status: managed by [Gazelle](https://github.com/bazelbuild/bazel-gazelle).
Serge Bazanskibb7db922020-04-30 12:43:10 +02005
Serge Bazanskiee4bfdb2022-04-06 15:30:52 +02006
7 .--------.
8 | go.mod |------------.
9 '--------' |
10 | go mod tidy | bazel //:gazelle-update-repos
11 V |
12 .--------. |
13 | go.sum |-----------.|
14 '--------' |
15 V
16 .---------------------------------.
17 | third_party/go/repositories.bzl |
18 '---------------------------------'
19 | bazel run //:gazelle
20 V
21 .----------------.
22 | **/BUILD.bazel |.
23 '----------------'|
24 '----------------'
25 | bazel build //...
26 V
27 .-----------------.
28 | build artifacts |
29 '-----------------'
30
31Updating and adding new dependencies
32------------------------------------
33
34Add a Go dependency to your code, then:
35
36 $ go mod tidy
37 $ bazel run //:gazelle-update-repos
38
Serge Bazanskifdc3a242022-04-06 15:56:38 +020039All generated sources (eg. protobuf stubs) that are usually built by Bazel are invisible to go(mod)-based tooling. To get around this, we place `gomod-generated-placeholder.go` files in package directories that would otherwise contain generated files. These are ignored by Gazelle (and thus by Bazel builds) but not by go(mod)-based tooling.
Serge Bazanskiee4bfdb2022-04-06 15:30:52 +020040
41Regenerating BUILDfiles
42-----------------------
43
44 $ bazel run //:gazelle