aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2023-07-05 12:08:51 -0400
committerRuss Cox <rsc@golang.org>2023-07-06 13:09:19 +0000
commitb490bdc27d5576e5ccdac33755c0156d609e1bb9 (patch)
tree322ea08dc4d914893473d5f715dc184929cac241 /api
parent36ea4f9680f8296f1c7d0cf7dbb1b3a9d572754a (diff)
downloadgo-b490bdc27d5576e5ccdac33755c0156d609e1bb9.tar.gz
go-b490bdc27d5576e5ccdac33755c0156d609e1bb9.zip
go/types: record Config.GoVersion for reporting in Package.GoVersion method
Clients of go/types, such as analyzers, may need to know which specific Go version a package is written for. Record that information in the Package and expose it using the new GoVersion method. Update parseGoVersion to handle the new Go versions that may be passed around starting in Go 1.21.0: versions like "go1.21.0" and "go1.21rc2". This is not strictly necessary today, but it adds some valuable future-proofing. While we are here, change NewChecker from panicking on invalid version to saving an error for returning later from Files. Go versions are now likely to be coming from a variety of sources, not just hard-coded in calls to NewChecker, making a panic inappropriate. For #61174. Fixes #61175. Change-Id: Ibe41fe207c1b6e71064b1fe448ac55776089c541 Reviewed-on: https://go-review.googlesource.com/c/go/+/507975 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'api')
-rw-r--r--api/go1.21.txt1
1 files changed, 1 insertions, 0 deletions
diff --git a/api/go1.21.txt b/api/go1.21.txt
index 6435d10914..c8ca3df2e6 100644
--- a/api/go1.21.txt
+++ b/api/go1.21.txt
@@ -174,6 +174,7 @@ pkg go/build, type Package struct, Directives []Directive #56986
pkg go/build, type Package struct, TestDirectives []Directive #56986
pkg go/build, type Package struct, XTestDirectives []Directive #56986
pkg go/token, method (*File) Lines() []int #57708
+pkg go/types, method (*Package) GoVersion() string #61175
pkg html/template, const ErrJSTemplate = 12 #59584
pkg html/template, const ErrJSTemplate ErrorCode #59584
pkg io/fs, func FormatDirEntry(DirEntry) string #54451