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: integrate impi #322

Merged
merged 3 commits into from
Sep 2, 2019

Conversation

ferhatelmas
Copy link
Contributor

@ferhatelmas ferhatelmas commented Aug 27, 2019

impi is added as a part of linting. A follow up on #321.

impi: validates if import order is done consistently.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 27, 2019
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 27, 2019
@codecov-io
Copy link

codecov-io commented Aug 28, 2019

Codecov Report

Merging #322 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #322   +/-   ##
======================================
  Coverage    57.3%   57.3%           
======================================
  Files          19      19           
  Lines         904     904           
======================================
  Hits          518     518           
  Misses        335     335           
  Partials       51      51

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 555b305...953d527. Read the comment docs.

go.mod Outdated Show resolved Hide resolved
hack/run-lint.sh Outdated Show resolved Hide resolved
@ahmetb
Copy link
Member

ahmetb commented Aug 29, 2019

Thanks!
/assign @corneliusweig

Copy link
Contributor

@corneliusweig corneliusweig left a comment

Choose a reason for hiding this comment

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

Hey, thanks for adding impi to our linters. I think it would be worth to structure this code a little more, see hack/install-gox.sh for an example.

@@ -28,4 +29,19 @@ then
fi

# configured by .golangci.yml
exec env GO111MODULE=on "$gopath/bin/golangci-lint" run
Copy link
Contributor

Choose a reason for hiding this comment

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

There has been a discussion that we want to limit the scope of env variables as much as possible. Could you therefore inline the GO111MODULE env variable where necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you have the link of this discussion so that I can read it too?

I will revert it to stick to that discussion conclusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reverted.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's here #243 (comment).

hack/run-lint.sh Outdated
trap 'rm -rf -- "${tmp}"' EXIT
cd "${tmp}"
go mod init foo
go get github.com/pavius/impi/cmd/impi@c1cbdcb
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a particular reason why you want to pin the exact commit version? For me,

GOPATH=/tmp/impi GO111MODULE=off GOBIN="/home/me/go/bin" go get github.com/pavius/impi/cmd/impi

works just fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, works fine but they can break the master.

I thought we shouldn't break our tool when this happens.

However, since it's a dev tool, we might tolerate it and actually it will be a reminder to update the linter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

now installing from master.

# install impi that ensures import grouping is done consistently
if ! [[ -x "${gopath}/bin/impi" ]]
then
echo >&2 'Installing impi'
Copy link
Contributor

Choose a reason for hiding this comment

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

This block should be moved into a function as for install_gox in hack/install-gox.sh.

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.

@corneliusweig
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 2, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: corneliusweig, ferhatelmas

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 2, 2019
@k8s-ci-robot k8s-ci-robot merged commit 08a2071 into kubernetes-sigs:master Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants