1package pkg 2 3import ( 4 "io" 5 "math" 6) 7 8type MyInt int 9 10const X int = 1 11const Y = 1 12 13func gen1() int { return 0 } 14func gen2() io.ReadCloser { return nil } 15func gen3() MyInt { return 0 } 16 17// don't flag global variables 18var a int = gen1() 19 20func fn() { 21 var _ int = gen1() // want `could omit type int` 22 var a int = Y // want `could omit type int` 23 var b int = 1 // want `could omit type int` 24 var c int = 1.0 // different default type 25 var d MyInt = 1 // different default type 26 var e io.ReadCloser = gen2() // want `could omit type io.ReadCloser` 27 var f io.Reader = gen2() // different interface type 28 var g float64 = math.Pi // want `could omit type float64` 29 var h bool = true // want `could omit type bool` 30 var i string = "" // want `could omit type string` 31 var j MyInt = gen3() // want `could omit type MyInt` 32 33 _, _, _, _, _, _, _, _, _, _ = a, b, c, d, e, f, g, h, i, j 34} 35