From b45f8181aa139c52222b467bdbf61bae73a014c9 Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Thu, 20 Feb 2025 17:26:28 +0100 Subject: [PATCH] style(lint): block unused parameter --- pkg/domain/dockerCompose/config.go | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/pkg/domain/dockerCompose/config.go b/pkg/domain/dockerCompose/config.go index 1b3eebc..e99d062 100644 --- a/pkg/domain/dockerCompose/config.go +++ b/pkg/domain/dockerCompose/config.go @@ -1898,7 +1898,7 @@ func (v *Volume) MergeLastWin(volume *Volume) { } } -func (v *Volume) mergeExistingWinExternal(external bool) { +func (v *Volume) mergeExistingWinExternal(_ bool) { if v.External { return } @@ -2022,6 +2022,17 @@ func (p port) existsSrcPort() bool { return len(p.getSrcPort()) > 0 } +// getDst returns the concatenation of the destination ip and port. If the destination ip is empty, only the port will +// be returned. +func (p port) getDst() string { + switch { + case p.existsDstIP(): + return fmt.Sprintf("%s%s%s", p.getDstIP(), portDelimiter, p.getDstPort()) + default: + return p.getDstPort() + } +} + // getSrcIP returns the destination ip, if the port string contains a destination ip definition. func (p port) getDstIP() string { matches := regExpPort.FindStringSubmatch(string(p)) @@ -2067,6 +2078,17 @@ func (p port) getProtocol() string { return matches[i] } +// getSrc returns the concatenation of the source ip and port. If the source ip is empty, only the port will be +// returned. +func (p port) getSrc() string { + switch { + case p.existsSrcIP(): + return fmt.Sprintf("%s%s%s", p.getSrcIP(), portDelimiter, p.getSrcPort()) + default: + return p.getSrcPort() + } +} + // getSrcIP returns the source ip, if the port string contains an src ip definition. func (p port) getSrcIP() string { matches := regExpPort.FindStringSubmatch(string(p))