зеркало из https://github.com/golang/tools.git
internal/settings: simplify linking now that we only build with 1.23
Since gopls now only builds with the latest version of Go, we no longer need special linking to align with the compatibility windows of gufumpt or staticcheck. Updates golang/go#65917 Change-Id: I7d5ebe6807b34ed8d44e726c7a6585d4c7c7e696 Reviewed-on: https://go-review.googlesource.com/c/tools/+/612055 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Findley <rfindley@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Родитель
c055e89c76
Коммит
1dc949f0bf
|
@ -216,7 +216,3 @@ func init() {
|
|||
DefaultAnalyzers[analyzer.analyzer.Name] = analyzer
|
||||
}
|
||||
}
|
||||
|
||||
// StaticcheckAnalzyers describes available Staticcheck analyzers, keyed by
|
||||
// analyzer name.
|
||||
var StaticcheckAnalyzers = make(map[string]*Analyzer) // written by analysis_<ver>.go
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright 2021 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.
|
||||
|
||||
//go:build !go1.20
|
||||
// +build !go1.20
|
||||
|
||||
package settings
|
||||
|
||||
const StaticcheckSupported = false
|
|
@ -2,9 +2,6 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.20
|
||||
// +build go1.20
|
||||
|
||||
package settings
|
||||
|
||||
import (
|
||||
|
@ -14,8 +11,6 @@ import (
|
|||
"mvdan.cc/gofumpt/format"
|
||||
)
|
||||
|
||||
const GofumptSupported = true
|
||||
|
||||
// GofumptFormat allows the gopls module to wire in a call to
|
||||
// gofumpt/format.Source. langVersion and modulePath are used for some
|
||||
// Gofumpt formatting rules -- see the Gofumpt documentation for details.
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright 2021 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.
|
||||
|
||||
//go:build !go1.20
|
||||
// +build !go1.20
|
||||
|
||||
package settings
|
||||
|
||||
import "context"
|
||||
|
||||
const GofumptSupported = false
|
||||
|
||||
var GofumptFormat func(ctx context.Context, langVersion, modulePath string, src []byte) ([]byte, error)
|
|
@ -2,9 +2,6 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.20
|
||||
// +build go1.20
|
||||
|
||||
package settings
|
||||
|
||||
import "testing"
|
|
@ -8,7 +8,6 @@ import (
|
|||
"fmt"
|
||||
"maps"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -1073,15 +1072,7 @@ func (o *Options) setOne(name string, value any) error {
|
|||
}
|
||||
|
||||
case "staticcheck":
|
||||
v, err := asBool(value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if v && !StaticcheckSupported {
|
||||
return fmt.Errorf("staticcheck is not supported at %s;"+
|
||||
" rebuild gopls with a more recent version of Go", runtime.Version())
|
||||
}
|
||||
o.Staticcheck = v
|
||||
return setBool(&o.Staticcheck, value)
|
||||
|
||||
case "local":
|
||||
return setString(&o.Local, value)
|
||||
|
@ -1096,15 +1087,7 @@ func (o *Options) setOne(name string, value any) error {
|
|||
return setBool(&o.ShowBugReports, value)
|
||||
|
||||
case "gofumpt":
|
||||
v, err := asBool(value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if v && !GofumptSupported {
|
||||
return fmt.Errorf("gofumpt is not supported at %s;"+
|
||||
" rebuild gopls with a more recent version of Go", runtime.Version())
|
||||
}
|
||||
o.Gofumpt = v
|
||||
return setBool(&o.Gofumpt, value)
|
||||
|
||||
case "completeFunctionCalls":
|
||||
return setBool(&o.CompleteFunctionCalls, value)
|
||||
|
|
|
@ -199,15 +199,6 @@ func TestOptions_Set(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
if !StaticcheckSupported {
|
||||
tests = append(tests, testCase{
|
||||
name: "staticcheck",
|
||||
value: true,
|
||||
check: func(o Options) bool { return o.Staticcheck == true },
|
||||
wantError: true, // o.StaticcheckSupported is unset
|
||||
})
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
var opts Options
|
||||
err := opts.Set(map[string]any{test.name: test.value})
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build go1.20
|
||||
// +build go1.20
|
||||
|
||||
package settings
|
||||
|
||||
import (
|
||||
|
@ -16,7 +13,9 @@ import (
|
|||
"honnef.co/go/tools/stylecheck"
|
||||
)
|
||||
|
||||
const StaticcheckSupported = true
|
||||
// StaticcheckAnalzyers describes available Staticcheck analyzers, keyed by
|
||||
// analyzer name.
|
||||
var StaticcheckAnalyzers = make(map[string]*Analyzer) // written by analysis_<ver>.go
|
||||
|
||||
func init() {
|
||||
mapSeverity := func(severity lint.Severity) protocol.DiagnosticSeverity {
|
Загрузка…
Ссылка в новой задаче