Skip to content

Commit

Permalink
gen: prevent generated tests from calling t.Logf with struct as argum…
Browse files Browse the repository at this point in the history
…ent, fixing go vet copylocks error when struct has sync.Mutex field

Fixes #255
  • Loading branch information
shawnps-sigsci authored and philhofer committed Jun 28, 2019
1 parent 2672e71 commit efe2042
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions _generated/vet_copylocks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package _generated

import "sync"

//go:generate msgp
//go:generate go vet

type Foo struct {
I struct{}
lock sync.Mutex
}
2 changes: 1 addition & 1 deletion gen/testgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func BenchmarkUnmarshal{{.TypeName}}(b *testing.B) {
m := v.Msgsize()
if buf.Len() > m {
t.Logf("WARNING: Msgsize() for %v is inaccurate", v)
t.Log("WARNING: TestEncodeDecode{{.TypeName}} Msgsize() is inaccurate")
}
vn := {{.TypeName}}{}
Expand Down

0 comments on commit efe2042

Please sign in to comment.