bzlmod: Add macro to convert import paths to Bazel labels
With the new `go` helper macro provided by the `go_deps` module
extension, users can optionally specify their external Go dependencies
in `deps` lists using their Go import paths rather than Bazel labels.
For example, to depend on `github.com/stretchr/testify/require`, users
can add either of the following to the `deps` of a `go_*` rule after
loading the `go` macro from `@go_deps//:def.bzl`:
- `"@com_github_stretchr_testify//require"` (old)
- `go("github.com/stretchr/testify/require")` (new)
When users specify an import path that isn't provided by a
`go_repository`, they are shown the Go command that fetches the missing
dependency (assuming they are already using `go_deps.from_file`).
Note: This commit does *not* add support for this new deps format to
Gazelle itself.
5 files changed