Commit dc6db5f4 authored by Russ Cox's avatar Russ Cox

[release-branch.go1.12] cmd/vet: add tests for point-release issues

Add explicit tests for:

 #30465	cmd/vet: Consider reverting tag conflict for embedded fields
 #30399	cmd/vet: possible to get a printf false positive with big.Int

because we have managed not to fix them in the last
couple point releases, and it will be too embarrassing
to do that yet again.

Change-Id: Ib1da5df870348b6eb9bfc8a87c507ecc6d44b8dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/174520
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 9ac70939
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package print2
import ( // NOTE: Does not import "fmt"
"log"
"math/big"
)
var fmt int
func f() {
log.Printf("%d", new(big.Int))
log.Printf("%d", 1.0) // ERROR "Printf format %d has arg 1.0 of wrong type float64"
}
......@@ -6,6 +6,20 @@
package structtag
import "encoding/json"
type StructTagTest struct {
A int "hello" // ERROR "`hello` not compatible with reflect.StructTag.Get: bad syntax for struct tag pair"
}
func Issue30465() {
type T1 struct {
X string `json:"x"`
}
type T2 struct {
T1
X string `json:"x"`
}
var t2 T2
json.Marshal(&t2)
}
......@@ -88,6 +88,7 @@ func TestVet(t *testing.T) {
"method",
"nilfunc",
"print",
"print2",
"rangeloop",
"shift",
"structtag",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment