Skip to content

Commit 7751c71

Browse files
committed
all: fix lint suggestions
Signed-off-by: Koichi Shiraishi <[email protected]>
1 parent 09358ba commit 7751c71

22 files changed

+123
-8
lines changed

base_json.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func (v *ProgressToken) MarshalJSON() ([]byte, error) {
6666
if v.name != "" {
6767
return json.Marshal(v.name)
6868
}
69+
6970
return json.Marshal(v.number)
7071
}
7172

@@ -75,5 +76,6 @@ func (v *ProgressToken) UnmarshalJSON(data []byte) error {
7576
if err := json.Unmarshal(data, &v.number); err == nil {
7677
return nil
7778
}
79+
7880
return json.Unmarshal(data, &v.name)
7981
}

basic_gojay.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ var (
646646
// MarshalJSONObject implements gojay.MarshalerJSONObject.
647647
func (v TextEditsMap) MarshalJSONObject(enc *gojay.Encoder) {
648648
for key, value := range v {
649+
value := value
649650
enc.ArrayKeyOmitEmpty(string(key), (*TextEdits)(&value))
650651
}
651652
}
@@ -710,6 +711,7 @@ var (
710711
// MarshalJSONObject implements gojay.MarshalerJSONObject.
711712
func (v ChangeAnnotationsMap) MarshalJSONObject(enc *gojay.Encoder) {
712713
for key, value := range v {
714+
value := value
713715
enc.ObjectKeyOmitEmpty(string(key), &value)
714716
}
715717
}

basic_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2414,6 +2414,8 @@ func testTextDocumentItem(t *testing.T, marshal marshalFunc, unmarshal unmarshal
24142414
}
24152415

24162416
func TestToLanguageIdentifier(t *testing.T) {
2417+
t.Parallel()
2418+
24172419
tests := []struct {
24182420
name string
24192421
ft string

client.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ func ClientHandler(client Client, handler jsonrpc2.Handler) jsonrpc2.Handler {
2626
h := func(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2.Request) error {
2727
if ctx.Err() != nil {
2828
xctx := xcontext.Detach(ctx)
29+
2930
return reply(xctx, nil, ErrRequestCancelled)
3031
}
3132

3233
handled, err := clientDispatch(ctx, client, reply, req)
3334
if handled || err != nil {
3435
return err
3536
}
37+
3638
return handler(ctx, reply, req)
3739
}
3840

@@ -169,6 +171,7 @@ func (c *client) ShowMessageRequest(ctx context.Context, params *ShowMessageRequ
169171
if err := Call(ctx, c.Conn, MethodWindowShowMessageRequest, params, &result); err != nil {
170172
return nil, err
171173
}
174+
172175
return result, nil
173176
}
174177

@@ -209,6 +212,7 @@ func (c *client) ApplyEdit(ctx context.Context, params *ApplyWorkspaceEditParams
209212
if err := Call(ctx, c.Conn, MethodWorkspaceApplyEdit, params, &result); err != nil {
210213
return false, err
211214
}
215+
212216
return result, nil
213217
}
214218

@@ -225,6 +229,7 @@ func (c *client) Configuration(ctx context.Context, params *ConfigurationParams)
225229
if err := Call(ctx, c.Conn, MethodWorkspaceConfiguration, params, &result); err != nil {
226230
return nil, err
227231
}
232+
228233
return result, nil
229234
}
230235

@@ -240,5 +245,6 @@ func (c *client) WorkspaceFolders(ctx context.Context) (result []WorkspaceFolder
240245
if err := Call(ctx, c.Conn, MethodWorkspaceWorkspaceFolders, nil, &result); err != nil {
241246
return nil, err
242247
}
248+
243249
return result, nil
244250
}

client_gojay.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
)
2020

2121
// clientDispatch implements jsonrpc2.Conn.
22-
//nolint:funlen,gocognit
22+
//nolint:funlen
2323
func clientDispatch(ctx context.Context, client Client, reply jsonrpc2.Replier, req jsonrpc2.Request) (handled bool, err error) {
2424
if ctx.Err() != nil {
2525
return true, reply(ctx, nil, ErrRequestCancelled)

client_json.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
)
1919

2020
// clientDispatch implements jsonrpc2.Handler.
21-
//nolint:gocognit,funlen
21+
//nolint:funlen,cyclop
2222
func clientDispatch(ctx context.Context, client Client, reply jsonrpc2.Replier, req jsonrpc2.Request) (handled bool, err error) {
2323
if ctx.Err() != nil {
2424
return true, reply(ctx, nil, ErrRequestCancelled)

deprecated.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// SPDX-FileCopyrightText: Copyright 2021 The Go Language Server Authors
2+
// SPDX-License-Identifier: BSD-3-Clause
3+
14
package protocol
25

36
// ClientCapabilitiesShowDocument alias of ShowDocumentClientCapabilities.

diagnostics_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ func testDiagnostic(t *testing.T, marshal marshalFunc, unmarshal unmarshalFunc)
312312
}
313313

314314
func TestDiagnosticSeverity_String(t *testing.T) {
315+
t.Parallel()
316+
315317
tests := []struct {
316318
name string
317319
d DiagnosticSeverity
@@ -356,6 +358,8 @@ func TestDiagnosticSeverity_String(t *testing.T) {
356358
}
357359

358360
func TestDiagnosticTag_String(t *testing.T) {
361+
t.Parallel()
362+
359363
tests := []struct {
360364
name string
361365
d DiagnosticTag
@@ -443,8 +447,7 @@ func testDiagnosticRelatedInformation(t *testing.T, marshal marshalFunc, unmarsh
443447

444448
got, err := marshal(&tt.field)
445449
if (err != nil) != tt.wantMarshalErr {
446-
t.Error(err)
447-
return
450+
t.Fatal(err)
448451
}
449452

450453
if diff := cmp.Diff(tt.want, string(got)); (diff != "") != tt.wantErr {

general_gojay_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// Copyright 2019 The Go Language Server Authors. All rights reserved.
2-
// Use of this source code is governed by a BSD-style
3-
// license that can be found in the LICENSE file.
1+
// SPDX-FileCopyrightText: Copyright 2019 The Go Language Server Authors
2+
// SPDX-License-Identifier: BSD-3-Clause
43

54
//go:build gojay
65
// +build gojay

general_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,6 +3416,8 @@ func testDocumentColorRegistrationOptions(t *testing.T, marshal marshalFunc, unm
34163416
}
34173417

34183418
func TestPrepareSupportDefaultBehavior_String(t *testing.T) {
3419+
t.Parallel()
3420+
34193421
tests := []struct {
34203422
name string
34213423
k PrepareSupportDefaultBehavior
@@ -4215,6 +4217,8 @@ func testShowDocumentResult(t *testing.T, marshal marshalFunc, unmarshal unmarsh
42154217
}
42164218

42174219
func TestTextDocumentSyncKind_String(t *testing.T) {
4220+
t.Parallel()
4221+
42184222
tests := []struct {
42194223
name string
42204224
k TextDocumentSyncKind

0 commit comments

Comments
 (0)