Debian Codegraph @

staticcheck/sa1014/testdata/go1.0/CheckUnmarshalPointer/CheckUnmarshalPointer.go

raw
1 package pkg
2
3 import "encoding/json"
4
5 func fn1(i3 interface{}) {
6 var v map[string]interface{}
7 var i1 interface{} = v
8 var i2 interface{} = &v
9 p := &v
10 json.Unmarshal([]byte(`{}`), v) //@ diag(`Unmarshal expects to unmarshal into a pointer`)
11 json.Unmarshal([]byte(`{}`), &v)
12 json.Unmarshal([]byte(`{}`), i1) //@ diag(`Unmarshal expects to unmarshal into a pointer`)
13 json.Unmarshal([]byte(`{}`), i2)
14 json.Unmarshal([]byte(`{}`), i3)
15 json.Unmarshal([]byte(`{}`), p)
16
17 json.NewDecoder(nil).Decode(v) //@ diag(`Decode expects to unmarshal into a pointer`)
18 }