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

lint: add indexAlloc checker #655

Merged
merged 3 commits into from
Sep 19, 2018
Merged

Conversation

quasilyte
Copy link
Member

@quasilyte quasilyte commented Sep 19, 2018

Performance check.

Suggests to replace strings.Index with bytes.Index
where it can make code more efficient.

See golang/go#25864

Performance check.

Suggests to replace strings.Index with bytes.Index
where it can make code more efficient.

See golang/go#25864
@quasilyte quasilyte changed the title Quasilyte/add index alloc checker lint: add indexAlloc checker Sep 19, 2018
@cristaloleg cristaloleg self-requested a review September 19, 2018 11:24
@coveralls
Copy link

coveralls commented Sep 19, 2018

Coverage Status

Coverage decreased (-0.03%) to 97.528% when pulling 6504970 on quasilyte/add_indexAlloc_checker into 4952c93 on master.

Copy link
Member

@cristaloleg cristaloleg left a comment

Choose a reason for hiding this comment

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

Great!

)

func init() {
addChecker(&indexAllocChecker{}, attrExperimental, attrPerformance)
Copy link
Member

Choose a reason for hiding this comment

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

❤️

_ = strings.Index(string(x), y)

/// consider replacing strings.Index(string([]byte("12")), y) with bytes.Index([]byte("12"), []byte(y))
_ = strings.Index(string([]byte("12")), y)
Copy link
Member

Choose a reason for hiding this comment

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

Good test.

@quasilyte quasilyte merged commit d97cdb0 into master Sep 19, 2018
@quasilyte quasilyte deleted the quasilyte/add_indexAlloc_checker branch September 19, 2018 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants