Skip to content

Commit 4152256

Browse files
4ydxdmitshur
authored andcommitted
Compute binary name from base of directory rather than import path. (#702)
When building a package that lies outside of a GOPATH, its import path will be local, and its base might be unsuitable for figuring out the binary name. Instead, use the base of the absolute path to the directory where the package is located. Do so even for packages that are inside a GOPATH workspace. It should produce identical results. As of right now, there are no known cases where that's not true, but if any are discovered and reported, we can fall back to using base of import path as long as build.IsLocalImport(pkg.ImportPath) returns false. Fixes #699.
1 parent b40cd48 commit 4152256

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func main() {
143143
}
144144
if len(pkgs) == 1 { // Only consider writing output if single package specified.
145145
if pkgObj == "" {
146-
pkgObj = filepath.Base(pkg.ImportPath) + ".js"
146+
pkgObj = filepath.Base(pkg.Dir) + ".js"
147147
}
148148
if pkg.IsCommand() && !pkg.UpToDate {
149149
if err := s.WriteCommandPackage(archive, pkgObj); err != nil {

0 commit comments

Comments
 (0)