Updates for go 1.18

This commit is contained in:
9seconds
2022-03-19 14:36:04 +03:00
parent 8da55410de
commit e74726af70
29 changed files with 79 additions and 68 deletions
+4 -4
View File
@@ -74,12 +74,12 @@ func getAddresses(url string) (map[conntypes.DC][]string, conntypes.DC, error) {
}
func addressesParseProxyFor(text string) (string, conntypes.DC, error) {
chunks := addressesProxyForSplitter.Split(text, 3)
chunks := addressesProxyForSplitter.Split(text, 3) // nolint: gomnd
if len(chunks) != 3 || chunks[0] != "proxy_for" {
return "", 0, fmt.Errorf("incorrect config %s", text)
}
dc, err := strconv.ParseInt(chunks[1], 10, 16)
dc, err := strconv.ParseInt(chunks[1], 10, 16) // nolint: gomnd
if err != nil {
return "", 0, fmt.Errorf("incorrect config '%s': %w", text, err)
}
@@ -93,14 +93,14 @@ func addressesParseProxyFor(text string) (string, conntypes.DC, error) {
}
func addressesParseDefault(text string) (conntypes.DC, error) {
chunks := addressesProxyForSplitter.Split(text, 2)
chunks := addressesProxyForSplitter.Split(text, 2) // nolint: gomnd
if len(chunks) != 2 || chunks[0] != "default" {
return 0, fmt.Errorf("incorrect config '%s'", text)
}
dcString := strings.TrimRight(chunks[1], ";")
dc, err := strconv.ParseInt(dcString, 10, 16)
dc, err := strconv.ParseInt(dcString, 10, 16) // nolint: gomnd
if err != nil {
return 0, fmt.Errorf("incorrect config '%s': %w", text, err)
}