From 8be555e5f91c6069c3d51cb014f1849fd182b1dc Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Thu, 24 Nov 2022 15:40:39 +0100 Subject: Style: Use stylecheck and fix errors --- internal/wireguard/wireguard.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'internal/wireguard/wireguard.go') diff --git a/internal/wireguard/wireguard.go b/internal/wireguard/wireguard.go index 0a1ba5f..bbb22e4 100644 --- a/internal/wireguard/wireguard.go +++ b/internal/wireguard/wireguard.go @@ -22,14 +22,14 @@ func GenerateKey() (wgtypes.Key, error) { // FIXME: Instead of doing a regex replace, decide if we should use a parser func ConfigAddKey(config string, key wgtypes.Key) string { - interface_section := "[Interface]" - interface_section_escaped := regexp.QuoteMeta(interface_section) + interfaceSection := "[Interface]" + InterfaceSectionEscaped := regexp.QuoteMeta(interfaceSection) // (?m) enables multi line mode // ^ match from beginning of line // $ match till end of line // So it matches [Interface] section exactly - interface_re := regexp.MustCompile(fmt.Sprintf("(?m)^%s$", interface_section_escaped)) - to_replace := fmt.Sprintf("%s\nPrivateKey = %s", interface_section, key.String()) - return interface_re.ReplaceAllString(config, to_replace) + InterfaceRe := regexp.MustCompile(fmt.Sprintf("(?m)^%s$", InterfaceSectionEscaped)) + toReplace := fmt.Sprintf("%s\nPrivateKey = %s", interfaceSection, key.String()) + return InterfaceRe.ReplaceAllString(config, toReplace) } -- cgit v1.2.3