This is correct behaviour and it same for both linux and mac.
Plase see inet_aton(3) man page for more details:
The address supplied in cp can have one of the following forms:
Parts a and b specify the first two bytes of the binary address. Part c is interpreted
as a 16-bit value that defines the rightmost two bytes of the binary address.
This notation is suitable for specifying (outmoded) Class B network addresses.
Part a specifies the first byte of the binary address. Part b is interpreted as a 24-bit
value that defines the rightmost three bytes of the binary address. This notation is
suitable for specifying (outmoded) Class C network addresses.
When GODEBUG=netdns=cgo, general name resolution depends on external functionality provided by userspace stuff such as libc (the behavior is different between implementations, for example, libc on BSD variants vs. libc on macOS/iOS vs. glibc vs. Windows API vs. Plan 9), and when GODEBUG=netdns=go, DNS name resolution uses only package internal helpers.
I think it's fine to align IP literal handling with the existing GODEUG=netdns=go behavior basically (because no one never uses classful IPv4 routing), though I'm still wondering whether we should deal with IP address synthesis as described in RFC 7050. Without application context, it's very hard to determine what's correct and what's not.