Skip to content
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

linting: upgrade staticcheck to latest #70216

Closed
cucaroach opened this issue Sep 14, 2021 · 2 comments
Closed

linting: upgrade staticcheck to latest #70216

cucaroach opened this issue Sep 14, 2021 · 2 comments
Assignees
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

Comments

@cucaroach
Copy link
Contributor

Some interesting bugs from 0.2.1 were found. Upgrading to 0.2.1 shows a bunch of new errors:

    lint_test.go:1697:
        pkg/ccl/changefeedccl/sink.go:211:3: ineffective assignment to field sinkURL.q (SA4005)
    lint_test.go:1697:
        pkg/cli/nodelocal.go:114:13: stmt.Exec has been deprecated since Go 1.8: Drivers should implement StmtExecContext instead (or additionally).  (SA1019)
    lint_test.go:1697:
        pkg/cli/userfile.go:567:11: stmt.Exec has been deprecated since Go 1.8: Drivers should implement StmtExecContext instead (or additionally).  (SA1019)
    lint_test.go:1697:
        pkg/cli/userfile.go:655:13: stmt.Exec has been deprecated since Go 1.8: Drivers should implement StmtExecContext instead (or additionally).  (SA1019)
    lint_test.go:1697:
        pkg/cmd/dev/datadriven_test.go:113:12: the argument's underlying type is a slice of bytes, should use a simple conversion instead of fmt.Sprintf (S1025)
    lint_test.go:1697:
        pkg/cmd/roachtest/tests/libpq.go:113:20: calling regexp.MatchString in a loop has poor performance, consider using regexp.Compile (SA6000)
    lint_test.go:1697:
        pkg/geo/geomfn/angle.go:108:14: in Go, the floating-point literal '-0.0' is the same as '0.0', it does not produce a negative zero (SA4026)
    lint_test.go:1697:
        pkg/jobs/config.go:155:17: the integer division '1 / 6' results in zero (SA4025)
    lint_test.go:1697:
        pkg/keys/printer.go:669:10: the argument's underlying type is a slice of bytes, should use a simple conversion instead of fmt.Sprintf (S1025)
    lint_test.go:1697:
        pkg/kv/kvserver/store_replica_btree.go:149:7: type assertion to the same type: it.item already has type rangeKeyItem (S1040)
    lint_test.go:1697:
        pkg/sql/colexec/partially_ordered_distinct.go:67:13: type assertion to the same type: distinct already has type colexecop.ResettableOperator (S1040)
    lint_test.go:1697:
        pkg/sql/inverted/expression_test.go:84:45: ineffective assignment to field UnknownExpression.tight (SA4005)
    lint_test.go:1697:
        pkg/sql/opt/exec/execbuilder/scalar.go:470:34: type assertion to the same type: ifErr.Cond already has type opt.ScalarExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/memo/expr.go:207:10: type assertion to the same type: (*n)[i].Condition already has type opt.ScalarExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/memo/expr.go:207:52: type assertion to the same type: (*n)[j].Condition already has type opt.ScalarExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/alter_table.go:78:3: type assertion to the same type: inputScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/alter_table.go:132:3: type assertion to the same type: inputScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/alter_table.go:182:3: type assertion to the same type: inputScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/distinct.go:48:11: type assertion to the same type: inScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/distinct.go:158:11: type assertion to the same type: inScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/explain.go:63:11: type assertion to the same type: stmtScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/export.go:37:3: type assertion to the same type: inputScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/groupby.go:434:3: type assertion to the same type: g.aggInScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/groupby.go:442:12: type assertion to the same type: g.aggOutScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/join.go:131:11: type assertion to the same type: leftScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/join.go:132:12: type assertion to the same type: rightScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/join.go:405:3: type assertion to the same type: jb.leftScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/join.go:406:3: type assertion to the same type: jb.rightScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/join.go:423:44: type assertion to the same type: jb.outScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/limit.go:27:12: type assertion to the same type: inScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/limit.go:34:12: type assertion to the same type: inScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/misc_statements.go:48:3: type assertion to the same type: inputScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/misc_statements.go:74:3: type assertion to the same type: inputScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/misc_statements.go:99:3: type assertion to the same type: inputScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/misc_statements.go:131:3: type assertion to the same type: inputScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/mutation_builder.go:324:11: type assertion to the same type: mb.fetchScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/mutation_builder.go:325:12: type assertion to the same type: fromScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/project.go:37:4: type assertion to the same type: inScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/select.go:799:11: type assertion to the same type: inScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/select.go:1095:3: type assertion to the same type: inScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/select.go:1153:10: type assertion to the same type: outScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/select.go:1154:11: type assertion to the same type: tableScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/select.go:1204:11: type assertion to the same type: outScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/select.go:1205:12: type assertion to the same type: tableScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/subquery.go:244:53: type assertion to the same type: outScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/subquery.go:249:11: type assertion to the same type: outScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/union.go:84:10: type assertion to the same type: leftScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/union.go:85:11: type assertion to the same type: rightScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/union.go:203:10: type assertion to the same type: dst.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/optbuilder/window.go:308:12: type assertion to the same type: g.aggOutScope.expr already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/xform/physical_props.go:112:20: type assertion to the same type: parent already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/xform/physical_props.go:130:17: type assertion to the same type: parent already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt/xform/physical_props.go:147:17: type assertion to the same type: parent already has type memo.RelExpr (S1040)
    lint_test.go:1697:
        pkg/sql/opt_exec_factory.go:253:27: type assertion to the same type: n already has type planNode (S1040)
    lint_test.go:1697:
        pkg/sql/pgwire/auth_test.go:278:9: builtin function len does not return negative values (SA4024)
    lint_test.go:1697:
        pkg/storage/metamorphic/operands.go:167:9: the argument's underlying type is a slice of bytes, should use a simple conversion instead of fmt.Sprintf (S1025)
    lint_test.go:1697:
        pkg/storage/pebble.go:814:5: this comparison is never true (SA4023)
    lint_test.go:1697:
        	pkg/storage/pebble.go:813:23: the lhs of the comparison gets its value from here and has a concrete type
    lint_test.go:1697:
        pkg/util/log/vmodule.go:148:2: should replace this if statement with an unconditional strings.TrimSuffix (S1017)
@cucaroach cucaroach added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label Sep 14, 2021
@cucaroach cucaroach self-assigned this Sep 14, 2021
@cucaroach
Copy link
Contributor Author

Taking this on as a background task since the bulk of them are in optbuilder.

@cucaroach
Copy link
Contributor Author

Steve beat me to it: #72313

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
None yet
Development

No branches or pull requests

1 participant