-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why only this place but not others similiar places? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
Insert("db_statuses"). | ||
SetMap(defaultDBStatus). | ||
ToSql() | ||
|
||
if err != nil { | ||
if queryErr != nil { | ||
tx.Rollback() | ||
return util.NewInternalServerError(err, "Error creating query to initialize database status table.") | ||
return util.NewInternalServerError(queryErr, "Error creating query to initialize database status table.") | ||
} | ||
|
||
_, err = tx.Exec(sql, args...) | ||
if err != nil { | ||
tx.Rollback() | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?