github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/quickfix/qf1008/testdata/src/example.com/CheckExplicitEmbeddedSelector/CheckExplicitEmbeddedSelector-partial-multi.go.golden (about) 1 -- Remove embedded field "BasicOuter" from selector -- 2 package pkg 3 4 type PartialMultiLevel struct{ F3 MultiLevel } 5 type PartialMultiLevel2Outer struct{ PartialMultiLevel2Inner } 6 type PartialMultiLevel2Inner struct{ F6 PartialMultiLevel2Outer2 } 7 type PartialMultiLevel2Outer2 struct{ PartialMultiLevel2Inner2 } 8 type PartialMultiLevel2Inner2 struct{ F7 int } 9 10 func fnPartialMulti() { 11 var partialMulti PartialMultiLevel 12 _ = partialMulti.F3.F1 //@ diag(`could remove embedded field "BasicOuter" from selector`) 13 _ = partialMulti.F3.BasicInner.F1 //@ diag(`could remove embedded field "BasicOuter" from selector`), diag(`could remove embedded field "BasicInner" from selector`), diag(`could simplify selectors`) 14 _ = partialMulti.F3.F1 // minimal form 15 16 var partialMulti2 PartialMultiLevel2Outer 17 _ = partialMulti2.PartialMultiLevel2Inner.F6.PartialMultiLevel2Inner2.F7 //@ diag(`could remove embedded field "PartialMultiLevel2Inner2" from selector`), diag(`could remove embedded field "PartialMultiLevel2Inner" from selector`), diag(`could simplify selectors`) 18 _ = partialMulti2.F6.F7 // minimal form 19 } 20 21 -- Remove embedded field "BasicInner" from selector -- 22 package pkg 23 24 type PartialMultiLevel struct{ F3 MultiLevel } 25 type PartialMultiLevel2Outer struct{ PartialMultiLevel2Inner } 26 type PartialMultiLevel2Inner struct{ F6 PartialMultiLevel2Outer2 } 27 type PartialMultiLevel2Outer2 struct{ PartialMultiLevel2Inner2 } 28 type PartialMultiLevel2Inner2 struct{ F7 int } 29 30 func fnPartialMulti() { 31 var partialMulti PartialMultiLevel 32 _ = partialMulti.F3.BasicOuter.F1 //@ diag(`could remove embedded field "BasicOuter" from selector`) 33 _ = partialMulti.F3.BasicOuter.F1 //@ diag(`could remove embedded field "BasicOuter" from selector`), diag(`could remove embedded field "BasicInner" from selector`), diag(`could simplify selectors`) 34 _ = partialMulti.F3.F1 // minimal form 35 36 var partialMulti2 PartialMultiLevel2Outer 37 _ = partialMulti2.PartialMultiLevel2Inner.F6.PartialMultiLevel2Inner2.F7 //@ diag(`could remove embedded field "PartialMultiLevel2Inner2" from selector`), diag(`could remove embedded field "PartialMultiLevel2Inner" from selector`), diag(`could simplify selectors`) 38 _ = partialMulti2.F6.F7 // minimal form 39 } 40 41 -- Remove embedded field "PartialMultiLevel2Inner2" from selector -- 42 package pkg 43 44 type PartialMultiLevel struct{ F3 MultiLevel } 45 type PartialMultiLevel2Outer struct{ PartialMultiLevel2Inner } 46 type PartialMultiLevel2Inner struct{ F6 PartialMultiLevel2Outer2 } 47 type PartialMultiLevel2Outer2 struct{ PartialMultiLevel2Inner2 } 48 type PartialMultiLevel2Inner2 struct{ F7 int } 49 50 func fnPartialMulti() { 51 var partialMulti PartialMultiLevel 52 _ = partialMulti.F3.BasicOuter.F1 //@ diag(`could remove embedded field "BasicOuter" from selector`) 53 _ = partialMulti.F3.BasicOuter.BasicInner.F1 //@ diag(`could remove embedded field "BasicOuter" from selector`), diag(`could remove embedded field "BasicInner" from selector`), diag(`could simplify selectors`) 54 _ = partialMulti.F3.F1 // minimal form 55 56 var partialMulti2 PartialMultiLevel2Outer 57 _ = partialMulti2.PartialMultiLevel2Inner.F6.F7 //@ diag(`could remove embedded field "PartialMultiLevel2Inner2" from selector`), diag(`could remove embedded field "PartialMultiLevel2Inner" from selector`), diag(`could simplify selectors`) 58 _ = partialMulti2.F6.F7 // minimal form 59 } 60 61 -- Remove embedded field "PartialMultiLevel2Inner" from selector -- 62 package pkg 63 64 type PartialMultiLevel struct{ F3 MultiLevel } 65 type PartialMultiLevel2Outer struct{ PartialMultiLevel2Inner } 66 type PartialMultiLevel2Inner struct{ F6 PartialMultiLevel2Outer2 } 67 type PartialMultiLevel2Outer2 struct{ PartialMultiLevel2Inner2 } 68 type PartialMultiLevel2Inner2 struct{ F7 int } 69 70 func fnPartialMulti() { 71 var partialMulti PartialMultiLevel 72 _ = partialMulti.F3.BasicOuter.F1 //@ diag(`could remove embedded field "BasicOuter" from selector`) 73 _ = partialMulti.F3.BasicOuter.BasicInner.F1 //@ diag(`could remove embedded field "BasicOuter" from selector`), diag(`could remove embedded field "BasicInner" from selector`), diag(`could simplify selectors`) 74 _ = partialMulti.F3.F1 // minimal form 75 76 var partialMulti2 PartialMultiLevel2Outer 77 _ = partialMulti2.F6.PartialMultiLevel2Inner2.F7 //@ diag(`could remove embedded field "PartialMultiLevel2Inner2" from selector`), diag(`could remove embedded field "PartialMultiLevel2Inner" from selector`), diag(`could simplify selectors`) 78 _ = partialMulti2.F6.F7 // minimal form 79 } 80 81 -- Remove all embedded fields from selector -- 82 package pkg 83 84 type PartialMultiLevel struct{ F3 MultiLevel } 85 type PartialMultiLevel2Outer struct{ PartialMultiLevel2Inner } 86 type PartialMultiLevel2Inner struct{ F6 PartialMultiLevel2Outer2 } 87 type PartialMultiLevel2Outer2 struct{ PartialMultiLevel2Inner2 } 88 type PartialMultiLevel2Inner2 struct{ F7 int } 89 90 func fnPartialMulti() { 91 var partialMulti PartialMultiLevel 92 _ = partialMulti.F3.BasicOuter.F1 //@ diag(`could remove embedded field "BasicOuter" from selector`) 93 _ = partialMulti.F3.F1 //@ diag(`could remove embedded field "BasicOuter" from selector`), diag(`could remove embedded field "BasicInner" from selector`), diag(`could simplify selectors`) 94 _ = partialMulti.F3.F1 // minimal form 95 96 var partialMulti2 PartialMultiLevel2Outer 97 _ = partialMulti2.F6.F7 //@ diag(`could remove embedded field "PartialMultiLevel2Inner2" from selector`), diag(`could remove embedded field "PartialMultiLevel2Inner" from selector`), diag(`could simplify selectors`) 98 _ = partialMulti2.F6.F7 // minimal form 99 }