From 25b790d025f07926e51ed8c37ed86c6691b29bf9 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Mon, 15 Nov 2021 18:42:44 +0000 Subject: [PATCH] Add and fix forcetypeassert --- .golangci.yaml | 3 +-- machine.go | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index 0a1b9dc2..5ab873d4 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -31,16 +31,15 @@ linters: # We should strive to enable these: - wrapcheck - goerr113 - - forcetypeassert - dupl - makezero - - paralleltest # We might want to enable this, but it might be a lot of work - cyclop - nestif - wsl # might be incompatible with gofumpt - testpackage + - paralleltest linters-settings: varnamelen: diff --git a/machine.go b/machine.go index be6d4467..a728e28c 100644 --- a/machine.go +++ b/machine.go @@ -350,7 +350,9 @@ func (h *Headscale) isOutdated(machine *Machine) bool { namespaces := make([]string, namespaceSet.Size()) for index, namespace := range namespaceSet.List() { - namespaces[index] = namespace.(string) + if name, ok := namespace.(string); ok { + namespaces[index] = name + } } lastChange := h.getLastStateChange(namespaces...)