Skip to content

Commit 2dc99c8

Browse files
authored
fix: correct spurious edits made during the lint fixing slog (coder#17113)
1 parent 6bb4bdb commit 2dc99c8

File tree

3 files changed

+17
-29
lines changed

3 files changed

+17
-29
lines changed

.golangci.yaml

+4-27
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,19 @@ linters-settings:
2424
enabled-checks:
2525
# - appendAssign
2626
# - appendCombine
27-
- argOrder
2827
# - assignOp
2928
# - badCall
30-
- badCond
3129
- badLock
3230
- badRegexp
3331
- boolExprSimplify
3432
# - builtinShadow
3533
- builtinShadowDecl
36-
- captLocal
37-
- caseOrder
38-
- codegenComment
3934
# - commentedOutCode
4035
- commentedOutImport
41-
- commentFormatting
42-
- defaultCaseOrder
4336
- deferUnlambda
4437
# - deprecatedComment
4538
# - docStub
46-
- dupArg
47-
- dupBranchBody
48-
- dupCase
4939
- dupImport
50-
- dupSubExpr
5140
# - elseif
5241
- emptyFallthrough
5342
# - emptyStringTest
@@ -56,56 +45,43 @@ linters-settings:
5645
# - exitAfterDefer
5746
# - exposedSyncMutex
5847
# - filepathJoin
59-
- flagDeref
60-
- flagName
6148
- hexLiteral
6249
# - httpNoBody
6350
# - hugeParam
6451
# - ifElseChain
6552
# - importShadow
6653
- indexAlloc
6754
- initClause
68-
- mapKey
6955
- methodExprCall
7056
# - nestingReduce
71-
- newDeref
7257
- nilValReturn
7358
# - octalLiteral
74-
- offBy1
7559
# - paramTypeCombine
7660
# - preferStringWriter
7761
# - preferWriteByte
7862
# - ptrToRefParam
7963
# - rangeExprCopy
8064
# - rangeValCopy
81-
- regexpMust
8265
- regexpPattern
8366
# - regexpSimplify
8467
- ruleguard
85-
- singleCaseSwitch
86-
- sloppyLen
8768
# - sloppyReassign
88-
- sloppyTypeAssert
8969
- sortSlice
9070
- sprintfQuotedString
9171
- sqlQuery
9272
# - stringConcatSimplify
9373
# - stringXbytes
9474
# - suspiciousSorting
95-
- switchTrue
9675
- truncateCmp
9776
- typeAssertChain
9877
# - typeDefFirst
99-
- typeSwitchVar
10078
# - typeUnparen
101-
- underef
10279
# - unlabelStmt
10380
# - unlambda
10481
# - unnamedResult
10582
# - unnecessaryBlock
10683
# - unnecessaryDefer
10784
# - unslice
108-
- valSwap
10985
- weakCond
11086
# - whyNoLint
11187
# - wrapperFunc
@@ -208,7 +184,7 @@ issues:
208184
- node_modules
209185
- .git
210186

211-
skip-files:
187+
exclude-files:
212188
- scripts/rules.go
213189

214190
# Rules listed here: https://github.com/securego/gosec#available-rules
@@ -224,15 +200,16 @@ issues:
224200
- path: scripts/*
225201
linters:
226202
- exhaustruct
203+
- path: scripts/rules.go
204+
linters:
205+
- ALL
227206

228207
fix: true
229208
max-issues-per-linter: 0
230209
max-same-issues: 0
231210

232211
run:
233212
timeout: 10m
234-
skip-files:
235-
- scripts/rules.go
236213

237214
# Over time, add more and more linters from
238215
# https://golangci-lint.run/usage/linters/ as the code improves.

cmd/coder/main.go

+11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
package main
22

33
import (
4+
"fmt"
5+
"os"
46
_ "time/tzdata"
57

8+
tea "github.com/charmbracelet/bubbletea"
9+
10+
"github.com/coder/coder/v2/agent/agentexec"
611
_ "github.com/coder/coder/v2/buildinfo/resources"
712
"github.com/coder/coder/v2/cli"
813
)
914

1015
func main() {
16+
if len(os.Args) > 1 && os.Args[1] == "agent-exec" {
17+
err := agentexec.CLI()
18+
_, _ = fmt.Fprintln(os.Stderr, err)
19+
os.Exit(1)
20+
}
1121
// This preserves backwards compatibility with an init function that is causing grief for
1222
// web terminals using agent-exec + screen. See https://github.com/coder/coder/pull/15817
23+
tea.InitTerminal()
1324

1425
var rootCmd cli.RootCmd
1526
rootCmd.RunWithSubcommands(rootCmd.AGPL())

scripts/migrate-test/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ func main() {
9595
dumpBytesAfter, err := dbtestutil.PGDumpSchemaOnly(postgresURL)
9696
if err != nil {
9797
friendlyError(os.Stderr, err, migrateFromVersion, migrateToVersion)
98-
panic("")
98+
panic(err)
9999
}
100100

101101
if diff := cmp.Diff(string(dumpBytesAfter), string(stripGenPreamble(expectedSchemaAfter))); diff != "" {
102102
friendlyError(os.Stderr, xerrors.Errorf("Schema differs from expected after migration: %s", diff), migrateFromVersion, migrateToVersion)
103-
panic("")
103+
panic(err)
104104
}
105105
_, _ = fmt.Fprintf(os.Stderr, "OK\n")
106106
}

0 commit comments

Comments
 (0)