forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[internal] Stop setting
import_path="main"
for Go packages (pantsbu…
…ild#13113) Given a project with `module = example.com/foo` in `go.mod`, and `hello.go` with `package main` in it, `go list -json` will report the `ImportPath` as `example.com/foo`, _not_ `main`. So it was wrong for us to be overriding the `import_path` to be `main`. This is important for dependency inference to work properly when there are multiple `go.mod`s in the project. Dependency inference maps import paths to targets, and we'd have ambiguity if there were multiple `main` import paths. This also fixes our calculation of `import_path` to not include a `/` suffix when the `package` is in the same directory as the `go.mod`, i.e. we should use `example.com/foo`, not `example.com/foo/`. [ci skip-rust] [ci skip-build-wheels]
- Loading branch information
1 parent
45d376b
commit 8f918bf
Showing
6 changed files
with
28 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
go_package( | ||
import_path="github.com/toolchainlabs/toolchain/src/go/src/toolchain/pants_test/bar", | ||
) | ||
go_package() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
package bar | ||
|
||
import "github.com/google/uuid" | ||
|
||
func GenUuid() string { | ||
return uuid.NewString() | ||
} | ||
|
||
func Quote(s string) string { | ||
return ">> " + s + " <<" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters