1// errorcheck 2 3// Copyright 2017 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7package main 8 9type it struct { 10 Floats bool 11 inner string 12} 13 14func main() { 15 i1 := it{Floats: true} 16 if i1.floats { // ERROR "(type it .* field or method floats, but does have field Floats)|undefined field or method" 17 } 18 i2 := &it{floats: false} // ERROR "cannot refer to unexported field floats in struct literal|unknown field|declared and not used" 19 _ = &it{InneR: "foo"} // ERROR "(but does have field inner)|unknown field" 20 _ = i2 21} 22