aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2018-01-13 12:00:43 -0800
committerLibravatar Terin Stock <terinjokes@gmail.com>2018-01-13 12:22:05 -0800
commit1b00c7f6f4330cbf723b3df316dbd92ac89cf58f (patch)
tree5ae05193f96a601f640400c00d30fde14bc81c4c
parentfix(main): include platform in error messages (diff)
downloadbakelite-1b00c7f6f4330cbf723b3df316dbd92ac89cf58f.tar.xz
feat(main): include ".exe" when building for Windows
When the platform OS is Windows, the output file name should be appended with ".exe" to match behavior with 'go build', and to allow the executable to be ran.
-rw-r--r--main.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/main.go b/main.go
index 428946f..ece5f12 100644
--- a/main.go
+++ b/main.go
@@ -109,7 +109,8 @@ Bakelite compiles the packages named by the import paths for multiple GOOS and
GOARCH combinations. It does not install their results.
When compiling a package, Bakelite writes the result to output files named
-after the source directory in the form "$package_$goos_$goarch".
+after the source directory in the form "$package_$goos_$goarch". The '.exe'
+suffix is added when writing a Windows executable.
Multiple packages may be given to Bakelite, the result of each are saved as
described in the preceding paragraph.
@@ -173,6 +174,10 @@ See also: go build, go install, go clean.
func build(ctx context.Context, platform Platform, pkg string) error {
name := fmt.Sprintf("%s-%s-%s", filepath.Base(pkg), platform.OS, platform.Arch)
+ if platform.OS == OS_WINDOWS {
+ name += ".exe"
+ }
+
env := kvs{
"GOOS": string(platform.OS),
"GOARCH": string(platform.Arch),