From cbba3b8254f26887b16fa77794f27fce3256de76 Mon Sep 17 00:00:00 2001 From: Navneeth Jayendran Date: Sat, 30 Dec 2023 15:19:45 -0500 Subject: [PATCH] Remove unused code --- switch.go | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/switch.go b/switch.go index c12b693..96c69df 100644 --- a/switch.go +++ b/switch.go @@ -5,7 +5,6 @@ import ( "go/ast" "go/types" "regexp" - "strings" "golang.org/x/tools/go/analysis" ) @@ -60,31 +59,6 @@ type switchConfig struct { ignoreType *regexp.Regexp // can be nil } -// There are few possibilities, and often none, so we use a possibly-nil slice -func userDirectives(comments []*ast.CommentGroup) []string { - var directives []string - for _, c := range comments { - for _, cc := range c.List { - // The order matters here: we always want to check the longest first. - for _, d := range []string{ - enforceDefaultCaseRequiredComment, - ignoreDefaultCaseRequiredComment, - enforceComment, - ignoreComment, - } { - if strings.HasPrefix(cc.Text, d) { - directives = append(directives, d) - // The break here is important: once we associate a comment - // with a particular (longest-possible) directive, we don't want - // to map to another! - break - } - } - } - } - return directives -} - // switchChecker returns a node visitor that checks exhaustiveness of // enum switch statements for the supplied pass, and reports // diagnostics. The node visitor expects only *ast.SwitchStmt nodes.