Skip to content

Commit dacf1f1

Browse files
committed
go/types: clarify the documentation for Func.Pkg
Change-Id: Ia695960ba652143f4a48c1ca3495a043097acbb7 Reviewed-on: https://go-review.googlesource.com/c/go/+/534298 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Run-TryBot: Jonathan Amsterdam <[email protected]>
1 parent 7c446ba commit dacf1f1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/cmd/compile/internal/types2/object.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,12 @@ func (obj *Func) Origin() *Func {
406406
return obj
407407
}
408408

409+
// Pkg returns the package to which the function belongs.
410+
//
411+
// The result is nil for methods of types in the Universe scope,
412+
// like [error.Error].
413+
func (obj *Func) Pkg() *Package { return obj.object.Pkg() }
414+
409415
// hasPtrRecv reports whether the receiver is of the form *T for the given method obj.
410416
func (obj *Func) hasPtrRecv() bool {
411417
// If a method's receiver type is set, use that as the source of truth for the receiver.

src/go/types/object.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)