Skip to content

Commit 5ce29ec

Browse files
committed
Update linter config and fix some cases
Signed-off-by: Dirkjan Bussink <[email protected]>
1 parent 9ea6be4 commit 5ce29ec

20 files changed

+64
-83
lines changed

.golangci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
version: "2"
12
linters:
3+
exclusions:
4+
generated: lax
5+
presets:
6+
- comments
7+
- common-false-positives
8+
- std-error-handling
9+
formatters:
210
enable:
311
- goimports

Brewfile.lock.json

Lines changed: 0 additions & 40 deletions
This file was deleted.

internal/cmd/auth/login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func LoginCmd(ch *cmdutil.Helper) *cobra.Command {
2929
Short: "Authenticate with the PlanetScale API",
3030
RunE: func(cmd *cobra.Command, args []string) error {
3131
if !printer.IsTTY {
32-
return errors.New("The 'login' command requires an interactive shell")
32+
return errors.New("the 'login' command requires an interactive shell")
3333
}
3434

3535
authenticator, err := auth.New(cleanhttp.DefaultClient(), clientID, clientSecret, auth.SetBaseURL(authURL))

internal/cmd/connect/connect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func runCommand(ctx context.Context, addr, command, protocol, databaseEnvURL, da
287287
if errors.As(err, &ee) {
288288
return &cmdutil.Error{
289289
Msg: fmt.Sprintf("running command with --execute has failed: %s\n", err),
290-
ExitCode: ee.ProcessState.ExitCode(),
290+
ExitCode: ee.ExitCode(),
291291
}
292292
}
293293

internal/cmd/deployrequest/deploy_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ func TestDeployRequest_DeployBranchName(t *testing.T) {
7070

7171
org := "planetscale"
7272
db := "planetscale"
73-
var number uint64 = 10
74-
var branchName string = "dev"
73+
number := uint64(10)
74+
branchName := "dev"
7575

7676
svc := &mock.DeployRequestsService{
7777
DeployFn: func(ctx context.Context, req *ps.PerformDeployRequest) (*ps.DeployRequest, error) {

internal/cmd/deployrequest/edit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ func TestDeployRequest_EditCmd(t *testing.T) {
2525

2626
org := "planetscale"
2727
db := "planetscale"
28-
var number uint64 = 10
29-
var enable bool = true
28+
number := uint64(10)
29+
enable := true
3030

3131
svc := &mock.DeployRequestsService{
3232
AutoApplyFn: func(ctx context.Context, req *ps.AutoApplyDeployRequestRequest) (*ps.DeployRequest, error) {

internal/cmd/deployrequest/show_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ func TestDeployRequest_ShowBranchName(t *testing.T) {
7070

7171
org := "planetscale"
7272
db := "planetscale"
73-
var number uint64 = 10
74-
var branchName string = "dev"
73+
number := uint64(10)
74+
branchName := "dev"
7575

7676
svc := &mock.DeployRequestsService{
7777
GetFn: func(ctx context.Context, req *ps.GetDeployRequestRequest) (*ps.DeployRequest, error) {

internal/cmd/keyspace/vschema_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ func TestKeyspace_UpdateVSchemaCmd(t *testing.T) {
111111

112112
tmpFile, err := os.CreateTemp("", "vschema.json")
113113
c.Assert(err, qt.IsNil)
114-
tmpFile.Write([]byte(raw))
114+
_, err = tmpFile.Write([]byte(raw))
115+
c.Assert(err, qt.IsNil)
115116
tmpFile.Close()
116117

117118
cmd := UpdateVSchemaCmd(ch)

internal/cmd/workflow/cancel_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import (
66
"testing"
77
"time"
88

9-
qt "github.com/frankban/quicktest"
109
"github.com/planetscale/cli/internal/cmdutil"
1110
"github.com/planetscale/cli/internal/config"
1211
"github.com/planetscale/cli/internal/mock"
1312
"github.com/planetscale/cli/internal/printer"
13+
14+
qt "github.com/frankban/quicktest"
1415
ps "github.com/planetscale/planetscale-go/planetscale"
1516
)
1617

@@ -126,4 +127,4 @@ func TestWorkflow_CancelCmd_Error(t *testing.T) {
126127

127128
c.Assert(err, qt.Not(qt.IsNil))
128129
c.Assert(svc.CancelFnInvoked, qt.IsTrue)
129-
}
130+
}

internal/cmd/workflow/complete_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import (
66
"testing"
77
"time"
88

9-
qt "github.com/frankban/quicktest"
109
"github.com/planetscale/cli/internal/cmdutil"
1110
"github.com/planetscale/cli/internal/config"
1211
"github.com/planetscale/cli/internal/mock"
1312
"github.com/planetscale/cli/internal/printer"
13+
14+
qt "github.com/frankban/quicktest"
1415
ps "github.com/planetscale/planetscale-go/planetscale"
1516
)
1617

@@ -128,4 +129,4 @@ func TestWorkflow_CompleteCmd_Error(t *testing.T) {
128129

129130
c.Assert(err, qt.Not(qt.IsNil))
130131
c.Assert(svc.CompleteFnInvoked, qt.IsTrue)
131-
}
132+
}

0 commit comments

Comments
 (0)