-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Closed
Copy link
Labels
ExpertNeededFrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-DarwinOS-DragonflyOS-FreeBSDOS-NetBSDOS-OpenBSD
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.12.1 openbsd/amd64
Does this issue reproduce with the latest release?
Yes. It's still in the code in HEAD.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GOARCH="amd64" GOBIN="" GOCACHE="/home/thompa/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="openbsd" GOOS="openbsd" GOPATH="/home/thompa/go" GOPROXY="" GORACE="" GOROOT="/usr/local/go" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/openbsd_amd64" GCCGO="gccgo" CC="cc" CXX="c++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build396939324=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Tried to build this on OpenBSD, which builds fine on Linux:
package main
import (
"fmt"
"golang.org/x/sys/unix"
"syscall"
)
type s func(n int, r, w, e *syscall.FdSet, timeout *syscall.Timeval) (int, error)
type s2 func(n int, r, w, e *unix.FdSet, timeout *unix.Timeval) (int, error)
func main() {
var t s
t = syscall.Select
var t2 s2
t2 = unix.Select
fmt.Println("Hello, playground", t, t2)
}
What did you expect to see?
Since OpenBSD has the same POSIX semantics for Select, as far as I know, as Linux, I expect the same function prototype and for the example above to successfully build.
What did you see instead?
On OpenBSD (and Mac, and all BSDs?) the above fails to build because syscall.Select and unix.Select only return error, not (int, error).
$ go build t.go
# command-line-arguments
./t.go:14:4: cannot use syscall.Select (type func(int, *syscall.FdSet, *syscall.FdSet, *syscall.FdSet, *syscall.Timeval) error) as type s in assignment
./t.go:17:5: cannot use unix.Select (type func(int, *unix.FdSet, *unix.FdSet, *unix.FdSet, *unix.Timeval) error) as type s2 in assignment
How can I make portable programs when Go removes my ability to call Select?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ExpertNeededFrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-DarwinOS-DragonflyOS-FreeBSDOS-NetBSDOS-OpenBSD