You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The .go file names in the internal/cpu package have the format name_$(GOARCH)_$(GOOS).*, instead of name_$(GOOS)_$(GOARCH).*.
This is not only confusing, but the source code has to explicitly add the tag for GOARCH.
As an example for cpu_arm64_freebsd.go, the file declares:
//go:build arm64// +build arm64
The text was updated successfully, but these errors were encountered:
This is intentional. internal/cpu is special in that it shares common code along OSes in a CPU specific file (e.g. 'cpu_ppc64x.go') and there are some differences in OSes where the os specific code is called from the top level CPU specific file. As such files are grouped by GOARCH first and GOOS second.
While it might be confusing there is not much change in internal/cpu and changes are made by hand full of people and its a very internal part of the go library and not exposed outside. When forgetting to set the build tags the compilation on builders will fail so this is not silently introducing bugs if forgotten. There is a reason to keep grouping this CPU specific package in a special way. If the request is to make some linter happy I would suggest to ignore the linter.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
The
.go
file names in theinternal/cpu
package have the formatname_$(GOARCH)_$(GOOS).*
, instead ofname_$(GOOS)_$(GOARCH).*
.This is not only confusing, but the source code has to explicitly add the tag for
GOARCH
.As an example for
cpu_arm64_freebsd.go
, the file declares:The text was updated successfully, but these errors were encountered: