src/cmd/vet/testdata/unmarshal/unmarshal.go
raw| 1 | // Copyright 2018 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // This file contains tests for the unmarshal checker. |
| 6 | |
| 7 | package unmarshal |
| 8 | |
| 9 | import "encoding/json" |
| 10 | |
| 11 | func _() { |
| 12 | type t struct { |
| 13 | a int |
| 14 | } |
| 15 | var v t |
| 16 | |
| 17 | json.Unmarshal([]byte{}, v) // ERROR "call of Unmarshal passes non-pointer as second argument" |
| 18 | } |