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
Ineffassign fixes for pkg/volume #87711
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 |
---|---|---|
|
@@ -89,7 +89,7 @@ func openAndLockProjectFiles() (*os.File, *os.File, error) { | |
fProjid, err := os.OpenFile(projidFile, os.O_RDONLY|os.O_CREATE, 0644) | ||
if err == nil { | ||
// Check once more, to ensure nothing got changed out from under us | ||
if err := projFilesAreOK(); err == nil { | ||
if err = projFilesAreOK(); err == nil { | ||
err = lockFile(fProjects) | ||
if err == nil { | ||
err = lockFile(fProjid) | ||
|
@@ -324,7 +324,7 @@ func createProjectID(path string, ID common.QuotaID) (common.QuotaID, error) { | |
if err == nil { | ||
defer closeProjectFiles(fProjects, fProjid) | ||
list := readProjectFiles(fProjects, fProjid) | ||
writeProjid := true | ||
var writeProjid bool | ||
ID, writeProjid, err = addDirToProject(path, ID, &list) | ||
if err == nil && ID != common.BadQuotaID { | ||
if err = writeProjectFiles(fProjects, fProjid, writeProjid, list); err == nil { | ||
|
@@ -345,7 +345,7 @@ func removeProjectID(path string, ID common.QuotaID) error { | |
if err == nil { | ||
defer closeProjectFiles(fProjects, fProjid) | ||
list := readProjectFiles(fProjects, fProjid) | ||
writeProjid := true | ||
var writeProjid bool | ||
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. I think default value of bool is false 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. @anderseknert same as the above. The default value doesn't have any affect here as the |
||
writeProjid, err = removeDirFromProject(path, ID, &list) | ||
if err == nil { | ||
if err = writeProjectFiles(fProjects, fProjid, writeProjid, list); err == nil { | ||
|
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.
I think default value of bool is false
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.
@anderseknert that's correct, but the default value doesn't have any affect here as the
writeProjid
value is being reset on the next line anyway. So if set to true on line 327, it's an ineffectual assignment that is not being leveraged, and reported as error by ineffassign.