Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bzlmod: Add macro to convert import paths to Bazel labels #1423

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Jan 20, 2023

  1. 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.
    fmeum committed Jan 20, 2023
    Configuration menu
    Copy the full SHA
    7cd8ffa View commit details
    Browse the repository at this point in the history
  2. Simplify label canonicalization

    fmeum committed Jan 20, 2023
    Configuration menu
    Copy the full SHA
    e24594c View commit details
    Browse the repository at this point in the history