From 3603b1fcab3a39cbc6402ae0334133f58624e335 Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Thu, 24 Mar 2022 17:12:41 +0300 Subject: [PATCH] Pull request: 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 c81de19e..aa8450be 100644 --- a/internal/home/config.go +++ b/internal/home/config.go @@ -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) }