Closed
Conversation
Author
|
closed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: