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

Run go vet as part of the Travis CI. #626

Merged
merged 4 commits into from
Jan 8, 2019
Merged

Conversation

neuromage
Copy link
Contributor

@neuromage neuromage commented Jan 4, 2019

Also fix existing issues found by Go vet.


This change is Reviewable

Also fix existing issues found by Go vet.
@neuromage
Copy link
Contributor Author

/assign @IronPan
/cc @yebrahim

@yebrahim
Copy link
Contributor

yebrahim commented Jan 4, 2019

Thanks for taking care of this. It seems we were swallowing some errors on the CLI?
Also, can we prevent shadowing? It's pretty easy to shoot ourselves in the foot with it enabled, and I think we discussed removing it before?

.travis.yml Outdated
@@ -48,4 +48,5 @@ script:
- cd $TRAVIS_BUILD_DIR/backend/src
- gimme -f 1.11.4
- source ~/.gimme/envs/go1.11.4.env
- go vet -shadow ./...
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this means only run the shadow checks?
You might need to vet shadows separately on a second invokation, since the flag appears to be still experimental.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, good catch! I verified that go vet -all -shadow runs all checks including shadow.

@neuromage
Copy link
Contributor Author

Thanks for the pointers @yebrahim. PTAL.

@yebrahim
Copy link
Contributor

yebrahim commented Jan 4, 2019

Sweet, thanks!
/lgtm

reader, err := os.Open(config.File)
if err != nil {
return errors.New(fmt.Sprintf("Failed to load sample %s. Error: %v", config.Name, err.Error()))
reader, configErr := os.Open(config.File)
Copy link
Member

Choose a reason for hiding this comment

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

will this code not pass go vet check without changing it? configErr doesn't look like a right name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, here, I think the vet error is spurious but the fix doesn't harm anything IMO. It complains as err shadows the previous declaration outside the for loop. configErr is just a variable name related to errors opening and reading the config file. I can rename it if you like. What would you suggest?

@@ -52,15 +52,16 @@ func (s *DBStatusStore) InitializeDBStatusTable() error {

// The table is not initialized
if !rows.Next() {
sql, args, err := sq.
sql, args, queryErr := sq.
Copy link
Member

Choose a reason for hiding this comment

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

why only this place but not others similiar places?

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 is the only one go vet complains about since it's a redeclaration of err due to the other variables on the same line.

@vicaire
Copy link
Contributor

vicaire commented Jan 8, 2019

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vicaire

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
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vicaire

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 merged commit 67a7373 into kubeflow:master Jan 8, 2019
@Ark-kun
Copy link
Contributor

Ark-kun commented Jan 8, 2019

Looks like this PR broke the Travis tests. #646
@neuromage Can you please take a look?

magdalenakuhn17 pushed a commit to magdalenakuhn17/pipelines that referenced this pull request Oct 22, 2023
HumairAK pushed a commit to red-hat-data-services/data-science-pipelines that referenced this pull request Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants