Skip to content

Commit c3a6283

Browse files
xieyuschengopherbot
authored andcommitted
go/packages: undeprecate Load* style flags
Updates golang/go#70470 Change-Id: Ia254b993b301fcc708d07b3773fad31a971c5997 Reviewed-on: https://go-review.googlesource.com/c/tools/+/630435 Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 9dff42e commit c3a6283

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

go/packages/packages.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ import (
4343
// ID and Errors (if present) will always be filled.
4444
// [Load] may return more information than requested.
4545
//
46+
// The Mode flag is a union of several bits named NeedName,
47+
// NeedFiles, and so on, each of which determines whether
48+
// a given field of Package (Name, Files, etc) should be
49+
// populated.
50+
//
51+
// For convenience, we provide named constants for the most
52+
// common combinations of Need flags:
53+
//
54+
// [LoadFiles] lists of files in each package
55+
// [LoadImports] ... plus imports
56+
// [LoadTypes] ... plus type information
57+
// [LoadSyntax] ... plus type-annotated syntax
58+
// [LoadAllSyntax] ... for all dependencies
59+
//
4660
// Unfortunately there are a number of open bugs related to
4761
// interactions among the LoadMode bits:
4862
// - https://github.com/golang/go/issues/56633
@@ -109,33 +123,18 @@ const (
109123

110124
const (
111125
// LoadFiles loads the name and file names for the initial packages.
112-
//
113-
// Deprecated: LoadFiles exists for historical compatibility
114-
// and should not be used. Please directly specify the needed fields using the Need values.
115126
LoadFiles = NeedName | NeedFiles | NeedCompiledGoFiles
116127

117128
// LoadImports loads the name, file names, and import mapping for the initial packages.
118-
//
119-
// Deprecated: LoadImports exists for historical compatibility
120-
// and should not be used. Please directly specify the needed fields using the Need values.
121129
LoadImports = LoadFiles | NeedImports
122130

123131
// LoadTypes loads exported type information for the initial packages.
124-
//
125-
// Deprecated: LoadTypes exists for historical compatibility
126-
// and should not be used. Please directly specify the needed fields using the Need values.
127132
LoadTypes = LoadImports | NeedTypes | NeedTypesSizes
128133

129134
// LoadSyntax loads typed syntax for the initial packages.
130-
//
131-
// Deprecated: LoadSyntax exists for historical compatibility
132-
// and should not be used. Please directly specify the needed fields using the Need values.
133135
LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo
134136

135137
// LoadAllSyntax loads typed syntax for the initial packages and all dependencies.
136-
//
137-
// Deprecated: LoadAllSyntax exists for historical compatibility
138-
// and should not be used. Please directly specify the needed fields using the Need values.
139138
LoadAllSyntax = LoadSyntax | NeedDeps
140139

141140
// Deprecated: NeedExportsFile is a historical misspelling of NeedExportFile.

0 commit comments

Comments
 (0)