Rules_go: HOW TO STOP rules_go from downloading foreign toolchains

Created on 13 Nov 2020  路  3Comments  路  Source: bazelbuild/rules_go

We want to use the system's own go toolchain in /usr/bin/go and not download anything.

It is absolutely frustrating and annoying that it is nowhere documented how to STOP rules_go from downloading a foreign go toolchain.

Every single time we use

go_binary or
go_library or
go_test

rules_go starts downloading a toolchain from https://dl.google.com/go/

We do not want that. We want to use the system's own go toolchain in /usr/bin/go and not download anything.

question

Most helpful comment

In WORKSPACE, you can use the toolchain in PATH by calling go_register_toolchains like this:

go_register_toolchains(go_version = "host")

Or you can call go_host_sdk directly before go_register_toolchains.

Please keep the Go Community Code of Conduct in mind when commenting here. I get that you're frustrated, but keep it constructive.

All 3 comments

Something as simple as this should be straight forward. But is not. It is also NOT possible to specify the version of the go toolchain. An annoying and frustrating developer experience. I lost an entire day trying to fix this.

:-1:

In WORKSPACE, you can use the toolchain in PATH by calling go_register_toolchains like this:

go_register_toolchains(go_version = "host")

Or you can call go_host_sdk directly before go_register_toolchains.

Please keep the Go Community Code of Conduct in mind when commenting here. I get that you're frustrated, but keep it constructive.

Was this page helpful?
0 / 5 - 0 ratings