Skip to content

build.sh uses GNU-only date --utc and arch — fails for macOS/BSD contributors #37

@dolph

Description

@dolph

What breaks

build.sh is the documented local build entrypoint. Two lines are GNU coreutils–specific:

# build.sh:11-12
BUILD_DATE="$(date --utc)"
BUILD_ARCH="$(arch)"

On macOS (BSD userland):

  • date --utcdate: illegal option -- - (BSD date uses -u).
  • arch exists but reports i386/arm64 instead of GNU x86_64/aarch64, leading to inconsistent BuildArch strings in version output across hosts.

On *BSD: same date issue.
On Windows: there is no bash shell to run build.sh at all — but go build itself works (release.yml uses go build directly with the same -ldflags, which is already portable).

Suggested fix

Replace with POSIX-portable equivalents:

BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
BUILD_ARCH="$(uname -m)"

Both work identically on GNU, BSD/macOS, and Alpine/busybox. As a bonus, the ISO-8601 timestamp matches what release.yml:97 already produces (date --utc --iso-8601=seconds), so version strings become consistent between local and CI builds.

Scope is small — this is purely about letting contributors on macOS run the project's own build script.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions