github.com/nozzle/golangci-lint@v1.49.0-nz3/test/testdata/exhaustruct.go (about) 1 //golangcitest:args -Eexhaustruct 2 package testdata 3 4 import "time" 5 6 type Exhaustruct struct { 7 A string 8 B int 9 c bool // private field inside the same package are not ignored 10 D float64 11 E time.Time 12 } 13 14 func exhaustruct() { 15 // pass 16 _ = Exhaustruct{ 17 A: "a", 18 B: 0, 19 c: false, 20 D: 1.0, 21 E: time.Now(), 22 } 23 24 // failPrivate 25 _ = Exhaustruct{ // want "c is missing in Exhaustruct" 26 A: "a", 27 B: 0, 28 D: 1.0, 29 E: time.Now(), 30 } 31 32 // fail 33 _ = Exhaustruct{ // want "B is missing in Exhaustruct" 34 A: "a", 35 c: false, 36 D: 1.0, 37 E: time.Now(), 38 } 39 40 // failMultiple 41 _ = Exhaustruct{ // want "B, D are missing in Exhaustruct" 42 A: "a", 43 c: false, 44 E: time.Now(), 45 } 46 47 }