Skip to content

Commit a55009f

Browse files
authored
Merge pull request #82 from drakkan/staticcheck
fix staticcheck warning: don't use Yoda conditions (ST1017)
2 parents 10d5fbd + b809180 commit a55009f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

addr_proto.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,32 @@ const (
1515

1616
// IsIPv4 returns true if the address family is IPv4 (AF_INET4), false otherwise.
1717
func (ap AddressFamilyAndProtocol) IsIPv4() bool {
18-
return 0x10 == ap&0xF0
18+
return ap&0xF0 == 0x10
1919
}
2020

2121
// IsIPv6 returns true if the address family is IPv6 (AF_INET6), false otherwise.
2222
func (ap AddressFamilyAndProtocol) IsIPv6() bool {
23-
return 0x20 == ap&0xF0
23+
return ap&0xF0 == 0x20
2424
}
2525

2626
// IsUnix returns true if the address family is UNIX (AF_UNIX), false otherwise.
2727
func (ap AddressFamilyAndProtocol) IsUnix() bool {
28-
return 0x30 == ap&0xF0
28+
return ap&0xF0 == 0x30
2929
}
3030

3131
// IsStream returns true if the transport protocol is TCP or STREAM (SOCK_STREAM), false otherwise.
3232
func (ap AddressFamilyAndProtocol) IsStream() bool {
33-
return 0x01 == ap&0x0F
33+
return ap&0x0F == 0x01
3434
}
3535

3636
// IsDatagram returns true if the transport protocol is UDP or DGRAM (SOCK_DGRAM), false otherwise.
3737
func (ap AddressFamilyAndProtocol) IsDatagram() bool {
38-
return 0x02 == ap&0x0F
38+
return ap&0x0F == 0x02
3939
}
4040

4141
// IsUnspec returns true if the transport protocol or address family is unspecified, false otherwise.
4242
func (ap AddressFamilyAndProtocol) IsUnspec() bool {
43-
return (0x00 == ap&0xF0) || (0x00 == ap&0x0F)
43+
return (ap&0xF0 == 0x00) || (ap&0x0F == 0x00)
4444
}
4545

4646
func (ap AddressFamilyAndProtocol) toByte() byte {

0 commit comments

Comments
 (0)