From b114fd5279161909146315a1809137ac4015972d Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Thu, 24 Mar 2022 17:12:41 +0300 Subject: [PATCH] cherry-pick: home: fix types Updates #4424. Squashed commit of the following: commit 784b4940d46ce74edbfbbde6e5b24f95dcb4bc70 Author: Ainar Garipov Date: Thu Mar 24 17:07:41 2022 +0300 home: fix types --- internal/home/config.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/home/config.go b/internal/home/config.go index c553c42c..0bc1145f 100644 --- a/internal/home/config.go +++ b/internal/home/config.go @@ -332,8 +332,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) }