From 946d38e5d7c36ea8a161a7e0db5c31fc41f8bd64 Mon Sep 17 00:00:00 2001 From: Juan Font Date: Sat, 26 Nov 2022 09:59:56 +0000 Subject: [PATCH] Minor linting fixes Remove magic number (base10...) --- cmd/headscale/cli/routes.go | 6 +++++- utils.go | 10 ---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/cmd/headscale/cli/routes.go b/cmd/headscale/cli/routes.go index 3f0c2086..e238b62e 100644 --- a/cmd/headscale/cli/routes.go +++ b/cmd/headscale/cli/routes.go @@ -11,6 +11,10 @@ import ( "google.golang.org/grpc/status" ) +const ( + Base10 = 10 +) + func init() { rootCmd.AddCommand(routesCmd) listRoutesCmd.Flags().Uint64P("identifier", "i", 0, "Node identifier (ID)") @@ -204,7 +208,7 @@ func routesToPtables(routes []*v1.Route) pterm.TableData { for _, route := range routes { tableData = append(tableData, []string{ - strconv.FormatUint(route.Id, 10), + strconv.FormatUint(route.Id, Base10), route.Machine.GivenName, route.Prefix, strconv.FormatBool(route.Advertised), diff --git a/utils.go b/utils.go index c0599c99..8bdb2b3f 100644 --- a/utils.go +++ b/utils.go @@ -254,16 +254,6 @@ func GrpcSocketDialer(ctx context.Context, addr string) (net.Conn, error) { return d.DialContext(ctx, "unix", addr) } -func ipPrefixToString(prefixes []netip.Prefix) []string { - result := make([]string, len(prefixes)) - - for index, prefix := range prefixes { - result[index] = prefix.String() - } - - return result -} - func stringToIPPrefix(prefixes []string) ([]netip.Prefix, error) { result := make([]netip.Prefix, len(prefixes))