Skip to content

Commit

Permalink
Pull request: home: fix types
Browse files Browse the repository at this point in the history
Updates AdguardTeam#4424.

Squashed commit of the following:

commit 784b494
Author: Ainar Garipov <[email protected]>
Date:   Thu Mar 24 17:07:41 2022 +0300

    home: fix types
  • Loading branch information
ainar-g committed Mar 24, 2022
1 parent 8250556 commit 3603b1f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/home/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,14 @@ type tcpPort int
// ports should be either a udpPort or a tcpPort.
func addPorts(uc aghalg.UniqChecker, ports ...interface{}) {
for _, p := range ports {
// Use separate cases for tcpPort and udpPort so that the untyped
// constant zero is converted to the appropriate type.
switch p := p.(type) {
case tcpPort, udpPort:
case tcpPort:
if p != 0 {
uc.Add(p)
}
case udpPort:
if p != 0 {
uc.Add(p)
}
Expand Down

0 comments on commit 3603b1f

Please sign in to comment.