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
Would it make sense to add a 'unix' build tag? The Go standard library has 29 files
named *_unix.go¹, 22 of these interpret the tag as
"+build darwin dragonfly freebsd linux netbsd openbsd"
one also includes plan9, one also includes windows (which is somewhat unexpected), one
does not include dragonfly, one does not include openbsd or darwin, and one is defined
as "!windows,!plan9".
I primarily see two issues with the current situation:
1) When seeing a file named *_unix.go, it's not instantly obvious what platforms it
includes. As we can see, sometimes darwin is a Unix, sometimes it's not, and in one case
even Windows is a Unix.
2) When others emulate unix as it's used by Go, they'll have to update it when new
Unixes, like dragonfly, get added
Of course the inconsistencies mentioned in 1 are also a reason not to add a unix build
tag: Various files would need to be renamed or reorganized and it might conflict with
existing interpretations by users.
Is this possible to do in Go 1.x? Is there any merit to doing it?
¹: Determined with grep "+build" $GOROOT/src/**/*_unix.go
The text was updated successfully, but these errors were encountered:
Agreed. Also related are the foo_posix.go files:
./src/pkg/net/iprawsock_posix.go
./src/pkg/net/ipsock_posix.go
./src/pkg/net/sock_posix.go
./src/pkg/net/sockopt_posix.go
./src/pkg/net/sockoptip_posix.go
./src/pkg/net/tcpsock_posix.go
./src/pkg/net/tcpsockopt_posix.go
./src/pkg/net/udpsock_posix.go
./src/pkg/net/unixsock_posix.go
./src/pkg/os/exec_posix.go
./src/pkg/os/file_posix.go
Is darwin unix? Is plan9 unix? Sometimes, but sometimes not.
I don't want to get into the business of defining what "unix" is.
Don't read too much into the file extension and let the +build lines speak for
themselves.
The text was updated successfully, but these errors were encountered: