From 3e6069cab591b44348db715b3b99c4ba1c8e85af Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Wed, 30 Mar 2016 19:40:20 +0200 Subject: [PATCH] pkg/utils: use constant for chain prefix --- pkg/utils/utils.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index a07ccfab..e1468aaf 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -5,7 +5,8 @@ import ( "fmt" ) -const MaxChainLength = 29 - len("CNI-") +const ChainCNIPrefix = ("CNI-") +const MaxChainLength = 29 - len(ChainCNIPrefix) // Generates a chain name to be used with iptables. // Ensures that the generated name is less than @@ -15,5 +16,5 @@ func FormatChainName(name string, id string) string { if len(chain) > MaxChainLength { chain = chain[:MaxChainLength] } - return fmt.Sprintf("CNI-%s", chain) + return fmt.Sprintf("%s%s", ChainCNIPrefix, chain) }