github.com/nozzle/golangci-lint@v1.49.0-nz3/test/testdata/predeclared_custom.go (about)

     1  //golangcitest:args -Epredeclared
     2  //golangcitest:config_path testdata/configs/predeclared.yml
     3  package testdata
     4  
     5  func hello() {
     6  	var real int
     7  	a := A{}
     8  	copy := Clone(a) // want "variable copy has same name as predeclared identifier"
     9  
    10  	// suppress any "declared but not used" errors
    11  	_ = real
    12  	_ = a
    13  	_ = copy
    14  }
    15  
    16  type A struct {
    17  	true bool // want "field true has same name as predeclared identifier"
    18  	foo  int
    19  }
    20  
    21  func Clone(a A) A {
    22  	return A{
    23  		true: a.true,
    24  		foo:  a.foo,
    25  	}
    26  }
    27  
    28  func recover() {}