Skip to content

Commit 117a486

Browse files
committed
all: merge master (ee20ddf) into gopls-release-branch.0.14
Also add back the replace directive, and tidy. For golang/go#63220 Conflicts: - gopls/go.sum Merge List: + 2023-10-05 ee20ddf internal/refactor/inline: permit return conversions in tailcall + 2023-10-05 db1d1e0 gopls/internal/lsp: go to definition from embed directive + 2023-10-05 2be977e internal/refactor/inline: work around channel type misformatting + 2023-10-04 0ba9c84 internal/fuzzy: several improvements for symbol matching + 2023-10-04 c2725ad gopls: update x/telemetry dependency + 2023-10-03 e8722c0 go/types/internal/play: show types.Selection information + 2023-10-03 a819c61 internal/refactor/inline: eliminate unnecessary binding decl + 2023-10-03 102b64b internal/refactor/inline: tweak everything-test docs again + 2023-10-03 197e2c4 internal/refactor/inline: fix broken tests + 2023-10-03 586b21a internal/refactor/inline: elide redundant braces + 2023-10-02 ca34416 internal/refactor/inline: fallible constant analysis + 2023-10-02 6a38a5f internal/refactor/inline: use default working directory + 2023-10-02 c6d331d internal/refactor/inline: don't add same import PkgName twice + 2023-10-02 1058109 internal/refactor/inline: don't insert unnecessary parens + 2023-10-02 d8e94f2 internal/refactor/inline: fix bug in shadow detection + 2023-10-02 0adbf9c gopls/internal/lsp: simplify the telemetry prompt + 2023-10-02 2ed4298 go/analysis/analysistest: format golden files before comparing + 2023-09-28 451716b internal/refactor/inline: consider "", 0.0, 1.0 duplicable + 2023-09-28 792f91f internal/refactor/inline: tweak everything test for cgo + 2023-09-28 9416299 internal/refactor/inline: fix pkgname shadowing bug + 2023-09-28 4cd12d6 gopls/internal/lsp/fake: don't set a completion budget for tests + 2023-09-28 57ecf48 gopls/internal/lsp: hover over embed directives + 2023-09-28 6de3448 gopls/internal/lsp/cache: remove snapshot.typeCheckMu + 2023-09-27 7f23bc8 gopls/internal/regtest/source/completion: reuse functionCallSnippet in unimported completion + 2023-09-27 3d03fbd gopls/internal/lsp: use matcher score in ranking unimported candidates + 2023-09-27 7577387 gopls/internal/lsp/source: don't complete to golang.org/toolchain + 2023-09-27 4b34fbf internal/refactor/inline: fix bug discard receiver and spread + 2023-09-27 6ec9b0f internal/refactor/inline: refine "last ref to caller local" + 2023-09-27 08bdfec internal/refactor/inline: split up the big table + 2023-09-27 486787e gopls/internal/lsp/source: Add ui.complete.completeFunctionCalls toggle + 2023-09-27 9d2d0e8 gopls: set a context deadline after minimal completion results + 2023-09-26 169105a internal/refactor/inline: insert conversions during substitution + 2023-09-26 b3ada30 internal/refactor/inline: analyze callee effects + 2023-09-26 1602103 internal/refactor/inline: skip cgo tests on non-cgo builders + 2023-09-26 1c8e684 internal/refactor/inline: sound treatment of named results + 2023-09-26 d32f97a internal/refactor/inline: eliminate Callee.BodyIsReturnExpr + 2023-09-26 f4abeae go/analysis/passes/directive: use strings.Cut + 2023-09-26 c42ed47 internal/refactor/inline: reject attempts to inline in cgo code + 2023-09-26 313150a internal/refactor/inline: x++ counts as assignment in escape + 2023-09-26 d6f1bb7 internal/refactor/inline: ignore line directives in testing Change-Id: I97157c76bd781c03aef407b86ac1da209846f99a
2 parents 4eb5c4f + ee20ddf commit 117a486

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4679
-650
lines changed

go/analysis/analysistest/analysistest.go

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -211,24 +211,14 @@ func RunWithSuggestedFixes(t Testing, dir string, a *analysis.Analyzer, patterns
211211
for _, vf := range ar.Files {
212212
if vf.Name == sf {
213213
found = true
214-
out, err := diff.ApplyBytes(orig, edits)
215-
if err != nil {
216-
t.Errorf("%s: error applying fixes: %v (see possible explanations at RunWithSuggestedFixes)", file.Name(), err)
217-
continue
218-
}
219214
// the file may contain multiple trailing
220215
// newlines if the user places empty lines
221216
// between files in the archive. normalize
222217
// this to a single newline.
223-
want := string(bytes.TrimRight(vf.Data, "\n")) + "\n"
224-
formatted, err := format.Source(out)
225-
if err != nil {
226-
t.Errorf("%s: error formatting edited source: %v\n%s", file.Name(), err, out)
227-
continue
228-
}
229-
if got := string(formatted); got != want {
230-
unified := diff.Unified(fmt.Sprintf("%s.golden [%s]", file.Name(), sf), "actual", want, got)
231-
t.Errorf("suggested fixes failed for %s:\n%s", file.Name(), unified)
218+
golden := append(bytes.TrimRight(vf.Data, "\n"), '\n')
219+
220+
if err := applyDiffsAndCompare(orig, golden, edits, file.Name()); err != nil {
221+
t.Errorf("%s", err)
232222
}
233223
break
234224
}
@@ -245,28 +235,39 @@ func RunWithSuggestedFixes(t Testing, dir string, a *analysis.Analyzer, patterns
245235
catchallEdits = append(catchallEdits, edits...)
246236
}
247237

248-
out, err := diff.ApplyBytes(orig, catchallEdits)
249-
if err != nil {
250-
t.Errorf("%s: error applying fixes: %v (see possible explanations at RunWithSuggestedFixes)", file.Name(), err)
251-
continue
252-
}
253-
want := string(ar.Comment)
254-
255-
formatted, err := format.Source(out)
256-
if err != nil {
257-
t.Errorf("%s: error formatting resulting source: %v\n%s", file.Name(), err, out)
258-
continue
259-
}
260-
if got := string(formatted); got != want {
261-
unified := diff.Unified(file.Name()+".golden", "actual", want, got)
262-
t.Errorf("suggested fixes failed for %s:\n%s", file.Name(), unified)
238+
if err := applyDiffsAndCompare(orig, ar.Comment, catchallEdits, file.Name()); err != nil {
239+
t.Errorf("%s", err)
263240
}
264241
}
265242
}
266243
}
267244
return r
268245
}
269246

247+
// applyDiffsAndCompare applies edits to src and compares the results against
248+
// golden after formatting both. fileName is use solely for error reporting.
249+
func applyDiffsAndCompare(src, golden []byte, edits []diff.Edit, fileName string) error {
250+
out, err := diff.ApplyBytes(src, edits)
251+
if err != nil {
252+
return fmt.Errorf("%s: error applying fixes: %v (see possible explanations at RunWithSuggestedFixes)", fileName, err)
253+
}
254+
wantRaw, err := format.Source(golden)
255+
if err != nil {
256+
return fmt.Errorf("%s.golden: error formatting golden file: %v\n%s", fileName, err, out)
257+
}
258+
want := string(wantRaw)
259+
260+
formatted, err := format.Source(out)
261+
if err != nil {
262+
return fmt.Errorf("%s: error formatting resulting source: %v\n%s", fileName, err, out)
263+
}
264+
if got := string(formatted); got != want {
265+
unified := diff.Unified(fileName+".golden", "actual", want, got)
266+
return fmt.Errorf("suggested fixes failed for %s:\n%s", fileName, unified)
267+
}
268+
return nil
269+
}
270+
270271
// Run applies an analysis to the packages denoted by the "go list" patterns.
271272
//
272273
// It loads the packages from the specified

go/analysis/analysistest/analysistest_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ func main() {
7070
7171
// OK (multiple expectations on same line)
7272
println(); println() // want "call of println(...)" "call of println(...)"
73+
74+
// A Line that is not formatted correctly in the golden file.
7375
}
7476
7577
// OK (facts and diagnostics on same line)
@@ -109,6 +111,8 @@ func main() {
109111
// OK (multiple expectations on same line)
110112
println_TEST_()
111113
println_TEST_() // want "call of println(...)" "call of println(...)"
114+
115+
// A Line that is not formatted correctly in the golden file.
112116
}
113117
114118
// OK (facts and diagnostics on same line)

go/analysis/passes/directive/directive.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (check *checker) nonGoFile(pos token.Pos, fullText string) {
124124
for text != "" {
125125
offset := len(fullText) - len(text)
126126
var line string
127-
line, text, _ = stringsCut(text, "\n")
127+
line, text, _ = strings.Cut(text, "\n")
128128

129129
if !inStar && strings.HasPrefix(line, "//") {
130130
check.comment(pos+token.Pos(offset), line)
@@ -137,7 +137,7 @@ func (check *checker) nonGoFile(pos token.Pos, fullText string) {
137137
line = strings.TrimSpace(line)
138138
if inStar {
139139
var ok bool
140-
_, line, ok = stringsCut(line, "*/")
140+
_, line, ok = strings.Cut(line, "*/")
141141
if !ok {
142142
break
143143
}
@@ -200,14 +200,6 @@ func (check *checker) comment(pos token.Pos, line string) {
200200
}
201201
}
202202

203-
// Go 1.18 strings.Cut.
204-
func stringsCut(s, sep string) (before, after string, found bool) {
205-
if i := strings.Index(s, sep); i >= 0 {
206-
return s[:i], s[i+len(sep):], true
207-
}
208-
return s, "", false
209-
}
210-
211203
// Go 1.20 strings.CutPrefix.
212204
func stringsCutPrefix(s, prefix string) (after string, found bool) {
213205
if !strings.HasPrefix(s, prefix) {

go/types/internal/play/play.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,26 @@ func handleSelectJSON(w http.ResponseWriter, req *http.Request) {
173173
}
174174
}
175175

176+
// selection x.f information (if cursor is over .f)
177+
for _, n := range path[:2] {
178+
if sel, ok := n.(*ast.SelectorExpr); ok {
179+
seln, ok := pkg.TypesInfo.Selections[sel]
180+
if ok {
181+
fmt.Fprintf(out, "Selection: %s recv=%v obj=%v type=%v indirect=%t index=%d\n\n",
182+
strings.Fields("FieldVal MethodVal MethodExpr")[seln.Kind()],
183+
seln.Recv(),
184+
seln.Obj(),
185+
seln.Type(),
186+
seln.Indirect(),
187+
seln.Index())
188+
189+
} else {
190+
fmt.Fprintf(out, "Selector is qualified identifier.\n\n")
191+
}
192+
break
193+
}
194+
}
195+
176196
// Object type information.
177197
switch n := path[0].(type) {
178198
case *ast.Ident:

gopls/doc/settings.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,16 @@ such as "someSlice.sort!".
269269

270270
Default: `true`.
271271

272+
##### **completeFunctionCalls** *bool*
273+
274+
completeFunctionCalls enables function call completion.
275+
276+
When completing a statement, or when a function return type matches the
277+
expected of the expression being completed, completion may suggest call
278+
expressions (i.e. may include parentheses).
279+
280+
Default: `true`.
281+
272282
#### Diagnostic
273283

274284
##### **analyses** *map[string]bool*

gopls/go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
golang.org/x/mod v0.12.0
1111
golang.org/x/sync v0.3.0
1212
golang.org/x/sys v0.12.0
13-
golang.org/x/telemetry v0.0.0-20230923135512-f45a5404d02c
13+
golang.org/x/telemetry v0.0.0-20231003223302-0168ef4ebbd3
1414
golang.org/x/text v0.13.0
1515
golang.org/x/tools v0.13.1-0.20230925193239-ccd6b0e95a6a
1616
golang.org/x/vuln v1.0.1
@@ -26,3 +26,5 @@ require (
2626
golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338 // indirect
2727

2828
)
29+
30+
replace golang.org/x/tools => ../

gopls/go.sum

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
22
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
3+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
34
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
45
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
56
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
67
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
8+
github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
9+
github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786/go.mod h1:apVn/GCasLZUVpAJ6oWAuyP7Ne7CEsQbTnc0plM3m+o=
10+
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
11+
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
12+
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
713
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
814
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
15+
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
916
github.com/google/safehtml v0.0.2/go.mod h1:L4KWwDsUJdECRAEpZoBn3O64bQaywRscowZjJAzjHnU=
1017
github.com/google/safehtml v0.1.0 h1:EwLKo8qawTKfsi0orxcQAZzu07cICaBeFMegAU9eaT8=
1118
github.com/google/safehtml v0.1.0/go.mod h1:L4KWwDsUJdECRAEpZoBn3O64bQaywRscowZjJAzjHnU=
@@ -15,38 +22,63 @@ github.com/jba/templatecheck v0.6.0 h1:SwM8C4hlK/YNLsdcXStfnHWE2HKkuTVwy5FKQHt5r
1522
github.com/jba/templatecheck v0.6.0/go.mod h1:/1k7EajoSErFI9GLHAsiIJEaNLt3ALKNw2TV7z2SYv4=
1623
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
1724
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
25+
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
1826
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
1927
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
2028
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
29+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
2130
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
2231
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2332
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
33+
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
2434
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
2535
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
36+
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
2637
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
2738
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
2839
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
2940
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
3041
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
42+
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
43+
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
44+
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
45+
golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
3146
golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
3247
golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
48+
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
49+
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
50+
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
51+
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
3352
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
3453
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
54+
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
55+
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
56+
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
3557
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
58+
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3659
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
3760
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
61+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
62+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
63+
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
64+
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
65+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
66+
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
67+
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3868
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
3969
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
40-
golang.org/x/telemetry v0.0.0-20230923135512-f45a5404d02c h1:az7Rs3XV7P68bKMPT50p2X4su02nhHqtDOi9T8f3IEw=
41-
golang.org/x/telemetry v0.0.0-20230923135512-f45a5404d02c/go.mod h1:ppZ76JTkRgJC2GQEgtVY3fiuJR+N8FU2MAlp+gfN1E4=
70+
golang.org/x/telemetry v0.0.0-20231003223302-0168ef4ebbd3 h1:vxxQvncMbcRAtqHV5HsHGJkbya+BIOYIY+y6cdPZhzk=
71+
golang.org/x/telemetry v0.0.0-20231003223302-0168ef4ebbd3/go.mod h1:ppZ76JTkRgJC2GQEgtVY3fiuJR+N8FU2MAlp+gfN1E4=
72+
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
73+
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
74+
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
4275
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
76+
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
4377
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
4478
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
45-
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
46-
golang.org/x/tools v0.13.1-0.20230925193239-ccd6b0e95a6a h1:6OVH6eKlHOm8nM+hiSjdlbkNKMlfeZc+HWLYfG8QWns=
47-
golang.org/x/tools v0.13.1-0.20230925193239-ccd6b0e95a6a/go.mod h1:UT0HyK+PbVxjduiWXEYi1mODDynTaoTRHJox7q8FIKk=
4879
golang.org/x/vuln v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU=
4980
golang.org/x/vuln v1.0.1/go.mod h1:bb2hMwln/tqxg32BNY4CcxHWtHXuYa3SbIBmtsyjxtM=
81+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
5082
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
5183
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
5284
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
@@ -61,5 +93,6 @@ honnef.co/go/tools v0.4.5 h1:YGD4H+SuIOOqsyoLOpZDWcieM28W47/zRO7f+9V3nvo=
6193
honnef.co/go/tools v0.4.5/go.mod h1:GUV+uIBCLpdf0/v6UhHHG/yzI/z6qPskBeQCjcNB96k=
6294
mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
6395
mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ=
96+
mvdan.cc/unparam v0.0.0-20230312165513-e84e2d14e3b8/go.mod h1:Oh/d7dEtzsNHGOq1Cdv8aMm3KdKhVvPbRQcM8WFpBR8=
6497
mvdan.cc/xurls/v2 v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
6598
mvdan.cc/xurls/v2 v2.4.0/go.mod h1:+GEjq9uNjqs8LQfM9nVnM8rff0OQ5Iash5rzX+N1CSg=

gopls/internal/lsp/cache/check.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,6 @@ type (
323323
//
324324
// Both pre and post may be called concurrently.
325325
func (s *snapshot) forEachPackage(ctx context.Context, ids []PackageID, pre preTypeCheck, post postTypeCheck) error {
326-
s.typeCheckMu.Lock()
327-
defer s.typeCheckMu.Unlock()
328-
329326
ctx, done := event.Start(ctx, "cache.forEachPackage", tag.PackageCount.Of(len(ids)))
330327
defer done()
331328

gopls/internal/lsp/cache/snapshot.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,6 @@ type snapshot struct {
176176
ignoreFilterOnce sync.Once
177177
ignoreFilter *ignoreFilter
178178

179-
// typeCheckMu guards type checking.
180-
//
181-
// Only one type checking pass should be running at a given time, for two reasons:
182-
// 1. type checking batches are optimized to use all available processors.
183-
// Generally speaking, running two type checking batches serially is about
184-
// as fast as running them in parallel.
185-
// 2. type checking produces cached artifacts that may be re-used by the
186-
// next type-checking batch: the shared import graph and the set of
187-
// active packages. Running type checking batches in parallel after an
188-
// invalidation can cause redundant calculation of this shared state.
189-
typeCheckMu sync.Mutex
190-
191179
// options holds the user configuration at the time this snapshot was
192180
// created.
193181
options *source.Options

gopls/internal/lsp/command/interface.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type Interface interface {
3737
//
3838
// Applies a fix to a region of source code.
3939
ApplyFix(context.Context, ApplyFixArgs) error
40+
4041
// Test: Run test(s) (legacy)
4142
//
4243
// Runs `go test` for a specific set of test or benchmark functions.

0 commit comments

Comments
 (0)