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

*: make errcheck work again #8795

Merged
merged 7 commits into from
Dec 25, 2018
Merged

*: make errcheck work again #8795

merged 7 commits into from
Dec 25, 2018

Conversation

tiancaiamao
Copy link
Contributor

@tiancaiamao tiancaiamao commented Dec 25, 2018

What problem does this PR solve?

errcheck is moved to check_slow in #7240 and it is not used since then.
As the title says, this PR recover the check, and now make check will check it by default.

What is changed and how it works?

  • Add errcheck to Makefile
  • Fix the unchecked errors

Use errcheck rather than the gometalint (it actually integrate errcheck) tool, because this way we can specify the errcheck_excludes.txt file to control what to be ignored.

Check List

Tests

  • No code

Side effects

There is a known issue errcheck doesn't support module kisielk/errcheck#155
And it introduce a problem that TiDB must be put in GOPATH


This change is Reviewable

@shenli shenli changed the title *: recover errcheck Make errcheck work again Dec 25, 2018
@tiancaiamao tiancaiamao changed the title Make errcheck work again *: make errcheck work again Dec 25, 2018
@tiancaiamao
Copy link
Contributor Author

/rebuild

@@ -74,7 +75,8 @@ func (o *outerJoinEliminator) isAggColsAllFromOuterTable(outerPlan LogicalPlan,
}
for _, col := range aggCols {
columnName := &ast.ColumnName{Schema: col.DBName, Table: col.TblName, Name: col.ColName}
if c, _ := outerPlan.Schema().FindColumn(columnName); c == nil {
if c, err := outerPlan.Schema().FindColumn(columnName); c == nil {
log.Debug(err)
Copy link
Member

Choose a reason for hiding this comment

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

I think debug level is too low.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This error could be ignored @eurekaka

Copy link
Contributor

Choose a reason for hiding this comment

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

This log is too simple.

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer log.Warn(err) for err which is not nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@tiancaiamao
Copy link
Contributor Author

/run-all-tests
@winkyao @jackysp

planner/cascades/optimize.go Outdated Show resolved Hide resolved
executor/simple.go Outdated Show resolved Hide resolved
executor/index_lookup_join.go Outdated Show resolved Hide resolved
@@ -513,7 +513,9 @@ func (b *executorBuilder) buildShow(v *plannercore.Show) Executor {
}
if e.Tp == ast.ShowMasterStatus {
// show master status need start ts.
e.ctx.Txn(true)
if _, err := e.ctx.Txn(true); err != nil {
b.err = errors.Trace(err)
Copy link
Member

Choose a reason for hiding this comment

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

ditto.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error stack is critical here, I'd rather add more errors.Trace!

executor/aggregate.go Outdated Show resolved Hide resolved
@tiancaiamao
Copy link
Contributor Author

PTAL @winoros @lysu

Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

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

lgtm

@winoros winoros added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 25, 2018
Copy link
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

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

LGTM

@lysu lysu added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Dec 25, 2018
@jackysp jackysp merged commit 3040788 into pingcap:master Dec 25, 2018
@tiancaiamao tiancaiamao deleted the err-check branch December 25, 2018 10:43
yu34po pushed a commit to yu34po/tidb that referenced this pull request Jan 2, 2019
tiancaiamao added a commit to tiancaiamao/tidb that referenced this pull request Jan 3, 2019
ngaut pushed a commit that referenced this pull request Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/tools status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants