toolshonnef.co/go/tools/simple/s1016 Index | Files

package s1016

import "honnef.co/go/tools/simple/s1016"

Index

Variables

var Analyzer = SCAnalyzer.Analyzer
var SCAnalyzer = lint.InitializeAnalyzer(&lint.Analyzer{
	Analyzer: &analysis.Analyzer{
		Name:     "S1016",
		Run:      run,
		Requires: []*analysis.Analyzer{inspect.Analyzer, generated.Analyzer},
	},
	Doc: &lint.RawDocumentation{
		Title: `Use a type conversion instead of manually copying struct fields`,
		Text:  "" /* 283 byte string literal not displayed */,

		Before: `
var x T1
y := T2{
    Field1: x.Field1,
    Field2: x.Field2,
}`,
		After: `
var x T1
y := T2(x)`,
		Since:   "2017.1",
		MergeIf: lint.MergeIfAll,
	},
})

Source Files

s1016.go

Version
v0.6.1 (latest)
Published
Mar 5, 2025
Platform
js/wasm
Imports
12 packages
Last checked
3 hours ago

Tools for package owners.