toolshonnef.co/go/tools/quickfix/qf1002 Index | Files

package qf1002

import "honnef.co/go/tools/quickfix/qf1002"

Index

Variables

var Analyzer = SCAnalyzer.Analyzer
var SCAnalyzer = lint.InitializeAnalyzer(&lint.Analyzer{
	Analyzer: &analysis.Analyzer{
		Name:     "QF1002",
		Run:      run,
		Requires: []*analysis.Analyzer{inspect.Analyzer},
	},
	Doc: &lint.RawDocumentation{
		Title: "Convert untagged switch to tagged switch",
		Text: `
An untagged switch that compares a single variable against a series of
values can be replaced with a tagged switch.`,
		Before: `
switch {
case x == 1 || x == 2, x == 3:
    ...
case x == 4:
    ...
default:
    ...
}`,

		After: `
switch x {
case 1, 2, 3:
    ...
case 4:
    ...
default:
    ...
}`,
		Since:    "2021.1",
		Severity: lint.SeverityHint,
	},
})

Source Files

qf1002.go

Version
v0.5.0-rc.1
Published
Jul 1, 2024
Platform
darwin/amd64
Imports
11 packages
Last checked
47 minutes ago

Tools for package owners.