mirror of
https://github.com/burrowers/garble.git
synced 2025-09-26 20:01:16 +08:00
use x/tools/cmd/bundle via go tool
The behavior is the same, but now we track the dependency in go.mod via `go get -tool`, which is a better approach. While here, make a package loading error slightly clearer.
This commit is contained in:
2
go.mod
2
go.mod
@@ -17,3 +17,5 @@ require (
|
||||
golang.org/x/sync v0.13.0 // indirect
|
||||
golang.org/x/sys v0.32.0 // indirect
|
||||
)
|
||||
|
||||
tool golang.org/x/tools/cmd/bundle
|
||||
|
4
main.go
4
main.go
@@ -436,7 +436,7 @@ func mainErr(args []string) error {
|
||||
toolexecImportPath := os.Getenv("TOOLEXEC_IMPORTPATH")
|
||||
tf.curPkg = sharedCache.ListedPackages[toolexecImportPath]
|
||||
if tf.curPkg == nil {
|
||||
return fmt.Errorf("TOOLEXEC_IMPORTPATH not found in listed packages: %s", toolexecImportPath)
|
||||
return fmt.Errorf("TOOLEXEC_IMPORTPATH package not found in listed packages: %s", toolexecImportPath)
|
||||
}
|
||||
tf.origImporter = importerForPkg(tf.curPkg)
|
||||
|
||||
@@ -1544,7 +1544,7 @@ func computePkgCache(fsCache *cache.Cache, lpkg *listedPackage, pkg *types.Packa
|
||||
// cmd/bundle will include a go:generate directive in its output by default.
|
||||
// Ours specifies a version and doesn't assume bundle is in $PATH, so drop it.
|
||||
|
||||
//go:generate go run golang.org/x/tools/cmd/bundle -o cmdgo_quoted.go -prefix cmdgoQuoted cmd/internal/quoted
|
||||
//go:generate go tool bundle -o cmdgo_quoted.go -prefix cmdgoQuoted cmd/internal/quoted
|
||||
//go:generate sed -i /go:generate/d cmdgo_quoted.go
|
||||
|
||||
// computeLinkerVariableStrings iterates over the -ldflags arguments,
|
||||
|
Reference in New Issue
Block a user