Skip to content

Commit 1dc949f

Browse files
findleyrgopherbot
authored andcommitted
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 <[email protected]> Auto-Submit: Robert Findley <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
1 parent c055e89 commit 1dc949f

File tree

8 files changed

+5
-68
lines changed

8 files changed

+5
-68
lines changed

gopls/internal/settings/analysis.go

-4
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,3 @@ func init() {
216216
DefaultAnalyzers[analyzer.analyzer.Name] = analyzer
217217
}
218218
}
219-
220-
// StaticcheckAnalzyers describes available Staticcheck analyzers, keyed by
221-
// analyzer name.
222-
var StaticcheckAnalyzers = make(map[string]*Analyzer) // written by analysis_<ver>.go

gopls/internal/settings/analysis_119.go

-10
This file was deleted.

gopls/internal/settings/gofumpt_120.go renamed to gopls/internal/settings/gofumpt.go

-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.20
6-
// +build go1.20
7-
85
package settings
96

107
import (
@@ -14,8 +11,6 @@ import (
1411
"mvdan.cc/gofumpt/format"
1512
)
1613

17-
const GofumptSupported = true
18-
1914
// GofumptFormat allows the gopls module to wire in a call to
2015
// gofumpt/format.Source. langVersion and modulePath are used for some
2116
// Gofumpt formatting rules -- see the Gofumpt documentation for details.

gopls/internal/settings/gofumpt_119.go

-14
This file was deleted.

gopls/internal/settings/gofumpt_120_test.go renamed to gopls/internal/settings/gofumpt_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.20
6-
// +build go1.20
7-
85
package settings
96

107
import "testing"

gopls/internal/settings/settings.go

+2-19
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"fmt"
99
"maps"
1010
"path/filepath"
11-
"runtime"
1211
"strings"
1312
"time"
1413

@@ -1073,15 +1072,7 @@ func (o *Options) setOne(name string, value any) error {
10731072
}
10741073

10751074
case "staticcheck":
1076-
v, err := asBool(value)
1077-
if err != nil {
1078-
return err
1079-
}
1080-
if v && !StaticcheckSupported {
1081-
return fmt.Errorf("staticcheck is not supported at %s;"+
1082-
" rebuild gopls with a more recent version of Go", runtime.Version())
1083-
}
1084-
o.Staticcheck = v
1075+
return setBool(&o.Staticcheck, value)
10851076

10861077
case "local":
10871078
return setString(&o.Local, value)
@@ -1096,15 +1087,7 @@ func (o *Options) setOne(name string, value any) error {
10961087
return setBool(&o.ShowBugReports, value)
10971088

10981089
case "gofumpt":
1099-
v, err := asBool(value)
1100-
if err != nil {
1101-
return err
1102-
}
1103-
if v && !GofumptSupported {
1104-
return fmt.Errorf("gofumpt is not supported at %s;"+
1105-
" rebuild gopls with a more recent version of Go", runtime.Version())
1106-
}
1107-
o.Gofumpt = v
1090+
return setBool(&o.Gofumpt, value)
11081091

11091092
case "completeFunctionCalls":
11101093
return setBool(&o.CompleteFunctionCalls, value)

gopls/internal/settings/settings_test.go

-9
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,6 @@ func TestOptions_Set(t *testing.T) {
199199
},
200200
}
201201

202-
if !StaticcheckSupported {
203-
tests = append(tests, testCase{
204-
name: "staticcheck",
205-
value: true,
206-
check: func(o Options) bool { return o.Staticcheck == true },
207-
wantError: true, // o.StaticcheckSupported is unset
208-
})
209-
}
210-
211202
for _, test := range tests {
212203
var opts Options
213204
err := opts.Set(map[string]any{test.name: test.value})

gopls/internal/settings/analysis_120.go renamed to gopls/internal/settings/staticcheck.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build go1.20
6-
// +build go1.20
7-
85
package settings
96

107
import (
@@ -16,7 +13,9 @@ import (
1613
"honnef.co/go/tools/stylecheck"
1714
)
1815

19-
const StaticcheckSupported = true
16+
// StaticcheckAnalzyers describes available Staticcheck analyzers, keyed by
17+
// analyzer name.
18+
var StaticcheckAnalyzers = make(map[string]*Analyzer) // written by analysis_<ver>.go
2019

2120
func init() {
2221
mapSeverity := func(severity lint.Severity) protocol.DiagnosticSeverity {

0 commit comments

Comments
 (0)