Skip to content

Fix compile error on Darwin platforms#930

Closed
maryis wants to merge 2 commits intodevfrom
fix-compile-error-on-darwin
Closed

Fix compile error on Darwin platforms#930
maryis wants to merge 2 commits intodevfrom
fix-compile-error-on-darwin

Conversation

@maryis
Copy link

@maryis maryis commented Feb 17, 2026

This is a fix to desolve build failure on macOS target due to duplicate getSendQueueLen definition after adding sockio_bsd.go

Description

After adding sockio_bsd.go, builds targeting macOS (darwin) fail with a duplicate symbol error:

sockio_darwin.go:28:6: getSendQueueLen redeclared in this block

Root Cause

sockio_bsd.go includes the following build constraint:

//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd netbsd openbsd solaris
Because darwin is included in this build tag, sockio_bsd.go is compiled when GOOS=darwin.

At the same time, sockio_darwin.go is also compiled (due to the _darwin.go filename suffix).

Both files define:

func getSendQueueLen(...)

As a result, when building for macOS (including cross-compilation, e.g. arm64 Big Sur bottles), both files are included in the same package, causing a redeclaration error.

Reproduction

Build the package with:

GOOS=darwin GOARCH=arm64 go build ./...

Expected Behavior

Only one platform-specific implementation of getSendQueueLen should be compiled per target OS.

Suggested Fix

If sockio_bsd.go is not intended to apply to macOS, remove darwin from its build constraint:

@CLAassistant
Copy link

CLAassistant commented Feb 17, 2026

CLA assistant check
All committers have signed the CLA.

@maryis maryis closed this Feb 17, 2026
@maryis maryis reopened this Feb 17, 2026
@maryis
Copy link
Author

maryis commented Feb 17, 2026

closed

@maryis maryis closed this Feb 17, 2026
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.

2 participants