Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: support build output dir/platform #13

Open
automaticgiant opened this issue Mar 19, 2017 · 1 comment
Open

feature request: support build output dir/platform #13

automaticgiant opened this issue Mar 19, 2017 · 1 comment
Assignees

Comments

@automaticgiant
Copy link

automaticgiant commented Mar 19, 2017

i use something like

#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
IFS=$'\n\t'
# shellcheck disable=SC2154
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR

exec 2>&1

gofmt -e -s -w *.go

mkdir -p bin

function build {
  echo building for $GOOS-$GOARCH
  go build -o bin/controller-$GOOS-$GOARCH controller.go
}

#GOOS=android   GOARCH=arm      build
#GOOS=darwin    GOARCH=386      build
GOOS=darwin    GOARCH=amd64    build
#GOOS=darwin    GOARCH=arm      build
#GOOS=darwin    GOARCH=arm64    build
#GOOS=dragonfly GOARCH=amd64    build
#GOOS=freebsd   GOARCH=386      build
#GOOS=freebsd   GOARCH=amd64    build
#GOOS=freebsd   GOARCH=arm      build
#GOOS=linux     GOARCH=386      build
GOOS=linux     GOARCH=amd64    build
#GOOS=linux     GOARCH=arm      build
#GOOS=linux     GOARCH=arm64    build
#GOOS=linux     GOARCH=ppc64    build
#GOOS=linux     GOARCH=ppc64le  build
#GOOS=linux     GOARCH=mips64   build
#GOOS=linux     GOARCH=mips64le build
#GOOS=netbsd    GOARCH=386      build
#GOOS=netbsd    GOARCH=amd64    build
#GOOS=netbsd    GOARCH=arm      build
#GOOS=openbsd   GOARCH=386      build
#GOOS=openbsd   GOARCH=amd64    build
#GOOS=openbsd   GOARCH=arm      build
#GOOS=plan9     GOARCH=386      build
#GOOS=plan9     GOARCH=amd64    build
#GOOS=solaris   GOARCH=amd64    build
#GOOS=windows   GOARCH=386      build
GOOS=windows   GOARCH=amd64    build

it's just what i made - idk what i'm doing.

anyway, that's good for building artifacts taht i include in gh releases or whatever.
it would be super cool to add an output dir flag to zb build so i wouldn't have to backport the stuff that adds the ldflags for commit/builddate.

the goos and goarch already pass through, so i have no problem building for other platforms, but i'd like to be able to specify like --outpattern bin/%name-%GOOS-%GOARCH or something.

it's also very possible that this is doable with no modification, but idk how. perhaps this is just a docs fix.

thanks for your consideration. also i really like zb so far.

@joshuarubin
Copy link
Owner

That’s a very interesting feature request. Generally, I prefer to defer to the underlying go command for handling cross platform builds, but I do think there may be a use case here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants