Skip to content

Commit 2611f51

Browse files
committed
lint
1 parent 4db2488 commit 2611f51

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

cli/trafficgen.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import (
88
"sync/atomic"
99
"time"
1010

11+
"github.com/google/uuid"
12+
"golang.org/x/xerrors"
13+
1114
"github.com/coder/coder/cli/clibase"
1215
"github.com/coder/coder/codersdk"
1316
"github.com/coder/coder/cryptorand"
14-
"github.com/google/uuid"
15-
"golang.org/x/xerrors"
1617
)
1718

1819
func (r *RootCmd) trafficGen() *clibase.Cmd {
@@ -76,9 +77,12 @@ func (r *RootCmd) trafficGen() *clibase.Cmd {
7677
Data: "#",
7778
})
7879
if err != nil {
79-
return xerrors.Errorf("write comment to pty: %w", err)
80+
return xerrors.Errorf("serialize request: %w", err)
8081
}
8182
_, err = crw.Write(data)
83+
if err != nil {
84+
return xerrors.Errorf("write comment to pty: %w", err)
85+
}
8286
// Now we begin writing random data to the pty.
8387
writeSize := int(bps / 10)
8488
rch := make(chan error)
@@ -176,7 +180,7 @@ func copyContext(ctx context.Context, dst io.Writer, src []byte) error {
176180
default:
177181
_, err := dst.Write(src[idx : idx+1])
178182
if err != nil {
179-
if err == io.EOF {
183+
if xerrors.Is(err, io.EOF) {
180184
return nil
181185
}
182186
return err

cli/trafficgen_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ import (
66
"strings"
77
"testing"
88

9+
"github.com/google/uuid"
10+
"github.com/stretchr/testify/require"
11+
912
"github.com/coder/coder/agent"
1013
"github.com/coder/coder/cli/clitest"
1114
"github.com/coder/coder/coderd/coderdtest"
1215
"github.com/coder/coder/codersdk/agentsdk"
1316
"github.com/coder/coder/provisioner/echo"
1417
"github.com/coder/coder/provisionersdk/proto"
1518
"github.com/coder/coder/testutil"
16-
"github.com/google/uuid"
17-
"github.com/stretchr/testify/require"
1819
)
1920

2021
// This test pretends to stand up a workspace and run a no-op traffic generation test.

0 commit comments

Comments
 (0)