github.com/serversong/goreporter@v0.0.0-20200325104552-3cfaf44fd178/linters/simpler/testdata/convert.go (about)

     1  package pkg
     2  
     3  type t1 struct {
     4  	a int
     5  	b int
     6  }
     7  
     8  type t2 struct {
     9  	a int
    10  	b int
    11  }
    12  
    13  type t3 t1
    14  
    15  func fn() {
    16  	v1 := t1{1, 2}
    17  	_ = t2{v1.a, v1.b}       // MATCH /should use type conversion/
    18  	_ = t2{a: v1.a, b: v1.b} // MATCH /should use type conversion/
    19  	_ = t2{b: v1.b, a: v1.a} // MATCH /should use type conversion/
    20  	_ = t3{v1.a, v1.b}       // MATCH /should use type conversion/
    21  
    22  	_ = t2{v1.b, v1.a}
    23  	_ = t2{a: v1.b, b: v1.a}
    24  	_ = t2{a: v1.a}
    25  	_ = t1{v1.a, v1.b}
    26  }