Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 8b8e54f

Browse files
committed
Add golintci and fix errors
1 parent 8917fb8 commit 8b8e54f

File tree

6 files changed

+31
-11
lines changed

6 files changed

+31
-11
lines changed

.golangci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# See https://golangci-lint.run/usage/configuration/
2+
linters-settings:
3+
goconst:
4+
min-len: 4
5+
min-occurrences: 3
6+
gocognit:
7+
min-complexity: 46
8+
nestif:
9+
min-complexity: 10
10+
govet:
11+
settings:
12+
printf:
13+
funcs: # Run `go tool vet help printf` to see available settings for `printf` analyzer.
14+
- (cdr.dev/coder-cli/internal/clog).Tipf
15+
- (cdr.dev/coder-cli/internal/clog).Hintf
16+
- (cdr.dev/coder-cli/internal/clog).LogDebugf
17+
- (cdr.dev/coder-cli/internal/clog).Causef

ci/steps/lint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,16 @@ set -euo pipefail
44

55
echo "Linting..."
66

7+
cd "$(dirname "$0")"
8+
cd ../../
9+
710
go vet ./...
811
golint -set_exit_status ./...
12+
13+
echo "--- golangci-lint"
14+
# Install outside of the repo so the go.mod isn't affected.
15+
pushd ~/go
16+
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.27.0
17+
popd
18+
19+
~/go/bin/golangci-lint run -c .golangci.yml

internal/cmd/ceapi.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,3 @@ func findEnv(ctx context.Context, client *coder.Client, envName, userEmail strin
8181
clog.Tip("run \"coder envs ls\" to view your environments"),
8282
)
8383
}
84-
85-
type notFoundButDidFind struct {
86-
needle string
87-
haystack []string
88-
}
89-
90-
func (n notFoundButDidFind) Error() string {
91-
return fmt.Sprintf("\"%s\" not found in %q: %v", n.needle, n.haystack, coder.ErrNotFound)
92-
}

internal/cmd/login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func makeLoginCmd() *cobra.Command {
4040
// Don't return errors as it would print the usage.
4141

4242
if err := login(cmd, u, config.URL, config.Session); err != nil {
43-
return xerrors.Errorf("Login error", err)
43+
return xerrors.Errorf("login error: %w", err)
4444
}
4545
return nil
4646
},

internal/cmd/rebuild.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ coder envs rebuild backend-env --force`,
7575
func trailBuildLogs(ctx context.Context, client *coder.Client, envID string) error {
7676
const check = "✅"
7777
const failure = "❌"
78-
const loading = "⌛"
7978

8079
newSpinner := func() *spinner.Spinner { return spinner.New(spinner.CharSets[11], 100*time.Millisecond) }
8180

internal/cmd/resourcemanager.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,15 @@ func (a resources) String() string {
318318
// )
319319
}
320320

321+
//nolint:unused
321322
func (a resources) cpuUtilPercentage() string {
322323
if a.cpuAllocation == 0 {
323324
return "N/A"
324325
}
325326
return fmt.Sprintf("%.1f%%", a.cpuUtilization/a.cpuAllocation*100)
326327
}
327328

329+
//nolint:unused
328330
func (a resources) memUtilPercentage() string {
329331
if a.memAllocation == 0 {
330332
return "N/A"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy