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

Add support for building on and for Darwin:arm64 #73

Merged
merged 8 commits into from
Apr 21, 2021
Merged

Conversation

mhagger
Copy link
Member

@mhagger mhagger commented Apr 19, 2021

Update to Go 1.16.3, which includes support for Darwin:arm64. On the other hand, Darwin:386 is no longer supported, so remove that from the list of releases that we build.

Fixes #68

/cc @dbast, who requested this.

mhagger added 4 commits April 19, 2021 12:20
Make sure to download the Go toolchain that matches the architecture
of the host where the `Makefile` is being run.
It's no longer supported by the Go toolchain.
@dbast
Copy link
Contributor

dbast commented Apr 20, 2021

Nice. Thanks!

Calling make with system pre-installed go 1.16.3 works and the binaries also work. Also cross compiled binaries work, compiled on linux amd64 and tested on Apple M1 hardware make GOOS=darwin GOARCH=arm64.

Calling make with no pre-installed go, downloads go, but then fails with:

go: inconsistent vendoring in /home/daniel/git-sizer:
	github.com/davecgh/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/spf13/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/stretchr/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	gopkg.in/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt

	To ignore the vendor directory, use -mod=readonly or -mod=mod.
	To sync the vendor directory, run:
		go mod vendor
mkdir -p bin
/home/daniel/git-sizer/script/go build -ldflags "-X main.BuildVersion=v1.3.0-14-g57e3d3e" -o bin/git-sizer github.com/github/git-sizer
go: inconsistent vendoring in /home/daniel/git-sizer:
	github.com/davecgh/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/spf13/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	github.com/stretchr/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
	gopkg.in/[email protected]: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt

	To ignore the vendor directory, use -mod=readonly or -mod=mod.
	To sync the vendor directory, run:
		go mod vendor
make: *** [Makefile:29: bin/git-sizer] Error 1

After calling vendor/go1.16.3/go/bin/go mod vendor, make also works with the script/install-vendored-go installed go.

@dbast
Copy link
Contributor

dbast commented Apr 20, 2021

Hm... seems like some effort was put into the Makefile + shell scripts in script. Other option would be going for the setup-go + goreleaser Github actions in order to automatic compile/test/release binaries, see e.g. https://github.com/hhatto/gocloc/blob/master/.github/workflows/release.yml and other projects with similar setup.

mhagger added 4 commits April 20, 2021 18:51
Things are a lot easier nowadays!
This keeps `go test` from getting upset if there is a `vendor`
directory with a vendored Go toolchain in it.
@mhagger
Copy link
Member Author

mhagger commented Apr 20, 2021

@dbast: Thanks for the help! I just pushed some more changes to this branch that will hopefully improve things. Please let me know if this does it for you.

Copy link
Contributor

@dbast dbast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and Makefile looks much cleaner now.

@mhagger mhagger merged commit 74f4c96 into master Apr 21, 2021
@mhagger mhagger deleted the darwin-arm64-build branch April 21, 2021 08:10
@dbast
Copy link
Contributor

dbast commented Apr 21, 2021

Thanks for working on this and merging the update.

Care to tag a new minor release, which makes it easier for those who package git-sizer for various distributions? Thx!

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

Successfully merging this pull request may close these issues.

Please update to Go 1.16 and also release for macOS ARM64
3 participants