Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/csi/recover/recover.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (r *FuseRecover) recoverBrokenMount(point mountinfo.MountPoint) (err error)

// Info: Attempting recovery action
glog.V(3).Infof("FuseRecovery: attempting bind mount, source=%s mountPath=%s options=%v", point.SourcePath, point.MountPath, mountOption)
if err := r.Mount(point.SourcePath, point.MountPath, "none", mountOption); err != nil {
if err = r.Mount(point.SourcePath, point.MountPath, "none", mountOption); err != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

While this change correctly fixes the shadowing issue by using assignment (=) instead of a short variable declaration (:=), the use of named return parameters (like err in this function signature) is generally discouraged in Go unless they provide significant documentation value. In this case, the named return directly contributed to the bug. For better maintainability and to prevent similar shadowing issues in the future, consider removing the named return parameter from the function signature and using explicit return err or return nil statements.

// Warning: Mount failure is recoverable - will retry on next cycle
glog.Warningf("FuseRecovery: bind mount failed, mountPath=%s source=%s error=%v", point.MountPath, point.SourcePath, err)
}
Expand Down