mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Improve the error user experience when users try to set/refer
to unexported fields and methods of struct literals, by directly saying
"cannot refer to unexported field or method"
Fixes #31053
Change-Id: I6fd3caf64b7ca9f9d8ea60b7756875e340792d59
Reviewed-on: https://go-review.googlesource.com/c/go/+/201657
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
18 lines
322 B
Go
18 lines
322 B
Go
// 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 f1
|
|
|
|
type Foo struct {
|
|
doneChan chan bool
|
|
Name string
|
|
fOO int
|
|
hook func()
|
|
}
|
|
|
|
func (f *Foo) Exported() {
|
|
}
|
|
|
|
func (f *Foo) unexported() {
|
|
}
|