@@ -6,6 +6,7 @@ Go rules for Bazel_
6
6
.. _Avoiding conflicts : proto/core.rst#avoiding-conflicts
7
7
.. _Bazel labels : https://docs.bazel.build/versions/master/build-ref.html#labels
8
8
.. _Bazel : https://bazel.build/
9
+ .. _Bazel Tutorial\: Build a Go Project : https://bazel.build/start/go
9
10
.. _Build modes : go/modes.rst
10
11
.. _Bzlmod : https://bazel.build/external/overview#bzlmod
11
12
.. _Go with Bzlmod : docs/go/core/bzlmod.md
@@ -14,6 +15,8 @@ Go rules for Bazel_
14
15
.. _Coverage : https://bazel.google.cn/docs/coverage
15
16
.. _Dependencies : go/dependencies.rst
16
17
.. _Deprecation schedule : https://github.com/bazelbuild/rules_go/wiki/Deprecation-schedule
18
+ .. _examples/basic_gazelle : examples/basic_gazelle
19
+ .. _examples/hello : examples/hello
17
20
.. _Gopher Slack : https://invite.slack.golangbridge.org/
18
21
.. _gopls integration : https://github.com/bazelbuild/rules_go/wiki/Editor-setup
19
22
.. _Overriding dependencies : go/dependencies.rst#overriding-dependencies
@@ -36,6 +39,7 @@ Go rules for Bazel_
36
39
.. Go rules
37
40
.. _go_binary : docs/go/core/rules.md#go_binary
38
41
.. _go_context : go/toolchains.rst#go_context
42
+ .. _go_deps : https://github.com/bazel-contrib/bazel-gazelle/blob/master/extensions.md#go_deps
39
43
.. _go_download_sdk : go/toolchains.rst#go_download_sdk
40
44
.. _go_host_sdk : go/toolchains.rst#go_host_sdk
41
45
.. _go_library : docs/go/core/rules.md#go_library
@@ -70,132 +74,6 @@ Mailing list: `bazel-go-discuss`_
70
74
71
75
Slack: `#go on Bazel Slack `_, `#bazel on Go Slack `_
72
76
73
- Announcements
74
- -------------
75
- 2024-07-19
76
- `v0.48.1 <https://github.com/bazelbuild/rules_go/releases/tag/v0.48.1 >`_
77
- is now available. This includes a bug fix (https://github.com/bazelbuild/rules_go/pull/3961).
78
-
79
- 2024-05-21
80
- `v0.48.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.48.0 >`_
81
- is now available. This release enables support for `--incompatible_enable_proto_toolchain_resolution `
82
- (https://github.com/bazelbuild/rules_go/pull/3919).
83
-
84
- 2024-05-06
85
- `v0.47.1 <https://github.com/bazelbuild/rules_go/releases/tag/v0.47.1 >`_
86
- is now available. This release includes a bug fix (https://github.com/bazelbuild/rules_go/pull/3929).
87
-
88
- 2024-04-23
89
- `v0.47.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.47.0 >`_
90
- is now available. This release includes bug fixes and enhancements.
91
-
92
- 2024-02-09
93
- `v0.46.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.46.0 >`_
94
- is now available. This release includes a change to emit Nogo facts to a separate archive, and
95
- Bzlmod support for Nogo (https://github.com/bazelbuild/rules_go/pull/3842, https://github.com/bazelbuild/rules_go/pull/3789).
96
-
97
- 2024-01-19
98
- `v0.45.1 <https://github.com/bazelbuild/rules_go/releases/tag/v0.45.1 >`_
99
- is now available. This release includes a bug fix (https://github.com/bazelbuild/rules_go/pull/3832).
100
-
101
- 2024-01-12
102
- `v0.45.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.45.0 >`_
103
- is now available. This release includes bug fixes and enhancements.
104
-
105
- 2024-01-04
106
- Release
107
- `v0.44.2 <https://github.com/bazelbuild/rules_go/releases/tag/v0.44.2 >`_
108
- is now available. This includes two bug fixes (https://github.com/bazelbuild/rules_go/pull/3808 and https://github.com/bazelbuild/rules_go/pull/3810) with
109
- the test timeout handler.
110
-
111
- 2023-12-29
112
- Release
113
- `v0.44.1 <https://github.com/bazelbuild/rules_go/releases/tag/v0.44.1 >`_
114
- is now available. This release reverts a forced upgrade (https://github.com/bazelbuild/rules_go/pull/3803) of genproto from
115
- `v0.44.0 `.
116
-
117
- 2023-12-15
118
- Release
119
- `v0.44.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.44.0 >`_
120
- is now available. This release adds a stacktrace when a test times out and
121
- adds support for nogo in Bzlmod.
122
-
123
- 2023-11-20
124
- Release
125
- `v0.43.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.43.0 >`_
126
- is now available. This release fixes a couple bugs and upgrades `x/tools `
127
- to the latest version.
128
-
129
- 2023-09-28
130
- Release
131
- `v0.42.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.42.0 >`_
132
- is now available. This release fixes a couple bugs and adds support for
133
- patching the standard library.
134
-
135
- 2023-07-10
136
- Release
137
- `v0.41.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.41.0 >`_
138
- is now available. rules_go no longer ship with `@go_googleapis ` repo.
139
- It requires Gazelle v0.32.0 or later.
140
-
141
- 2023-06-28
142
- Release
143
- `v0.40.1 <https://github.com/bazelbuild/rules_go/releases/tag/v0.40.1 >`_
144
- is now available. This release fixes a couple bugs in
145
- the go packages driver that were introduced in 0.40.0.
146
-
147
- 2023-06-22
148
- Release
149
- `v0.40.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.40.0 >`_
150
- is now available. This release includes support for `//nolint ` parsing,
151
- as well as a large set of additional changes. Please check the release notes
152
- for details.
153
-
154
- 2023-03-27
155
- Release
156
- `v0.39.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.39.0 >`_
157
- is now available. This release includes a simpler interface for Bzlmod
158
- `go_sdk ` registration, makes the `//go ` tool available to users, and
159
- fixes various bugs.
160
-
161
- 2022-12-06
162
- Release
163
- `v0.37.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.37.0 >`_
164
- is now available. This release includes support for generated code in
165
- the packages driver as well as various bugfixes.
166
-
167
- 2022-11-22
168
- Release
169
- `v0.36.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.36.0 >`_
170
- is now available. This release adds a Go library to look up runfiles, and
171
- two command line flags to pass additional compiler and linker options.
172
-
173
- 2022-09-11
174
- Release
175
- `v0.35.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.35.0 >`_
176
- is now available. This release supports switching Go SDK version from a
177
- build flag. Starting this release, rules_go requires Bazel 5.1.0, because
178
- it needs to read CPU architecture from Bazel to better support Apple M1
179
- with Rosetta translation.
180
-
181
- 2022-07-19
182
- Release
183
- `v0.34.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.34.0 >`_
184
- is now available. This release brings very experimental support for bzlmod,
185
- several improvements to nogo and gopackagesdriver.
186
-
187
- 2022-06-06
188
- Release
189
- `v0.33.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.33.0 >`_
190
- is now available. This release consists mostly of bug fixes and deprecates
191
- the `asm `, `compile `, `cover `, and `pack ` actions on `go_context `.
192
- 2022-05-11
193
- Release
194
- `v0.32.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.32.0 >`_
195
- is now available. This adds `gomock ` to rules_go and supports lcov format
196
- for code coverage report, as well as a long list of other changes listed
197
- in the release notes.
198
-
199
77
Contents
200
78
--------
201
79
@@ -236,6 +114,7 @@ Documentation
236
114
* `go_context `_
237
115
238
116
* `Extra rules <docs/go/extras/extras.md >`_
117
+
239
118
* `gomock `_
240
119
241
120
* `nogo build-time static analysis `_
@@ -251,15 +130,16 @@ Quick links
251
130
Overview
252
131
--------
253
132
254
- The rules are in the beta stage of development. They support:
133
+ These rules support:
255
134
256
135
* Building libraries, binaries, and tests (`go_library `_, `go_binary `_,
257
136
`go_test `_)
137
+ * Go modules via `go_deps `_.
258
138
* Vendoring
259
139
* cgo
260
140
* Cross-compilation
261
141
* Generating BUILD files via gazelle _
262
- * Build-time code analysis via nogo _
142
+ * Build-time static code analysis via nogo _
263
143
* `Protocol buffers `_
264
144
* Remote execution
265
145
* `Coverage `_
@@ -273,7 +153,7 @@ They currently do not support or have limited support for:
273
153
The Go rules are tested and supported on the following host platforms:
274
154
275
155
* Linux, macOS, Windows
276
- * amd64
156
+ * amd64, arm64
277
157
278
158
Users have reported success on several other platforms, but the rules are
279
159
only tested on those listed above.
@@ -286,9 +166,6 @@ The ``master`` branch is only guaranteed to work with the latest version of Baze
286
166
Setup
287
167
-----
288
168
289
- System setup
290
- ~~~~~~~~~~~~
291
-
292
169
To build Go code with Bazel, you will need:
293
170
294
171
* A recent version of Bazel.
@@ -301,15 +178,18 @@ You normally won't need a Go toolchain installed. Bazel will download one.
301
178
See `Using rules_go on Windows `_ for Windows-specific setup instructions.
302
179
Several additional tools need to be installed and configured.
303
180
304
- Initial project setup
305
- ~~~~~~~~~~~~~~~~~~~~~
181
+ If you're new to Bazel, read `Bazel Tutorial: Build a Go Project `_, which
182
+ introduces Bazel concepts and shows you how to set up a small Go workspace to
183
+ be built with Bazel.
184
+
185
+ For a quicker "hello world" example, see `examples/hello `_.
186
+
187
+ For an example that generates build files and retrieves external dependencies
188
+ using Gazelle, see `examples/basic_gazelle `_.
306
189
307
- There are two ways to setup:
190
+ For more detailed ` Bzlmod `_ documentation, see ` Go with Bzlmod `_.
308
191
309
- * With Bazel's external dependency management system `Bzlmod `_,
310
- refer to the dedicated `Go with Bzlmod `_ guide.
311
- * With the older ``WORKSPACE `` dependency file, refer to the
312
- `Go with WORKSPACE `_ setup docs.
192
+ For legacy ``WORKSPACE `` instructions, see `Go with WORKSPACE `_.
313
193
314
194
FAQ
315
195
---
0 commit comments