Browse files

Compute binary name from base of directory rather than import path. (#…


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.
  • Loading branch information...
4ydx authored and dmitshur committed Sep 27, 2017
1 parent b40cd48 commit 415225646bb92c4449bb484646f2c95a98402f6f
Showing with 1 addition and 1 deletion.
  1. +1 −1 tool.go
@@ -143,7 +143,7 @@ func main() {
if len(pkgs) == 1 { // Only consider writing output if single package specified.
if pkgObj == "" {
pkgObj = filepath.Base(pkg.ImportPath) + ".js"
pkgObj = filepath.Base(pkg.Dir) + ".js"
if pkg.IsCommand() && !pkg.UpToDate {
if err := s.WriteCommandPackage(archive, pkgObj); err != nil {

0 comments on commit 4152256

Please sign in to comment.