Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commit18ae0da

Browse files
committed
Add golintci and fix errors
1 parent924ebad commit18ae0da

File tree

7 files changed

+28
-12
lines changed

7 files changed

+28
-12
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/image/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ ENV CI=true
55

66
RUN go get golang.org/x/tools/cmd/goimports
77
RUN go get golang.org/x/lint/golint
8-
RUN go get github.com/mattn/goveralls
8+
RUN go get github.com/mattn/goveralls
9+
RUN go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.27.0

‎ci/steps/lint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@ 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+
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-
typenotFoundButDidFindstruct {
86-
needlestring
87-
haystack []string
88-
}
89-
90-
func (nnotFoundButDidFind)Error()string {
91-
returnfmt.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
iferr:=login(cmd,u,config.URL,config.Session);err!=nil {
43-
returnxerrors.Errorf("Login error",err)
43+
returnxerrors.Errorf("login error: %w",err)
4444
}
4545
returnnil
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
functrailBuildLogs(ctx context.Context,client*coder.Client,envIDstring)error {
7676
constcheck="✅"
7777
constfailure="❌"
78-
constloading="⌛"
7978

8079
newSpinner:=func()*spinner.Spinner {returnspinner.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 (aresources)cpuUtilPercentage()string {
322323
ifa.cpuAllocation==0 {
323324
return"N/A"
324325
}
325326
returnfmt.Sprintf("%.1f%%",a.cpuUtilization/a.cpuAllocation*100)
326327
}
327328

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp