Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fb1ff80

Browse files
committed
lint
1 parent 205ac96 commit fb1ff80

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

codersdk/client.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,13 @@ func (c *Client) request(ctx context.Context, method, path string, body interfac
8686
func (c *Client) websocket(ctx context.Context, path string) (*websocket.Conn, error) {
8787
serverURL, err := c.URL.Parse(path)
8888
if err != nil {
89-
return nil, xerrors.Errorf("parse url: %w", err)
89+
return nil, xerrors.Errorf("parse path: %w", err)
9090
}
9191

9292
apiURL, err := url.Parse(serverURL.String())
93+
if err != nil {
94+
return nil, xerrors.Errorf("parse server url: %w", err)
95+
}
9396
apiURL.Scheme = "ws"
9497
if serverURL.Scheme == "https" {
9598
apiURL.Scheme = "wss"
@@ -100,7 +103,7 @@ func (c *Client) websocket(ctx context.Context, path string) (*websocket.Conn, e
100103
apiURL.RawQuery = q.Encode()
101104

102105
//nolint:bodyclose
103-
conn, _, err := websocket.Dial(context.Background(), apiURL.String(), &websocket.DialOptions{
106+
conn, _, err := websocket.Dial(ctx, apiURL.String(), &websocket.DialOptions{
104107
HTTPClient: c.HTTPClient,
105108
})
106109
if err != nil {

codersdk/workspaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (w *WorkspaceWatcher) Read(ctx context.Context) (Workspace, error) {
102102
var ws Workspace
103103
err := wsjson.Read(ctx, w.conn, &ws)
104104
if err != nil {
105-
return ws, xerrors.Errorf("read workspace: %w")
105+
return ws, xerrors.Errorf("read workspace: %w", err)
106106
}
107107

108108
return ws, nil

0 commit comments

Comments
 (0)