fix: correct spurious edits made during the lint fixing slog (#17113)

This commit is contained in:
Jon Ayers
2025-03-27 01:13:21 -05:00
committed by GitHub
parent 6bb4bdb9cb
commit 2dc99c8469
3 changed files with 17 additions and 29 deletions
+4 -27
View File
@@ -24,30 +24,19 @@ linters-settings:
enabled-checks: enabled-checks:
# - appendAssign # - appendAssign
# - appendCombine # - appendCombine
- argOrder
# - assignOp # - assignOp
# - badCall # - badCall
- badCond
- badLock - badLock
- badRegexp - badRegexp
- boolExprSimplify - boolExprSimplify
# - builtinShadow # - builtinShadow
- builtinShadowDecl - builtinShadowDecl
- captLocal
- caseOrder
- codegenComment
# - commentedOutCode # - commentedOutCode
- commentedOutImport - commentedOutImport
- commentFormatting
- defaultCaseOrder
- deferUnlambda - deferUnlambda
# - deprecatedComment # - deprecatedComment
# - docStub # - docStub
- dupArg
- dupBranchBody
- dupCase
- dupImport - dupImport
- dupSubExpr
# - elseif # - elseif
- emptyFallthrough - emptyFallthrough
# - emptyStringTest # - emptyStringTest
@@ -56,8 +45,6 @@ linters-settings:
# - exitAfterDefer # - exitAfterDefer
# - exposedSyncMutex # - exposedSyncMutex
# - filepathJoin # - filepathJoin
- flagDeref
- flagName
- hexLiteral - hexLiteral
# - httpNoBody # - httpNoBody
# - hugeParam # - hugeParam
@@ -65,47 +52,36 @@ linters-settings:
# - importShadow # - importShadow
- indexAlloc - indexAlloc
- initClause - initClause
- mapKey
- methodExprCall - methodExprCall
# - nestingReduce # - nestingReduce
- newDeref
- nilValReturn - nilValReturn
# - octalLiteral # - octalLiteral
- offBy1
# - paramTypeCombine # - paramTypeCombine
# - preferStringWriter # - preferStringWriter
# - preferWriteByte # - preferWriteByte
# - ptrToRefParam # - ptrToRefParam
# - rangeExprCopy # - rangeExprCopy
# - rangeValCopy # - rangeValCopy
- regexpMust
- regexpPattern - regexpPattern
# - regexpSimplify # - regexpSimplify
- ruleguard - ruleguard
- singleCaseSwitch
- sloppyLen
# - sloppyReassign # - sloppyReassign
- sloppyTypeAssert
- sortSlice - sortSlice
- sprintfQuotedString - sprintfQuotedString
- sqlQuery - sqlQuery
# - stringConcatSimplify # - stringConcatSimplify
# - stringXbytes # - stringXbytes
# - suspiciousSorting # - suspiciousSorting
- switchTrue
- truncateCmp - truncateCmp
- typeAssertChain - typeAssertChain
# - typeDefFirst # - typeDefFirst
- typeSwitchVar
# - typeUnparen # - typeUnparen
- underef
# - unlabelStmt # - unlabelStmt
# - unlambda # - unlambda
# - unnamedResult # - unnamedResult
# - unnecessaryBlock # - unnecessaryBlock
# - unnecessaryDefer # - unnecessaryDefer
# - unslice # - unslice
- valSwap
- weakCond - weakCond
# - whyNoLint # - whyNoLint
# - wrapperFunc # - wrapperFunc
@@ -208,7 +184,7 @@ issues:
- node_modules - node_modules
- .git - .git
skip-files: exclude-files:
- scripts/rules.go - scripts/rules.go
# Rules listed here: https://github.com/securego/gosec#available-rules # Rules listed here: https://github.com/securego/gosec#available-rules
@@ -224,6 +200,9 @@ issues:
- path: scripts/* - path: scripts/*
linters: linters:
- exhaustruct - exhaustruct
- path: scripts/rules.go
linters:
- ALL
fix: true fix: true
max-issues-per-linter: 0 max-issues-per-linter: 0
@@ -231,8 +210,6 @@ issues:
run: run:
timeout: 10m timeout: 10m
skip-files:
- scripts/rules.go
# Over time, add more and more linters from # Over time, add more and more linters from
# https://golangci-lint.run/usage/linters/ as the code improves. # https://golangci-lint.run/usage/linters/ as the code improves.
+11
View File
@@ -1,15 +1,26 @@
package main package main
import ( import (
"fmt"
"os"
_ "time/tzdata" _ "time/tzdata"
tea "github.com/charmbracelet/bubbletea"
"github.com/coder/coder/v2/agent/agentexec"
_ "github.com/coder/coder/v2/buildinfo/resources" _ "github.com/coder/coder/v2/buildinfo/resources"
"github.com/coder/coder/v2/cli" "github.com/coder/coder/v2/cli"
) )
func main() { func main() {
if len(os.Args) > 1 && os.Args[1] == "agent-exec" {
err := agentexec.CLI()
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
// This preserves backwards compatibility with an init function that is causing grief for // This preserves backwards compatibility with an init function that is causing grief for
// web terminals using agent-exec + screen. See https://github.com/coder/coder/pull/15817 // web terminals using agent-exec + screen. See https://github.com/coder/coder/pull/15817
tea.InitTerminal()
var rootCmd cli.RootCmd var rootCmd cli.RootCmd
rootCmd.RunWithSubcommands(rootCmd.AGPL()) rootCmd.RunWithSubcommands(rootCmd.AGPL())
+2 -2
View File
@@ -95,12 +95,12 @@ func main() {
dumpBytesAfter, err := dbtestutil.PGDumpSchemaOnly(postgresURL) dumpBytesAfter, err := dbtestutil.PGDumpSchemaOnly(postgresURL)
if err != nil { if err != nil {
friendlyError(os.Stderr, err, migrateFromVersion, migrateToVersion) friendlyError(os.Stderr, err, migrateFromVersion, migrateToVersion)
panic("") panic(err)
} }
if diff := cmp.Diff(string(dumpBytesAfter), string(stripGenPreamble(expectedSchemaAfter))); diff != "" { if diff := cmp.Diff(string(dumpBytesAfter), string(stripGenPreamble(expectedSchemaAfter))); diff != "" {
friendlyError(os.Stderr, xerrors.Errorf("Schema differs from expected after migration: %s", diff), migrateFromVersion, migrateToVersion) friendlyError(os.Stderr, xerrors.Errorf("Schema differs from expected after migration: %s", diff), migrateFromVersion, migrateToVersion)
panic("") panic(err)
} }
_, _ = fmt.Fprintf(os.Stderr, "OK\n") _, _ = fmt.Fprintf(os.Stderr, "OK\n")
} }