[GH-ISSUE #19] Makefile hardcodes GOOS and GOARCH despite not requiring CGO #2

Closed
opened 2026-02-26 18:43:07 +03:00 by kerem · 0 comments
Owner

Originally created by @unclesp1d3r on GitHub (Aug 3, 2025).
Original GitHub issue: https://github.com/devnullvoid/pvetui/issues/19

Originally assigned to: @devnullvoid on GitHub.

Issue Description

The Makefile currently hardcodes the following build parameters:

# Go configuration
GO_VERSION := 1.24.2
GOOS := linux
GOARCH := amd64

These are used in the build target (line 31) with CGO_ENABLED=0, which means the application doesn't use CGO and should be able to build natively on any supported Go platform.

Problem

This makes development and testing more difficult on non-Linux platforms (e.g., macOS, Windows) because:

  1. The make build command always tries to cross-compile for Linux/amd64 regardless of the host platform
  2. Users on other platforms can't easily build native binaries for testing
  3. The hardcoded values serve no functional purpose since CGO is disabled

Expected Behavior

Since the application uses CGO_ENABLED=0 and doesn't appear to have any OS-specific dependencies, the Makefile should:

  1. Build for the host platform by default (or allow GOOS and GOARCH to be detected automatically)
  2. Allow users to override these values via environment variables if cross-compilation is needed
  3. Only hardcode these values if there's a specific technical requirement

Suggested Solution

Replace the hardcoded values with something like:

# Go configuration - default to host platform, allow override
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)

Or simply remove the explicit GOOS=$(GOOS) GOARCH=$(GOARCH) from the build command and let Go use its defaults.

Environment

  • Host Platform: macOS (but affects all non-Linux platforms)
  • Go Version: 1.24.2 (as specified in go.mod)
  • Issue affects: make build target primarily

Additional Context

The release-build target (lines 264-272) correctly builds for multiple platforms explicitly, so there's already precedent for multi-platform builds in the Makefile. The issue is specifically with the default build target forcing Linux/amd64.

Originally created by @unclesp1d3r on GitHub (Aug 3, 2025). Original GitHub issue: https://github.com/devnullvoid/pvetui/issues/19 Originally assigned to: @devnullvoid on GitHub. ## Issue Description The Makefile currently hardcodes the following build parameters: ```makefile # Go configuration GO_VERSION := 1.24.2 GOOS := linux GOARCH := amd64 ``` These are used in the `build` target (line 31) with `CGO_ENABLED=0`, which means the application doesn't use CGO and should be able to build natively on any supported Go platform. ## Problem This makes development and testing more difficult on non-Linux platforms (e.g., macOS, Windows) because: 1. The `make build` command always tries to cross-compile for Linux/amd64 regardless of the host platform 2. Users on other platforms can't easily build native binaries for testing 3. The hardcoded values serve no functional purpose since CGO is disabled ## Expected Behavior Since the application uses `CGO_ENABLED=0` and doesn't appear to have any OS-specific dependencies, the Makefile should: 1. Build for the host platform by default (or allow `GOOS` and `GOARCH` to be detected automatically) 2. Allow users to override these values via environment variables if cross-compilation is needed 3. Only hardcode these values if there's a specific technical requirement ## Suggested Solution Replace the hardcoded values with something like: ```makefile # Go configuration - default to host platform, allow override GOOS ?= $(shell go env GOOS) GOARCH ?= $(shell go env GOARCH) ``` Or simply remove the explicit `GOOS=$(GOOS) GOARCH=$(GOARCH)` from the build command and let Go use its defaults. ## Environment - **Host Platform**: macOS (but affects all non-Linux platforms) - **Go Version**: 1.24.2 (as specified in go.mod) - **Issue affects**: `make build` target primarily ## Additional Context The `release-build` target (lines 264-272) correctly builds for multiple platforms explicitly, so there's already precedent for multi-platform builds in the Makefile. The issue is specifically with the default `build` target forcing Linux/amd64.
kerem 2026-02-26 18:43:07 +03:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pvetui#2
No description provided.