mdlayher / vsock

Package vsock provides access to Linux VM sockets (AF_VSOCK) for communication between a hypervisor and its virtual machines. MIT Licensed.
MIT License
328 stars 65 forks source link

vsock: require Go version 1.11+ for Conn,Listener #34

Closed marcov closed 5 years ago

marcov commented 5 years ago

Require a compile time check of the Go compiler version, to avoid situations where a binary using this package is generated but not working properly.

mdlayher commented 5 years ago

Can you clarify what prompted you to propose this change? I'd probably rather return errors than break compilation all together.

marcov commented 5 years ago

Can you clarify what prompted you to propose this change? I'd probably rather return errors than break compilation all together.

@mdlayher It's the fact that a program using this package can build just fine with an old version of Go, but then it would not work as expected. So I thought it's better to break compilation altogether.

mdlayher commented 5 years ago

I've applied https://github.com/mdlayher/vsock/commit/7b7533a7ca4eba7dd23dab2de70e25ca6eecf7e2 to solve this problem, as it provides a more informative error output and better documents the expectations of this package:

✔ ~/src/github.com/mdlayher/vsock [master|⚑ 1] 
11:32 $ go1.10.8 build
# github.com/mdlayher/vsock
./goversion_unsupported.go:8:2: undefined: UpgradeGoCompilerToUseThisPackage