Skip to content

Commit

Permalink
Revert the signature of edit.InterpretLabel (#1156)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladmos authored Apr 13, 2023
1 parent b5478f9 commit 7044e4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion edit/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@ func InterpretLabelForWorkspaceLocation(root, target string) (buildFile, repo, p

// InterpretLabel returns the name of the BUILD file to edit, the full
// package name, and the rule. It uses the pwd for resolving workspace file paths.
func InterpretLabel(target string) (buildFile string, repo string, pkg string, rule string) {
func InterpretLabel(target string) (buildFile string, pkg string, rule string) {
buildFile, _, pkg, rule = InterpretLabelForWorkspaceLocation("", target)
return buildFile, pkg, rule
}

// InterpretLabelWithRepo returns the name of the BUILD file to edit, repo name,
// the full package name, and the rule. It uses the pwd for resolving workspace
// file paths.
func InterpretLabelWithRepo(target string) (buildFile string, repo string, pkg string, rule string) {
return InterpretLabelForWorkspaceLocation("", target)
}

Expand Down
4 changes: 2 additions & 2 deletions unused_deps/unused_deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func hasRuntimeComment(expr build.Expr) bool {
// to remove that entry from the deps attribute of the rule identified by label.
// Returns true if at least one command was printed, or false otherwise.
func printCommands(label string, deps map[string]bool) (anyCommandPrinted bool) {
buildFileName, repo, pkg, ruleName := edit.InterpretLabel(label)
buildFileName, repo, pkg, ruleName := edit.InterpretLabelWithRepo(label)
if repo != "" {
outputBase := blazeInfo(config.DefaultOutputBase)
buildFileName = fmt.Sprintf("%s/external/%s/%s", outputBase, repo, buildFileName)
Expand Down Expand Up @@ -397,7 +397,7 @@ func main() {
// https://docs.bazel.build/versions/main/cquery.html#configurations
continue
}
_, repo, pkg, ruleName := edit.InterpretLabel(label)
_, repo, pkg, ruleName := edit.InterpretLabelWithRepo(label)
blazeBin := binDir
if repo != "" {
blazeBin = fmt.Sprintf("%s/external/%s", binDir, repo)
Expand Down

0 comments on commit 7044e4b

Please sign in to comment.