github.com/golangci/go-tools@v0.0.0-20190318060251-af6baa5dc196/staticcheck/testdata/src/CheckUnmarshalPointer/CheckUnmarshalPointer.go (about)

     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) // MATCH /Unmarshal expects to unmarshal into a pointer/
    11  	json.Unmarshal([]byte(`{}`), &v)
    12  	json.Unmarshal([]byte(`{}`), i1) // MATCH /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) // MATCH /Decode expects to unmarshal into a pointer/
    18  }