Skip to content

Commit

Permalink
remove xgo as it isn't compatible with go mod
Browse files Browse the repository at this point in the history
using brute force as a bridge to goreleaser
  • Loading branch information
Hilary Holz committed Jul 12, 2019
1 parent bc5a63a commit 53b2fff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,10 @@ Install mockery in your `GOPATH` then run the `scripts/regenmocks.sh` script to
To release `doctl`, you need to install:
* [xgo](https://github.com/karalabe/xgo)
* [gothub](https://github.com/itchio/gothub)
And make them available in your `PATH`. You can use `go get -u` for both of them and add your
`$GOPATH/bin` to your `PATH` so your scripts will find them.
And make it available in your `PATH`. You can use `go get -u` and add your
`$GOPATH/bin` to your `PATH` so your scripts will find it.
You will also need a valid `GITHUB_TOKEN` environment variable with access to the `digitalocean/doctl` repo. You can generate a token [here](https://github.com/settings/tokens), it needs the `public_repo` access.
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ test:

.PHONY: vendor
vendor:
@go mod tidy
@go mod vendor
go mod tidy
go mod vendor
19 changes: 7 additions & 12 deletions scripts/stage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,14 @@ mkdir -p $OUTPUT_DIR/stage $OUTPUT_DIR/release
rm -f $STAGE_DIR/doctl $STAGE_DIR/doctl.exe

if [[ -z $SKIPBUILD ]]; then
echo "building doctl with xgo"
baseFlag="-X github.com/digitalocean/doctl"
ldflags="${baseFlag}.Build=$(git rev-parse --short HEAD)"
ldflags="${ldflags} $baseFlag.Major=${major} $baseFlag.Minor=${minor} $baseFlag.Patch=${patch} $baseFlag.Label=release"
if [[ -n "$label" ]]; then
ldflags="${ldflags} $baseFlag.Label=${label}"
fi
echo "building doctl"

xgo \
--dest $OUTPUT_DIR/stage \
--targets='windows/*,darwin/amd64,linux/amd64,linux/386' \
-ldflags "$ldflags" \
-out doctl-${ver} $RELEASE_PACKAGE
# ugly, but soon to be replaced by goreleaser
GO111MODULE=on GOOS=linux GOARCH=amd64 GOFLAGS=-mod=vendor go build -o $STAGE_DIR/doctl-${ver}-linux-amd64
GO111MODULE=on GOOS=linux GOARCH=386 GOFLAGS=-mod=vendor go build -o $STAGE_DIR/doctl-${ver}-linux-386
GO111MODULE=on GOOS=darwin GOARCH=amd64 GOFLAGS=-mod=vendor go build -o $STAGE_DIR/doctl-${ver}-darwin-amd64
GO111MODULE=on GOOS=windows GOARCH=amd64 GOFLAGS=-mod=vendor go build -o $STAGE_DIR/doctl-${ver}-windows-amd64
GO111MODULE=on GOOS=windows GOARCH=386 GOFLAGS=-mod=vendor go build -o $STAGE_DIR/doctl-${ver}-windows-386
fi

cd $RELEASE_DIR
Expand Down

0 comments on commit 53b2fff

Please sign in to comment.