Skip to content

make build-spored compiles main.go alone, not the package — build/install broken #141

Closed

Description

@scttfrdmn

Summary

make build-spored compiles cmd/spored/main.go as a single file instead of the whole package, so it fails on symbols defined in spored's sibling (platform-split) files:

$ make build-spored
go build -o bin/spored cmd/spored/main.go
cmd/spored/main.go:92:5: undefined: runAsServiceIfManaged
cmd/spored/main.go:96:2: undefined: registerPlatformCommands

cmd/spored/ has build-tag-split files — paths_other.go / paths_windows.go, shutdown_other.go / shutdown_windows.go — that define sporedLogPath, waitForShutdown, runAsServiceIfManaged, registerPlatformCommands, etc. A single-file go build can't see them.

Reproduction

make build-spored      # fails
make build             # fails (build = build-spawn + build-spored)
go build ./cmd/spored/ # works (builds the package)

Fix

In the Makefile, build the package, not the file:

-	go build -o $(BUILD_DIR)/spored cmd/spored/main.go
+	go build -o $(BUILD_DIR)/spored ./cmd/spored/

Impact / scope

Local-only. make build (and thus a from-source make install) is broken for spored. GoReleaser builds the package (.goreleaser.yaml targets ./cmd/spored, not the file), so released binaries are unaffected — which is why this went unnoticed. Found while building bin/spawn to run a Tier 1 e2e test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions