cleanup: address golangci 'funcorder' linter problems

The new 'funcorder' linter expects all public functions to be placed
before private functions of a struct. Many private functions needed
moving further down into their files.

Some files had many issues reported. To reduce the churn in those files,
they have been annotated with a `//nolint:funcorder` comment.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos
2025-04-29 11:32:43 +02:00
committed by mergify[bot]
parent 0907f39d95
commit 0a22e3a186
29 changed files with 921 additions and 914 deletions

View File

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
//nolint:funcorder // reordering causes a lot of churn in this file, needs cleanups
package cephfs
import (

View File

@ -130,22 +130,6 @@ func (fq *fsQuiesce) GetVolumes() []Volume {
return fq.volumes
}
// getMembers returns the list of names in the format
// group/subvolume that are to be quiesced. This is the format that the
// ceph fs quiesce expects.
// Example: ["group1/subvolume1", "group1/subvolume2", "group2/subvolume1"].
func (fq *fsQuiesce) getMembers() []string {
volName := []string{}
for svg, sb := range fq.subVolumeGroupMapping {
for _, s := range sb {
name := svg + "/" + s
volName = append(volName, name)
}
}
return volName
}
func (fq *fsQuiesce) FSQuiesce(
ctx context.Context,
reserveName string,
@ -248,3 +232,19 @@ func (fq *fsQuiesce) ReleaseFSQuiesce(ctx context.Context,
return nil, err
}
// getMembers returns the list of names in the format
// group/subvolume that are to be quiesced. This is the format that the
// ceph fs quiesce expects.
// Example: ["group1/subvolume1", "group1/subvolume2", "group2/subvolume1"].
func (fq *fsQuiesce) getMembers() []string {
volName := []string{}
for svg, sb := range fq.subVolumeGroupMapping {
for _, s := range sb {
name := svg + "/" + s
volName = append(volName, name)
}
}
return volName
}

View File

@ -58,6 +58,21 @@ func NewKernelMounter() KernelMounter {
}
}
func (m *kernelMounter) Mount(
ctx context.Context,
mountPoint string,
cr *util.Credentials,
volOptions *store.VolumeOptions,
) error {
if err := util.CreateMountPoint(mountPoint); err != nil {
return err
}
return m.mountKernel(ctx, mountPoint, cr, volOptions)
}
func (m *kernelMounter) Name() string { return "Ceph kernel client" }
func (m *kernelMounter) mountKernel(
ctx context.Context,
mountPoint string,
@ -103,21 +118,6 @@ func (m *kernelMounter) mountKernel(
return err
}
func (m *kernelMounter) Mount(
ctx context.Context,
mountPoint string,
cr *util.Credentials,
volOptions *store.VolumeOptions,
) error {
if err := util.CreateMountPoint(mountPoint); err != nil {
return err
}
return m.mountKernel(ctx, mountPoint, cr, volOptions)
}
func (m *kernelMounter) Name() string { return "Ceph kernel client" }
// filesystemSupported checks if the passed name of the filesystem is included
// in /proc/filesystems.
func filesystemSupported(fs string) bool {

View File

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
//nolint:funcorder // reordering causes a lot of churn in this file, needs cleanups
package cephfs
import (

View File

@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
//nolint:funcorder // reordering causes a lot of churn in this file
package store
import (