Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.0.1-2020.1.5 / unused / testdata / src / conversion / conversion.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/unused/testdata/src/conversion/conversion.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/honnef.co/go/tools@v0.0.1-2020.1.5/unused/testdata/src/conversion/conversion.go
new file mode 100644 (file)
index 0000000..0821c67
--- /dev/null
@@ -0,0 +1,92 @@
+package pkg
+
+import (
+       "compress/flate"
+       "unsafe"
+)
+
+type t1 struct {
+       a int
+       b int
+}
+
+type t2 struct {
+       a int
+       b int
+}
+
+type t3 struct {
+       a int
+       b int // want `b`
+}
+
+type t4 struct {
+       a int
+       b int // want `b`
+}
+
+type t5 struct {
+       a int
+       b int
+}
+
+type t6 struct {
+       a int
+       b int
+}
+
+type t7 struct {
+       a int
+       b int
+}
+
+type t8 struct {
+       a int
+       b int
+}
+
+type t9 struct {
+       Offset int64
+       Err    error
+}
+
+type t10 struct {
+       a int
+       b int
+}
+
+func fn() {
+       // All fields in t2 used because they're initialised in t1
+       v1 := t1{0, 1}
+       v2 := t2(v1)
+       _ = v2
+
+       // Field b isn't used by anyone
+       v3 := t3{}
+       v4 := t4(v3)
+       println(v3.a)
+       _ = v4
+
+       // Both fields are used
+       v5 := t5{}
+       v6 := t6(v5)
+       println(v5.a)
+       println(v6.b)
+
+       v7 := &t7{}
+       println(v7.a)
+       println(v7.b)
+       v8 := (*t8)(v7)
+       _ = v8
+
+       vb := flate.ReadError{}
+       v9 := t9(vb)
+       _ = v9
+
+       // All fields are used because this is an unsafe conversion
+       var b []byte
+       v10 := (*t10)(unsafe.Pointer(&b[0]))
+       _ = v10
+}
+
+func init() { fn() }