From 216628222f5716163bb96d3651a68feef31b090d Mon Sep 17 00:00:00 2001 From: Thomas Pelletier Date: Wed, 8 Jun 2022 18:05:42 -0400 Subject: [PATCH] Build arm + arm64 binaries for linux and windows (#790) * Build arm + arm64 binaries for linux and windows * Type MaxInt64 to avoid overflow on 32 bits arch On a 32 bits arch, math.MaxIn64 is interpreted as an int, and therefore overflows. This causes compilation to build on those platforms. --- .goreleaser.yaml | 12 ++++++++++++ marshaler.go | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 793fb184..3aa1840e 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -16,7 +16,11 @@ builds: mod_timestamp: '{{ .CommitTimestamp }}' targets: - linux_amd64 + - linux_arm64 + - linux_arm - windows_amd64 + - windows_arm64 + - windows_arm - darwin_amd64 - darwin_arm64 - id: tomljson @@ -31,7 +35,11 @@ builds: mod_timestamp: '{{ .CommitTimestamp }}' targets: - linux_amd64 + - linux_arm64 + - linux_arm - windows_amd64 + - windows_arm64 + - windows_arm - darwin_amd64 - darwin_arm64 - id: jsontoml @@ -46,7 +54,11 @@ builds: mod_timestamp: '{{ .CommitTimestamp }}' targets: - linux_amd64 + - linux_arm64 + - linux_arm - windows_amd64 + - windows_arm64 + - windows_arm - darwin_amd64 - darwin_arm64 universal_binaries: diff --git a/marshaler.go b/marshaler.go index a779be03..4eb526bb 100644 --- a/marshaler.go +++ b/marshaler.go @@ -312,7 +312,7 @@ func (enc *Encoder) encode(b []byte, ctx encoderCtx, v reflect.Value) ([]byte, e case reflect.Uint64, reflect.Uint32, reflect.Uint16, reflect.Uint8, reflect.Uint: x := v.Uint() if x > uint64(math.MaxInt64) { - return nil, fmt.Errorf("toml: not encoding uint (%d) greater than max int64 (%d)", x, math.MaxInt64) + return nil, fmt.Errorf("toml: not encoding uint (%d) greater than max int64 (%d)", x, int64(math.MaxInt64)) } b = strconv.AppendUint(b, x, 10) case reflect.Int64, reflect.Int32, reflect.Int16, reflect.Int8, reflect.Int: