dev: fix updated golangci/tools revision

This commit is contained in:
Denis Isaev 2019-09-10 10:59:34 +03:00
parent 5d50b907dd
commit e691e606b1
No known key found for this signature in database
GPG Key ID: A36A0EC8E27A1A01
4 changed files with 26 additions and 23 deletions

2
go.mod
View File

@ -69,5 +69,5 @@ replace (
// https://github.com/ultraware/funlen/pull/1
github.com/ultraware/funlen => github.com/golangci/funlen v0.0.0-20190909161642-5e59b9546114
// https://github.com/golang/tools/pull/139
golang.org/x/tools => github.com/golangci/tools v0.0.0-20190909104219-979bdb7f8cc8
golang.org/x/tools => github.com/golangci/tools v0.0.0-20190910062050-3540c026601b
)

4
go.sum
View File

@ -77,8 +77,8 @@ github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 h1:leSNB7iYzLYSS
github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bzsHdTM0bsB7+8mt0GUMvjCgwLpTapNZHU8AajI=
github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 h1:HVfrLniijszjS1aiNg8JbBMO2+E1WIQ+j/gL4SQqGPg=
github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4=
github.com/golangci/tools v0.0.0-20190909104219-979bdb7f8cc8 h1:zlLYFLThJpbBZwGgIjfUzDg3gi32safjHB0omx3qtvo=
github.com/golangci/tools v0.0.0-20190909104219-979bdb7f8cc8/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
github.com/golangci/tools v0.0.0-20190910062050-3540c026601b h1:0gJ6G80gfLCh1Lz2O2m3tqESG5QJYYZKS0Z3wa2YzPM=
github.com/golangci/tools v0.0.0-20190910062050-3540c026601b/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys=
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=

View File

@ -49,7 +49,6 @@ const (
NeedImports
// NeedDeps adds the fields requested by the LoadMode in the packages in Imports.
// If NeedImports is not set, it will be added automatically.
NeedDeps
// NeedExportsFile adds ExportsFile.
@ -61,7 +60,7 @@ const (
// NeedSyntax adds Syntax.
NeedSyntax
// NeedTypesInfo adds TypesInfo. If NeedImports is not set, it will be added automatically.
// NeedTypesInfo adds TypesInfo.
NeedTypesInfo
// NeedTypesSizes adds TypesSizes.
@ -416,11 +415,13 @@ type loader struct {
parseCacheMu sync.Mutex
exportMu sync.Mutex // enforces mutual exclusion of exportdata operations
// TODO(matloob): Add an implied mode here and use that instead of mode.
// Implied mode would contain all the fields we need the data for so we can
// get the actually requested fields. We'll zero them out before returning
// packages to the user. This will make it easier for us to get the conditions
// where we need certain modes right.
// Config.Mode contains the implied mode (see implyLoadMode).
// Implied mode contains all the fields we need the data for.
// In requestedMode there are the actually requested fields.
// We'll zero them out before returning packages to the user.
// This makes it easier for us to get the conditions where
// we need certain modes right.
requestedMode LoadMode
}
type parseValue struct {
@ -477,7 +478,9 @@ func newLoader(cfg *Config) *loader {
}
}
ld.addDependingLoadModes()
// Save the actually requested fields. We'll zero them out before returning packages to the user.
ld.requestedMode = ld.Mode
ld.implyLoadMode()
return ld
}
@ -625,35 +628,35 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) {
}
for i := range ld.pkgs {
// Clear all unrequested fields, for extra de-Hyrum-ization.
if ld.Mode&NeedName == 0 {
if ld.requestedMode&NeedName == 0 {
ld.pkgs[i].Name = ""
ld.pkgs[i].PkgPath = ""
}
if ld.Mode&NeedFiles == 0 {
if ld.requestedMode&NeedFiles == 0 {
ld.pkgs[i].GoFiles = nil
ld.pkgs[i].OtherFiles = nil
}
if ld.Mode&NeedCompiledGoFiles == 0 {
if ld.requestedMode&NeedCompiledGoFiles == 0 {
ld.pkgs[i].CompiledGoFiles = nil
}
if ld.Mode&NeedImports == 0 {
if ld.requestedMode&NeedImports == 0 {
ld.pkgs[i].Imports = nil
}
if ld.Mode&NeedExportsFile == 0 {
if ld.requestedMode&NeedExportsFile == 0 {
ld.pkgs[i].ExportFile = ""
}
if ld.Mode&NeedTypes == 0 {
if ld.requestedMode&NeedTypes == 0 {
ld.pkgs[i].Types = nil
ld.pkgs[i].Fset = nil
ld.pkgs[i].IllTyped = false
}
if ld.Mode&NeedSyntax == 0 {
if ld.requestedMode&NeedSyntax == 0 {
ld.pkgs[i].Syntax = nil
}
if ld.Mode&NeedTypesInfo == 0 {
if ld.requestedMode&NeedTypesInfo == 0 {
ld.pkgs[i].TypesInfo = nil
}
if ld.Mode&NeedTypesSizes == 0 {
if ld.requestedMode&NeedTypesSizes == 0 {
ld.pkgs[i].TypesSizes = nil
}
}
@ -1077,8 +1080,8 @@ func (ld *loader) loadFromExportData(lpkg *loaderPackage) (*types.Package, error
return tpkg, nil
}
// addDependingLoadModes adds dependencies for choosed LoadMode in ld.Mode
func (ld *loader) addDependingLoadModes() {
// implyLoadMode adds dependencies for choosed LoadMode in ld.Mode
func (ld *loader) implyLoadMode() {
if ld.Mode&NeedTypesInfo != 0 && ld.Mode&NeedImports == 0 {
// If NeedTypesInfo, go/packages needs to do typechecking itself so it can
// associate type info with the AST. To do so, we need the export data

2
vendor/modules.txt vendored
View File

@ -198,7 +198,7 @@ golang.org/x/sys/windows
golang.org/x/text/transform
golang.org/x/text/unicode/norm
golang.org/x/text/width
# golang.org/x/tools v0.0.0-20190908161001-5b82db07426d => github.com/golangci/tools v0.0.0-20190909104219-979bdb7f8cc8
# golang.org/x/tools v0.0.0-20190908161001-5b82db07426d => github.com/golangci/tools v0.0.0-20190910062050-3540c026601b
golang.org/x/tools/go/analysis
golang.org/x/tools/go/analysis/passes/asmdecl
golang.org/x/tools/go/analysis/passes/assign