Skip to content

fix(build): compile and run unit tests on darwin - #45

Open
mattmattox wants to merge 1 commit into
mainfrom
fix/a5-darwin-build
Open

mattmattox wants to merge 1 commit into
mainfrom
fix/a5-darwin-build

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

go build ./... failed on macOS because syscall.Statfs_t.Bsize is uint32 on darwin and int64 on Linux. The cast fixes the build; //nolint:unconvert keeps golangci-lint quiet on Linux where the cast is a no-op.

With the build fixed, five packages still failed on darwin for host reasons, not bugs: unix socket paths over the 104-byte limit, a wildcard-vs-specific bind that BSD allows, an interface literally named lo, loopback aliases 127.0.0.2/.3, and inotify rename semantics. Tests are made portable or skip with a reason; Linux assertions are unchanged.

Also removes the dead logpattern mock helpers and revives the commented-out memory estimation assertions. Darwin is not added to goreleaser here.

Verified on macOS: go build ./... && go vet ./... && go test -short ./...; GOOS=linux build and vet pass.

Closes #20

🤖 Generated with Claude Code

Cast statfs Bsize to int64 so pkg/monitors/system builds on macOS, where
the field is uint32. Make the unit tests portable: short unix socket
paths under the 104-byte limit, squat the wildcard address in the
Prometheus bind-failure test, discover the loopback interface name, and
skip tests that need 127.0.0.0/8 aliases or inotify rename semantics
when the host lacks them.

Remove the unused command-call tracking and testKernelPanicLog from the
logpattern mocks, and revive the memory estimation assertions that were
commented out.

Closes #20

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

test: impossible nil != nil conditions and unused symbols in logpattern test/mock files

1 participant