Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 4 additions & 27 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,19 @@ linters-settings:
enabled-checks:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for removing these? Just invalid/old?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah they're covered by other linters, a bunch of warnings about already enabled so I removed them

# - appendAssign
# - appendCombine
- argOrder
# - assignOp
# - badCall
- badCond
- badLock
- badRegexp
- boolExprSimplify
# - builtinShadow
- builtinShadowDecl
- captLocal
- caseOrder
- codegenComment
# - commentedOutCode
- commentedOutImport
- commentFormatting
- defaultCaseOrder
- deferUnlambda
# - deprecatedComment
# - docStub
- dupArg
- dupBranchBody
- dupCase
- dupImport
- dupSubExpr
# - elseif
- emptyFallthrough
# - emptyStringTest
Expand All @@ -56,56 +45,43 @@ linters-settings:
# - exitAfterDefer
# - exposedSyncMutex
# - filepathJoin
- flagDeref
- flagName
- hexLiteral
# - httpNoBody
# - hugeParam
# - ifElseChain
# - importShadow
- indexAlloc
- initClause
- mapKey
- methodExprCall
# - nestingReduce
- newDeref
- nilValReturn
# - octalLiteral
- offBy1
# - paramTypeCombine
# - preferStringWriter
# - preferWriteByte
# - ptrToRefParam
# - rangeExprCopy
# - rangeValCopy
- regexpMust
- regexpPattern
# - regexpSimplify
- ruleguard
- singleCaseSwitch
- sloppyLen
# - sloppyReassign
- sloppyTypeAssert
- sortSlice
- sprintfQuotedString
- sqlQuery
# - stringConcatSimplify
# - stringXbytes
# - suspiciousSorting
- switchTrue
- truncateCmp
- typeAssertChain
# - typeDefFirst
- typeSwitchVar
# - typeUnparen
- underef
# - unlabelStmt
# - unlambda
# - unnamedResult
# - unnecessaryBlock
# - unnecessaryDefer
# - unslice
- valSwap
- weakCond
# - whyNoLint
# - wrapperFunc
Expand Down Expand Up @@ -208,7 +184,7 @@ issues:
- node_modules
- .git

skip-files:
exclude-files:
- scripts/rules.go

# Rules listed here: https://github.com/securego/gosec#available-rules
Expand All @@ -224,15 +200,16 @@ issues:
- path: scripts/*
linters:
- exhaustruct
- path: scripts/rules.go
linters:
- ALL

fix: true
max-issues-per-linter: 0
max-same-issues: 0

run:
timeout: 10m
skip-files:
- scripts/rules.go

# Over time, add more and more linters from
# https://golangci-lint.run/usage/linters/ as the code improves.
Expand Down
11 changes: 11 additions & 0 deletions cmd/coder/main.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
package main

import (
"fmt"
"os"
_ "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/cli"
)

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
// web terminals using agent-exec + screen. See https://github.com/coder/coder/pull/15817
tea.InitTerminal()

var rootCmd cli.RootCmd
rootCmd.RunWithSubcommands(rootCmd.AGPL())
Expand Down
4 changes: 2 additions & 2 deletions scripts/migrate-test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ func main() {
dumpBytesAfter, err := dbtestutil.PGDumpSchemaOnly(postgresURL)
if err != nil {
friendlyError(os.Stderr, err, migrateFromVersion, migrateToVersion)
panic("")
panic(err)
}

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)
panic("")
panic(err)
}
_, _ = fmt.Fprintf(os.Stderr, "OK\n")
}
Expand Down
Loading