The Go Programming Language book, exercise 6.5, the author told us using this expression:
32 << (^uint(0) >> 63)
to check whether the platform is 32-bit or 64-bit.
The expression is quite clear, and we can check the result with a simple code:
package main
import "fmt"
func main() {
fmt.Println(32 << (^uint(0) >> 63))
}
The code print 0 on 32-bit platform and 64 on 64-bit platform.
However, using go vet with the file, I receive the warning:
$ go vet ex6-5.go
ex6-5.go:6: ^uint(0) might be too small for shift of 63
exit status 1
Why does go vet show me that warnings? How can I prevent it?