From 9640a77d75e64074d6a95d5ef66e4810d669a427 Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Wed, 17 Dec 2025 08:43:55 -0700 Subject: [PATCH 1/8] Initial move to go1.26rc1 testing --- cmd/unmount_all.go | 8 +++++--- common/config/keys_tree.go | 4 ++-- common/config/keys_tree_test.go | 2 +- common/types.go | 4 ++-- component/azstorage/azauth_test.go | 1 - component/azstorage/azstorage.go | 4 +--- component/azstorage/block_blob.go | 24 +++++++++++------------ component/azstorage/block_blob_test.go | 3 +-- component/azstorage/config.go | 8 ++++---- component/azstorage/datalake_test.go | 5 ++--- component/azstorage/utils.go | 8 ++++---- component/s3storage/client.go | 5 ++--- component/s3storage/client_test.go | 1 - component/s3storage/s3storage_test.go | 1 - component/s3storage/s3wrappers.go | 3 +-- component/s3storage/s3wrappers_test.go | 1 - component/size_tracker/journal.go | 4 ++-- component/xload/utils.go | 4 ++-- go.mod | 2 +- main_test.go | 1 - test/accoutcleanup/accountcleanup_test.go | 1 - test/benchmark_test/benchmark_test.go | 1 - test/e2e_tests/data_validation_test.go | 1 - test/e2e_tests/dir_test.go | 1 - test/e2e_tests/file_test.go | 1 - test/mount_test/mount_test.go | 1 - test/s3cleanup/s3cleanup_test.go | 1 - test/sdk_test/sdk_test.go | 1 - test/stress_test/stress_test.go | 1 - 29 files changed, 42 insertions(+), 60 deletions(-) diff --git a/cmd/unmount_all.go b/cmd/unmount_all.go index 2dde59b30..5a70c66ad 100644 --- a/cmd/unmount_all.go +++ b/cmd/unmount_all.go @@ -29,6 +29,7 @@ import ( "errors" "fmt" "runtime" + "strings" "github.com/Seagate/cloudfuse/common" @@ -50,7 +51,8 @@ var umntAllCmd = &cobra.Command{ lazy, _ := cmd.Flags().GetBool("lazy") mountfound := 0 unmounted := 0 - errMsg := "failed to unmount - \n" + var errMsg strings.Builder + errMsg.WriteString("failed to unmount - \n") for _, mntPath := range lstMnt { mountfound += 1 @@ -65,7 +67,7 @@ var umntAllCmd = &cobra.Command{ if err == nil { unmounted += 1 } else { - errMsg += " " + mntPath + " - [" + err.Error() + "]\n" + errMsg.WriteString(" " + mntPath + " - [" + err.Error() + "]\n") } } @@ -76,7 +78,7 @@ var umntAllCmd = &cobra.Command{ } if unmounted < mountfound { - return errors.New(errMsg) + return errors.New(errMsg.String()) } return nil diff --git a/common/config/keys_tree.go b/common/config/keys_tree.go index adcdfdc27..4b81cb734 100644 --- a/common/config/keys_tree.go +++ b/common/config/keys_tree.go @@ -229,7 +229,7 @@ func (tree *Tree) MergeWithKey(key string, obj any, getValue func(val any) (res if elem.Field(i).Type().Kind() == reflect.Struct { subKey := key + "." + idx tree.MergeWithKey(subKey, elem.Field(i).Addr().Interface(), getValue) - } else if elem.Field(i).Type().Kind() == reflect.Ptr { + } else if elem.Field(i).Type().Kind() == reflect.Pointer { subKey := key + "." + idx tree.MergeWithKey(subKey, elem.Field(i).Elem().Addr().Interface(), getValue) } else { @@ -266,7 +266,7 @@ func (tree *Tree) Merge(obj any, getValue func(val any) (res any, ok bool)) { if elem.Field(i).Type().Kind() == reflect.Struct { subKey := idx tree.MergeWithKey(subKey, elem.Field(i).Addr().Interface(), getValue) - } else if elem.Field(i).Type().Kind() == reflect.Ptr { + } else if elem.Field(i).Type().Kind() == reflect.Pointer { subKey := idx tree.MergeWithKey(subKey, elem.Field(i).Elem().Addr().Interface(), getValue) } else { diff --git a/common/config/keys_tree_test.go b/common/config/keys_tree_test.go index 5839304cb..07adda462 100644 --- a/common/config/keys_tree_test.go +++ b/common/config/keys_tree_test.go @@ -141,7 +141,7 @@ func (suite *keysTreeTestSuite) TestIsNotPrimitiveType() { reflect.Array, reflect.Func, reflect.Map, - reflect.Ptr, + reflect.Pointer, reflect.Slice, reflect.Struct, } diff --git a/common/types.go b/common/types.go index 467d61556..b66858a0b 100644 --- a/common/types.go +++ b/common/types.go @@ -162,11 +162,11 @@ func (LogLevel) LOG_DEBUG() LogLevel { } func (l LogLevel) String() string { - return enum.StringInt(l, reflect.TypeOf(l)) + return enum.StringInt(l, reflect.TypeFor[LogLevel]()) } func (l *LogLevel) Parse(s string) error { - enumVal, err := enum.ParseInt(reflect.TypeOf(l), s, true, false) + enumVal, err := enum.ParseInt(reflect.TypeFor[*LogLevel](), s, true, false) if enumVal != nil { *l = enumVal.(LogLevel) } diff --git a/component/azstorage/azauth_test.go b/component/azstorage/azauth_test.go index 48b09b6ad..00a12c44f 100644 --- a/component/azstorage/azauth_test.go +++ b/component/azstorage/azauth_test.go @@ -1,5 +1,4 @@ //go:build !authtest && !azurite -// +build !authtest,!azurite /* Licensed under the MIT License . diff --git a/component/azstorage/azstorage.go b/component/azstorage/azstorage.go index 0da081ec6..f22344f75 100644 --- a/component/azstorage/azstorage.go +++ b/component/azstorage/azstorage.go @@ -38,8 +38,6 @@ import ( "github.com/Seagate/cloudfuse/internal" "github.com/Seagate/cloudfuse/internal/handlemap" "github.com/Seagate/cloudfuse/internal/stats_manager" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) // AzStorage Wrapper type around azure go-sdk (track-1) @@ -307,7 +305,7 @@ func (az *AzStorage) StreamDir( ) if new_marker == nil { - new_marker = to.Ptr("") + new_marker = new("") } else if *new_marker != "" { log.Debug("AzStorage::StreamDir : next-marker %s for Path %s", *new_marker, path) if len(new_list) == 0 { diff --git a/component/azstorage/block_blob.go b/component/azstorage/block_blob.go index a83e353a0..9757a75d3 100644 --- a/component/azstorage/block_blob.go +++ b/component/azstorage/block_blob.go @@ -192,7 +192,7 @@ func (bb *BlockBlob) TestPipeline() error { listBlobPager := bb.Container.NewListBlobsHierarchyPager( "/", &container.ListBlobsHierarchyOptions{ - MaxResults: to.Ptr((int32)(2)), + MaxResults: new((int32)(2)), Prefix: &bb.Config.prefixPath, }, ) @@ -223,7 +223,7 @@ func (bb *BlockBlob) IsAccountADLS() bool { listBlobPager := bb.Container.NewListBlobsHierarchyPager( "/", &container.ListBlobsHierarchyOptions{ - MaxResults: to.Ptr((int32)(2)), + MaxResults: new((int32)(2)), Prefix: &bb.Config.prefixPath, Include: includeFields, }, @@ -293,7 +293,7 @@ func (bb *BlockBlob) CreateDirectory(name string) error { var data []byte metadata := make(map[string]*string) - metadata[folderKey] = to.Ptr("true") + metadata[folderKey] = new("true") return bb.WriteFromBuffer(name, metadata, data) } @@ -303,7 +303,7 @@ func (bb *BlockBlob) CreateLink(source string, target string) error { log.Trace("BlockBlob::CreateLink : %s -> %s", source, target) data := []byte(target) metadata := make(map[string]*string) - metadata[symlinkKey] = to.Ptr("true") + metadata[symlinkKey] = new("true") return bb.WriteFromBuffer(source, metadata, data) } @@ -444,7 +444,7 @@ func (bb *BlockBlob) RenameDirectory(source string, target string) error { srcDirPresent := false pager := bb.Container.NewListBlobsFlatPager(&container.ListBlobsFlatOptions{ - Prefix: to.Ptr(bb.getFormattedPath(source) + "/"), + Prefix: new(bb.getFormattedPath(source) + "/"), }) for pager.More() { listBlobResp, err := pager.NextPage(context.Background()) @@ -932,7 +932,7 @@ func (bb *BlockBlob) ReadToFile(name string, offset int64, count int64, fi *os.F blobClient := bb.getBlobClient(name) - downloadPtr := to.Ptr(int64(1)) + downloadPtr := new(int64(1)) if common.MonitorCfs() { bb.downloadOptions.Progress = func(bytesTransferred int64) { @@ -1189,7 +1189,7 @@ func (bb *BlockBlob) WriteFromFile( blobClient := bb.getBlockBlobClient(name) defer log.TimeTrack(time.Now(), "BlockBlob::WriteFromFile", name) - uploadPtr := to.Ptr(int64(1)) + uploadPtr := new(int64(1)) blockSize := bb.Config.blockSize // get the size of the file @@ -1227,7 +1227,7 @@ func (bb *BlockBlob) WriteFromFile( Metadata: metadata, AccessTier: bb.Config.defaultTier, HTTPHeaders: &blob.HTTPHeaders{ - BlobContentType: to.Ptr(getContentType(name)), + BlobContentType: new(getContentType(name)), BlobContentMD5: md5sum, }, CPKInfo: bb.blobCPKOpt, @@ -1286,7 +1286,7 @@ func (bb *BlockBlob) WriteFromBuffer(name string, metadata map[string]*string, d Metadata: metadata, AccessTier: bb.Config.defaultTier, HTTPHeaders: &blob.HTTPHeaders{ - BlobContentType: to.Ptr(getContentType(name)), + BlobContentType: new(getContentType(name)), }, CPKInfo: bb.blobCPKOpt, }) @@ -1675,7 +1675,7 @@ func (bb *BlockBlob) stageAndCommitModifiedBlocks( blockIDList, &blockblob.CommitBlockListOptions{ HTTPHeaders: &blob.HTTPHeaders{ - BlobContentType: to.Ptr(getContentType(name)), + BlobContentType: new(getContentType(name)), }, Tier: bb.Config.defaultTier, CPKInfo: bb.blobCPKOpt, @@ -1737,7 +1737,7 @@ func (bb *BlockBlob) StageAndCommit(name string, bol *common.BlockOffsetList) er blockIDList, &blockblob.CommitBlockListOptions{ HTTPHeaders: &blob.HTTPHeaders{ - BlobContentType: to.Ptr(getContentType(name)), + BlobContentType: new(getContentType(name)), }, Tier: bb.Config.defaultTier, CPKInfo: bb.blobCPKOpt, @@ -1866,7 +1866,7 @@ func (bb *BlockBlob) CommitBlocks(name string, blockList []string, newEtag *stri blockList, &blockblob.CommitBlockListOptions{ HTTPHeaders: &blob.HTTPHeaders{ - BlobContentType: to.Ptr(getContentType(name)), + BlobContentType: new(getContentType(name)), }, Tier: bb.Config.defaultTier, CPKInfo: bb.blobCPKOpt, diff --git a/component/azstorage/block_blob_test.go b/component/azstorage/block_blob_test.go index 6d8495dee..459c114b7 100644 --- a/component/azstorage/block_blob_test.go +++ b/component/azstorage/block_blob_test.go @@ -1,5 +1,4 @@ //go:build !authtest -// +build !authtest /* Licensed under the MIT License . @@ -1289,7 +1288,7 @@ func (s *blockBlobTestSuite) TestRenameFileMetadataConservation() { s.az.CreateFile(internal.CreateFileOptions{Name: src}) // Add srcMeta to source srcMeta := make(map[string]*string) - srcMeta["foo"] = to.Ptr("bar") + srcMeta["foo"] = new("bar") source.SetMetadata(ctx, srcMeta, nil) dst := generateFileName() diff --git a/component/azstorage/config.go b/component/azstorage/config.go index dd8544def..b263d71ca 100644 --- a/component/azstorage/config.go +++ b/component/azstorage/config.go @@ -75,11 +75,11 @@ func (AuthType) WORKLOADIDENTITY() AuthType { } func (a AuthType) String() string { - return enum.StringInt(a, reflect.TypeOf(a)) + return enum.StringInt(a, reflect.TypeFor[AuthType]()) } func (a *AuthType) Parse(s string) error { - enumVal, err := enum.ParseInt(reflect.TypeOf(a), s, true, false) + enumVal, err := enum.ParseInt(reflect.TypeFor[*AuthType](), s, true, false) if enumVal != nil { *a = enumVal.(AuthType) } @@ -104,11 +104,11 @@ func (AccountType) ADLS() AccountType { } func (a AccountType) String() string { - return enum.StringInt(a, reflect.TypeOf(a)) + return enum.StringInt(a, reflect.TypeFor[AccountType]()) } func (a *AccountType) Parse(s string) error { - enumVal, err := enum.ParseInt(reflect.TypeOf(a), s, true, false) + enumVal, err := enum.ParseInt(reflect.TypeFor[*AccountType](), s, true, false) if enumVal != nil { *a = enumVal.(AccountType) } diff --git a/component/azstorage/datalake_test.go b/component/azstorage/datalake_test.go index c9d764722..2b7b90c35 100644 --- a/component/azstorage/datalake_test.go +++ b/component/azstorage/datalake_test.go @@ -1,5 +1,4 @@ //go:build !authtest && !azurite -// +build !authtest,!azurite /* Licensed under the MIT License . @@ -1538,7 +1537,7 @@ func (s *datalakeTestSuite) TestRenameFileMetadataConservation() { s.az.CreateFile(internal.CreateFileOptions{Name: src}) // Add srcMeta to source srcMeta := make(map[string]*string) - srcMeta["foo"] = to.Ptr("bar") + srcMeta["foo"] = new("bar") source.SetMetadata(ctx, srcMeta, nil) dst := generateFileName() @@ -3416,7 +3415,7 @@ func (s *datalakeTestSuite) TestList() { s.assert.NotEqual(0, blobList[0].Mode) // Test listing with marker - blobList, marker, err = s.az.storage.List(base, to.Ptr("invalid-marker"), 0) + blobList, marker, err = s.az.storage.List(base, new("invalid-marker"), 0) s.assert.Error(err) s.assert.Empty(blobList) s.assert.Nil(marker) diff --git a/component/azstorage/utils.go b/component/azstorage/utils.go index 9d479310e..491e5c297 100644 --- a/component/azstorage/utils.go +++ b/component/azstorage/utils.go @@ -471,16 +471,16 @@ func getFileModeFromACL(objid string, acl string, owner string) (os.FileMode, er userACL := acl[idx : idx+3] mask := extractPermission(acl, "mask::") - permissions := "" + var permissions strings.Builder for i, c := range userACL { if userACL[i] == mask[i] { - permissions += string(c) + permissions.WriteString(string(c)) } else { - permissions += "-" + permissions.WriteString("-") } } - return permissions + return permissions.String() } // Sample string : user::rwx,user:objid1:r--,user:objid2:r--,group::r--,mask::r-x,other::rwx: diff --git a/component/s3storage/client.go b/component/s3storage/client.go index 31ad7e9a6..c16a19910 100644 --- a/component/s3storage/client.go +++ b/component/s3storage/client.go @@ -43,7 +43,6 @@ import ( "syscall" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Seagate/cloudfuse/common" "github.com/Seagate/cloudfuse/common/log" "github.com/Seagate/cloudfuse/internal" @@ -415,9 +414,9 @@ func (cl *Client) CreateLink(source string, target string, isSymlink bool) error log.Trace("Client::CreateLink : %s -> %s", source, target) data := []byte(target) - symlinkMap := map[string]*string{symlinkKey: to.Ptr("false")} + symlinkMap := map[string]*string{symlinkKey: new("false")} if isSymlink { - symlinkMap[symlinkKey] = to.Ptr("true") + symlinkMap[symlinkKey] = new("true") } return cl.WriteFromBuffer(source, symlinkMap, data) } diff --git a/component/s3storage/client_test.go b/component/s3storage/client_test.go index 34e5fa80f..affdac3f3 100644 --- a/component/s3storage/client_test.go +++ b/component/s3storage/client_test.go @@ -1,5 +1,4 @@ //go:build !authtest -// +build !authtest /* Licensed under the MIT License . diff --git a/component/s3storage/s3storage_test.go b/component/s3storage/s3storage_test.go index fe492d797..fe30a5160 100644 --- a/component/s3storage/s3storage_test.go +++ b/component/s3storage/s3storage_test.go @@ -1,5 +1,4 @@ //go:build !authtest -// +build !authtest /* Licensed under the MIT License . diff --git a/component/s3storage/s3wrappers.go b/component/s3storage/s3wrappers.go index 9329e4ad7..437c58910 100644 --- a/component/s3storage/s3wrappers.go +++ b/component/s3storage/s3wrappers.go @@ -38,7 +38,6 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Seagate/cloudfuse/common" "github.com/Seagate/cloudfuse/common/log" "github.com/Seagate/cloudfuse/internal" @@ -580,7 +579,7 @@ func createObjAttr( if isSymLink { attr.Flags.Set(internal.PropFlagSymlink) - attr.Metadata[symlinkKey] = to.Ptr("true") + attr.Metadata[symlinkKey] = new("true") } return attr diff --git a/component/s3storage/s3wrappers_test.go b/component/s3storage/s3wrappers_test.go index 92be4d1d7..1aeb84eff 100644 --- a/component/s3storage/s3wrappers_test.go +++ b/component/s3storage/s3wrappers_test.go @@ -1,5 +1,4 @@ //go:build !authtest -// +build !authtest /* Licensed under the MIT License . diff --git a/component/size_tracker/journal.go b/component/size_tracker/journal.go index ee3af2774..5c033600d 100644 --- a/component/size_tracker/journal.go +++ b/component/size_tracker/journal.go @@ -187,8 +187,8 @@ func (ms *MountSize) sync() error { return err } // Parse simple key=value lines - lines := bytes.Split(data, []byte("\n")) - for _, ln := range lines { + lines := bytes.SplitSeq(data, []byte("\n")) + for ln := range lines { ln = bytes.TrimSpace(ln) if len(ln) == 0 || bytes.HasPrefix(ln, []byte("#")) || diff --git a/component/xload/utils.go b/component/xload/utils.go index 3f1d7ec74..e02d445fc 100644 --- a/component/xload/utils.go +++ b/component/xload/utils.go @@ -88,11 +88,11 @@ func (Mode) SYNC() Mode { } func (m Mode) String() string { - return enum.StringInt(m, reflect.TypeOf(m)) + return enum.StringInt(m, reflect.TypeFor[Mode]()) } func (m *Mode) Parse(s string) error { - enumVal, err := enum.ParseInt(reflect.TypeOf(m), s, true, false) + enumVal, err := enum.ParseInt(reflect.TypeFor[*Mode](), s, true, false) if enumVal != nil { *m = enumVal.(Mode) } diff --git a/go.mod b/go.mod index 128d61e79..afb2cfe15 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/Seagate/cloudfuse -go 1.25.4 +go 1.26rc1 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 diff --git a/main_test.go b/main_test.go index 1d6431e0d..f0321a111 100644 --- a/main_test.go +++ b/main_test.go @@ -1,5 +1,4 @@ //go:build !unittest -// +build !unittest /* Licensed under the MIT License . diff --git a/test/accoutcleanup/accountcleanup_test.go b/test/accoutcleanup/accountcleanup_test.go index f7ebd7c36..0c2004c2f 100644 --- a/test/accoutcleanup/accountcleanup_test.go +++ b/test/accoutcleanup/accountcleanup_test.go @@ -1,5 +1,4 @@ //go:build !unittest -// +build !unittest /* Licensed under the MIT License . diff --git a/test/benchmark_test/benchmark_test.go b/test/benchmark_test/benchmark_test.go index b2c5a999e..d8f06df88 100644 --- a/test/benchmark_test/benchmark_test.go +++ b/test/benchmark_test/benchmark_test.go @@ -1,5 +1,4 @@ //go:build !unittest -// +build !unittest /* Licensed under the MIT License . diff --git a/test/e2e_tests/data_validation_test.go b/test/e2e_tests/data_validation_test.go index 24f2479ae..107b782d2 100644 --- a/test/e2e_tests/data_validation_test.go +++ b/test/e2e_tests/data_validation_test.go @@ -1,5 +1,4 @@ //go:build !unittest -// +build !unittest /* Licensed under the MIT License . diff --git a/test/e2e_tests/dir_test.go b/test/e2e_tests/dir_test.go index be5edcf76..d13dcef4e 100644 --- a/test/e2e_tests/dir_test.go +++ b/test/e2e_tests/dir_test.go @@ -1,5 +1,4 @@ //go:build !unittest -// +build !unittest /* Licensed under the MIT License . diff --git a/test/e2e_tests/file_test.go b/test/e2e_tests/file_test.go index f12c5b3d1..b14db3171 100644 --- a/test/e2e_tests/file_test.go +++ b/test/e2e_tests/file_test.go @@ -1,5 +1,4 @@ //go:build !unittest -// +build !unittest /* Licensed under the MIT License . diff --git a/test/mount_test/mount_test.go b/test/mount_test/mount_test.go index 4d83b3c1a..0296a3c1f 100644 --- a/test/mount_test/mount_test.go +++ b/test/mount_test/mount_test.go @@ -1,5 +1,4 @@ //go:build !unittest -// +build !unittest /* Licensed under the MIT License . diff --git a/test/s3cleanup/s3cleanup_test.go b/test/s3cleanup/s3cleanup_test.go index 2ac212999..f80fd0f3e 100644 --- a/test/s3cleanup/s3cleanup_test.go +++ b/test/s3cleanup/s3cleanup_test.go @@ -1,5 +1,4 @@ //go:build !unittest -// +build !unittest /* Licensed under the MIT License . diff --git a/test/sdk_test/sdk_test.go b/test/sdk_test/sdk_test.go index 246967f2e..93bf93b77 100644 --- a/test/sdk_test/sdk_test.go +++ b/test/sdk_test/sdk_test.go @@ -1,5 +1,4 @@ //go:build !unittest -// +build !unittest /* Licensed under the MIT License . diff --git a/test/stress_test/stress_test.go b/test/stress_test/stress_test.go index 8f9447623..1efe56e71 100644 --- a/test/stress_test/stress_test.go +++ b/test/stress_test/stress_test.go @@ -1,5 +1,4 @@ //go:build !unittest -// +build !unittest /* Licensed under the MIT License . From a5605f64fb85a584a6c4fbd96291b9d4b99c3d89 Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Wed, 17 Dec 2025 10:04:32 -0700 Subject: [PATCH 2/8] Cleanup fixes with go1.26 on windows --- cmd/mount_windows.go | 5 +---- common/log/sys_logger_windows.go | 12 ++++++------ common/util_windows.go | 4 ++-- internal/stats_manager/stats_manager_windows.go | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/cmd/mount_windows.go b/cmd/mount_windows.go index e38586c9e..bfcf20e39 100644 --- a/cmd/mount_windows.go +++ b/cmd/mount_windows.go @@ -132,10 +132,7 @@ func readPassphraseFromPipe(pipeName string, timeout time.Duration) (string, err } // Wait for the read operation to complete or timeout. - readTimeout := time.Until(deadline) - if readTimeout < 0 { - readTimeout = 0 - } + readTimeout := max(time.Until(deadline), 0) eventState, err := windows.WaitForSingleObject(event, uint32(readTimeout.Milliseconds())) if err != nil { return "", fmt.Errorf("ReadFile WaitForSingleObject failed: %w", err) diff --git a/common/log/sys_logger_windows.go b/common/log/sys_logger_windows.go index cfda0bac3..90def60f4 100644 --- a/common/log/sys_logger_windows.go +++ b/common/log/sys_logger_windows.go @@ -114,42 +114,42 @@ func (sl *SysLogger) logEvent(lvl common.LogLevel, msg string) error { return err } -func (sl *SysLogger) Debug(format string, args ...interface{}) { +func (sl *SysLogger) Debug(format string, args ...any) { if sl.level >= common.ELogLevel.LOG_DEBUG() { msg := fmt.Sprintf(format, args...) _ = sl.logEvent(common.ELogLevel.LOG_DEBUG(), msg) } } -func (sl *SysLogger) Trace(format string, args ...interface{}) { +func (sl *SysLogger) Trace(format string, args ...any) { if sl.level >= common.ELogLevel.LOG_TRACE() { msg := fmt.Sprintf(format, args...) _ = sl.logEvent(common.ELogLevel.LOG_TRACE(), msg) } } -func (sl *SysLogger) Info(format string, args ...interface{}) { +func (sl *SysLogger) Info(format string, args ...any) { if sl.level >= common.ELogLevel.LOG_INFO() { msg := fmt.Sprintf(format, args...) _ = sl.logEvent(common.ELogLevel.LOG_INFO(), msg) } } -func (sl *SysLogger) Warn(format string, args ...interface{}) { +func (sl *SysLogger) Warn(format string, args ...any) { if sl.level >= common.ELogLevel.LOG_WARNING() { msg := fmt.Sprintf(format, args...) _ = sl.logEvent(common.ELogLevel.LOG_WARNING(), msg) } } -func (sl *SysLogger) Err(format string, args ...interface{}) { +func (sl *SysLogger) Err(format string, args ...any) { if sl.level >= common.ELogLevel.LOG_ERR() { msg := fmt.Sprintf(format, args...) _ = sl.logEvent(common.ELogLevel.LOG_ERR(), msg) } } -func (sl *SysLogger) Crit(format string, args ...interface{}) { +func (sl *SysLogger) Crit(format string, args ...any) { if sl.level >= common.ELogLevel.LOG_CRIT() { msg := fmt.Sprintf(format, args...) _ = sl.logEvent(common.ELogLevel.LOG_CRIT(), msg) diff --git a/common/util_windows.go b/common/util_windows.go index 7dc5cc1ae..36d8ad03e 100644 --- a/common/util_windows.go +++ b/common/util_windows.go @@ -135,8 +135,8 @@ func ListMountPoints() ([]string, error) { return nil, err } var mntList []string - outList := strings.Split(string(out), "\n") - for _, item := range outList { + outList := strings.SplitSeq(string(out), "\n") + for item := range outList { if strings.HasPrefix(item, "cloudfuse") { // Extract the mount path from this line mntPath := strings.Split(item, " ")[1] diff --git a/internal/stats_manager/stats_manager_windows.go b/internal/stats_manager/stats_manager_windows.go index e46f1be31..04923aa26 100644 --- a/internal/stats_manager/stats_manager_windows.go +++ b/internal/stats_manager/stats_manager_windows.go @@ -269,7 +269,7 @@ func statsPolling() { // send the stats collected so far to transfer pipe stMgrOpt.transferMtx.Lock() - err = windows.WriteFile(tPipe, []byte(fmt.Sprintf("%v\n", string(msg))), nil, nil) + err = windows.WriteFile(tPipe, fmt.Appendf(nil, "%v\n", string(msg)), nil, nil) stMgrOpt.transferMtx.Unlock() if err != nil { log.Err("stats_manager::statsDumper : Unable to write to pipe [%v]", err) From e8f47e16f010de045cb1742c1784634c80f1c626 Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Wed, 17 Dec 2025 15:15:07 -0700 Subject: [PATCH 3/8] Fix go vet issues --- cmd/mount.go | 2 +- cmd/mount_all.go | 2 +- component/attr_cache/attr_cache_test.go | 4 +-- component/azstorage/azauthspn.go | 2 +- component/azstorage/azstorage.go | 4 +-- component/azstorage/block_blob.go | 28 +++++++++---------- component/azstorage/block_blob_test.go | 12 ++++---- component/azstorage/config.go | 7 ++--- component/azstorage/datalake_test.go | 14 +++++----- component/entry_cache/entry_cache_test.go | 2 +- component/file_cache/cache_policy.go | 4 +-- component/file_cache/file_cache.go | 2 +- component/file_cache/file_cache_linux_test.go | 2 +- component/file_cache/file_cache_test.go | 2 +- component/s3storage/client.go | 22 +++++++-------- component/s3storage/s3storage.go | 8 +++--- component/s3storage/s3storage_test.go | 16 +++++------ component/s3storage/s3wrappers.go | 10 +++---- component/s3storage/utils.go | 4 +-- component/stream/read.go | 2 +- component/stream/stream.go | 2 +- component/xload/xload_test.go | 2 +- tools/health-monitor/internal/stats_export.go | 2 +- tools/health-monitor/main.go | 4 +-- 24 files changed, 79 insertions(+), 80 deletions(-) diff --git a/cmd/mount.go b/cmd/mount.go index ea145afd3..22c3a8cf3 100644 --- a/cmd/mount.go +++ b/cmd/mount.go @@ -468,7 +468,7 @@ var mountCmd = &cobra.Command{ if !disableVersionCheck { err := VersionCheck() if err != nil { - log.Err(err.Error()) + log.Err("%s", err.Error()) } } diff --git a/cmd/mount_all.go b/cmd/mount_all.go index 834cb87f1..65cbaa661 100644 --- a/cmd/mount_all.go +++ b/cmd/mount_all.go @@ -146,7 +146,7 @@ func processCommand() error { if !disableVersionCheck { err := VersionCheck() if err != nil { - log.Err(err.Error()) + log.Err("%s", err.Error()) } } diff --git a/component/attr_cache/attr_cache_test.go b/component/attr_cache/attr_cache_test.go index 5629f3bab..b7427ef58 100644 --- a/component/attr_cache/attr_cache_test.go +++ b/component/attr_cache/attr_cache_test.go @@ -377,7 +377,7 @@ func (suite *attrCacheTestSuite) TestCreateDir() { var paths = []string{"a", "a/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) // This is a little janky but required since testify suite does not support running setup or clean up for subtests. suite.cleanupTest() suite.SetupTest() @@ -423,7 +423,7 @@ func (suite *attrCacheTestSuite) TestCreateDirNoCacheDirs() { config := fmt.Sprintf("attr_cache:\n no-cache-dirs: %t", noCacheDirs) for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) // This is a little janky but required since testify suite does not support running setup or clean up for subtests. suite.cleanupTest() suite.setupTestHelper( diff --git a/component/azstorage/azauthspn.go b/component/azstorage/azauthspn.go index cf4c49fed..bb9214662 100644 --- a/component/azstorage/azauthspn.go +++ b/component/azstorage/azauthspn.go @@ -97,7 +97,7 @@ func (azspn *azAuthSPN) getTokenCredential() (azcore.TokenCredential, error) { defer buff.Destroy() } else { err := errors.New("AzAuthSPN::getTokenCredential : Client secret not provided for SPN") - log.Err(err.Error()) + log.Err("%s", err.Error()) return nil, err } diff --git a/component/azstorage/azstorage.go b/component/azstorage/azstorage.go index f22344f75..fda1b9bfe 100644 --- a/component/azstorage/azstorage.go +++ b/component/azstorage/azstorage.go @@ -131,13 +131,13 @@ func (az *AzStorage) OnConfigChange() { err = ParseAndReadDynamicConfig(az, conf, true) if err != nil { - log.Err("AzStorage::OnConfigChange : failed to reparse config", err.Error()) + log.Err("AzStorage::OnConfigChange : failed to reparse config [%s]", err.Error()) return } err = az.storage.UpdateConfig(az.stConfig) if err != nil { - log.Err("AzStorage::OnConfigChange : failed to UpdateConfig", err.Error()) + log.Err("AzStorage::OnConfigChange : failed to UpdateConfig [%s]", err.Error()) return } diff --git a/component/azstorage/block_blob.go b/component/azstorage/block_blob.go index 9757a75d3..f779f6538 100644 --- a/component/azstorage/block_blob.go +++ b/component/azstorage/block_blob.go @@ -462,7 +462,7 @@ func (bb *BlockBlob) RenameDirectory(source string, target string) error { log.Err( "BlockBlob::RenameDirectory : Failed to rename file %s [%s]", srcPath, - err.Error, + err.Error(), ) } } @@ -674,7 +674,7 @@ func (bb *BlockBlob) List( // APIs that may be affected include IsDirEmpty, ReadDir and StreamDir if err != nil { - log.Err("BlockBlob::List : Failed to list the container with the prefix %s", err.Error) + log.Err("BlockBlob::List : Failed to list the container with the prefix [%s]", err.Error()) return nil, nil, err } @@ -1312,7 +1312,7 @@ func (bb *BlockBlob) GetFileBlockOffsets(name string) (*common.BlockOffsetList, ) if err != nil { - log.Err("BlockBlob::GetFileBlockOffsets : Failed to get block list %s ", name, err.Error()) + log.Err("BlockBlob::GetFileBlockOffsets : Failed to get block list %s [%s]", name, err.Error()) return &common.BlockOffsetList{}, err } @@ -1488,13 +1488,13 @@ func (bb *BlockBlob) TruncateFile(name string, size int64) error { if size < blockblob.MaxUploadBlobBytes { data, err := bb.HandleSmallFile(name, size, attr.Size) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to read small file %s", name, err.Error()) + log.Err("BlockBlob::TruncateFile : Failed to read small file %s [%s]", name, err.Error()) return err } err = bb.WriteFromBuffer(name, nil, data) if err != nil { log.Err( - "BlockBlob::TruncateFile : Failed to write from buffer file %s", + "BlockBlob::TruncateFile : Failed to write from buffer file %s [%s]", name, err.Error(), ) @@ -1509,12 +1509,12 @@ func (bb *BlockBlob) TruncateFile(name string, size int64) error { if bol.SmallFile() { data, err := bb.HandleSmallFile(name, size, attr.Size) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to read small file %s", name, err.Error()) + log.Err("BlockBlob::TruncateFile : Failed to read small file %s [%s]", name, err.Error()) return err } err = bb.WriteFromBuffer(name, nil, data) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to write from buffer file %s", name, err.Error()) + log.Err("BlockBlob::TruncateFile : Failed to write from buffer file %s [%s]", name, err.Error()) return err } } else { @@ -1523,13 +1523,13 @@ func (bb *BlockBlob) TruncateFile(name string, size int64) error { } else if size > attr.Size { _, err = bb.createNewBlocks(bol, bol.BlockList[len(bol.BlockList)-1].EndIndex, size-attr.Size) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to create new blocks for file %s", name, err.Error()) + log.Err("BlockBlob::TruncateFile : Failed to create new blocks for file %s [%s]", name, err.Error()) return err } } err = bb.StageAndCommit(name, bol) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to stage and commit file %s", name, err.Error()) + log.Err("BlockBlob::TruncateFile : Failed to stage and commit file %s [%s]", name, err.Error()) return err } } @@ -1544,12 +1544,12 @@ func (bb *BlockBlob) HandleSmallFile(name string, size int64, originalSize int64 if size > originalSize { err = bb.ReadInBuffer(name, 0, 0, data, nil) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to read small file %s", name, err.Error()) + log.Err("BlockBlob::TruncateFile : Failed to read small file %s [%s]", name, err.Error()) } } else { err = bb.ReadInBuffer(name, 0, size, data, nil) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to read small file %s", name, err.Error()) + log.Err("BlockBlob::TruncateFile : Failed to read small file %s [%s]", name, err.Error()) } } return data, err @@ -1601,7 +1601,7 @@ func (bb *BlockBlob) Write(options internal.WriteFileOptions) error { // WriteFromBuffer should be able to handle the case where now the block is too big and gets split into multiple blocks err := bb.WriteFromBuffer(name, options.Metadata, *dataBuffer) if err != nil { - log.Err("BlockBlob::Write : Failed to upload to blob %s ", name, err.Error()) + log.Err("BlockBlob::Write : Failed to upload to blob %s [%s]", name, err.Error()) return err } // case 2: given offset is within the size of the blob - and the blob consists of multiple blocks @@ -1614,7 +1614,7 @@ func (bb *BlockBlob) Write(options internal.WriteFileOptions) error { if exceedsFileBlocks { newBufferSize, err = bb.createNewBlocks(fileOffsets, offset, length) if err != nil { - log.Err("BlockBlob::Write : Failed to create new blocks for file %s", name, err.Error()) + log.Err("BlockBlob::Write : Failed to create new blocks for file %s [%s]", name, err.Error()) return err } } @@ -1798,7 +1798,7 @@ func (bb *BlockBlob) GetCommittedBlockList(name string) (*internal.CommittedBloc ) if err != nil { - log.Err("BlockBlob::GetFileBlockOffsets : Failed to get block list %s ", name, err.Error()) + log.Err("BlockBlob::GetFileBlockOffsets : Failed to get block list %s [%s]", name, err.Error()) return nil, err } diff --git a/component/azstorage/block_blob_test.go b/component/azstorage/block_blob_test.go index 459c114b7..ff3f8e896 100644 --- a/component/azstorage/block_blob_test.go +++ b/component/azstorage/block_blob_test.go @@ -472,7 +472,7 @@ func (s *blockBlobTestSuite) TestCreateDir() { // Testing dir and dir/ var paths = []string{generateDirectoryName(), generateDirectoryName() + "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { err := s.az.CreateDir(internal.CreateDirOptions{Name: path}) @@ -493,7 +493,7 @@ func (s *blockBlobTestSuite) TestDeleteDir() { // Testing dir and dir/ var paths = []string{generateDirectoryName(), generateDirectoryName() + "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { s.az.CreateDir(internal.CreateDirOptions{Name: path}) @@ -607,7 +607,7 @@ func (s *blockBlobTestSuite) TestIsDirEmpty() { // Testing dir and dir/ var paths = []string{name, name + "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { empty := s.az.IsDirEmpty(internal.IsDirEmptyOptions{Name: name}) @@ -657,7 +657,7 @@ func (s *blockBlobTestSuite) TestStreamDirNoVirtualDirectory() { // Testing dir and dir/ var paths = []string{"", "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { entries, _, err := s.az.StreamDir(internal.StreamDirOptions{Name: path}) s.assert.NoError(err) @@ -701,7 +701,7 @@ func (s *blockBlobTestSuite) TestStreamDirRoot() { // Testing dir and dir/ var paths = []string{"", "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { // ReadDir only reads the first level of the hierarchy entries, _, err := s.az.StreamDir(internal.StreamDirOptions{Name: path}) @@ -787,7 +787,7 @@ func (s *blockBlobTestSuite) TestStreamDirWindowsNameConvert() { // Testing dir and dir/ var paths = []string{windowsDirName, windowsDirName + "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { entries, _, err := s.az.StreamDir(internal.StreamDirOptions{Name: path}) s.assert.NoError(err) diff --git a/component/azstorage/config.go b/component/azstorage/config.go index b263d71ca..b4fddb22f 100644 --- a/component/azstorage/config.go +++ b/component/azstorage/config.go @@ -322,7 +322,7 @@ func ParseAndValidateConfig(az *AzStorage, opt AzStorageOptions) error { if opt.BlockSize != 0 { if opt.BlockSize > blockblob.MaxStageBlockBytes { log.Err( - "ParseAndValidateConfig : Block size is too large. Block size has to be smaller than %s Bytes", + "ParseAndValidateConfig : Block size is too large. Block size has to be smaller than %d Bytes", blockblob.MaxStageBlockBytes, ) return errors.New("block size is too large") @@ -547,8 +547,7 @@ func ParseAndValidateConfig(az *AzStorage, opt AzStorageOptions) error { } log.Crit( - "ParseAndValidateConfig : account %s, container %s, account-type %s, auth %s, prefix %s, endpoint %s, MD5 %v %v, virtual-directory %v, disable-compression %v, CPK %v", - "restricted-characters-windows %v", + "ParseAndValidateConfig : account %s, container %s, account-type %s, auth %s, prefix %s, endpoint %s, MD5 %v %v, virtual-directory %v, disable-compression %v, CPK %v, restricted-characters-windows %v", az.stConfig.authConfig.AccountName, az.stConfig.container, az.stConfig.authConfig.AccountType, @@ -563,7 +562,7 @@ func ParseAndValidateConfig(az *AzStorage, opt AzStorageOptions) error { az.stConfig.restrictedCharsWin, ) log.Crit( - "ParseAndValidateConfig : use-HTTP %t, block-size %d, max-concurrency %d, default-tier %s, fail-unsupported-op %t, mount-all-containers %t", + "ParseAndValidateConfig : use-HTTP %t, block-size %d, max-concurrency %d, default-tier %v, fail-unsupported-op %t, mount-all-containers %t", az.stConfig.authConfig.UseHTTP, az.stConfig.blockSize, az.stConfig.maxConcurrency, diff --git a/component/azstorage/datalake_test.go b/component/azstorage/datalake_test.go index 2b7b90c35..3a059f639 100644 --- a/component/azstorage/datalake_test.go +++ b/component/azstorage/datalake_test.go @@ -283,7 +283,7 @@ func (s *datalakeTestSuite) TestCreateDir() { // Testing dir and dir/ var paths = []string{generateDirectoryName(), generateDirectoryName() + "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { err := s.az.CreateDir(internal.CreateDirOptions{Name: path}) @@ -320,7 +320,7 @@ func (s *datalakeTestSuite) TestCreateDirWithCPKEnabled() { // Testing dir and dir/ var paths = []string{generateDirectoryName()} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { err := s.az.CreateDir(internal.CreateDirOptions{Name: path}) @@ -345,7 +345,7 @@ func (s *datalakeTestSuite) TestDeleteDir() { // Testing dir and dir/ var paths = []string{generateDirectoryName(), generateDirectoryName() + "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { s.az.CreateDir(internal.CreateDirOptions{Name: path}) @@ -484,7 +484,7 @@ func (s *datalakeTestSuite) TestIsDirEmpty() { // Testing dir and dir/ var paths = []string{name, name + "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { empty := s.az.IsDirEmpty(internal.IsDirEmptyOptions{Name: name}) @@ -535,7 +535,7 @@ func (s *datalakeTestSuite) TestStreamDir() { // Testing dir and dir/ var paths = []string{name, name + "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { entries, _, err := s.az.StreamDir(internal.StreamDirOptions{Name: path}) s.assert.NoError(err) @@ -575,7 +575,7 @@ func (s *datalakeTestSuite) TestStreamDirRoot() { // Testing dir and dir/ var paths = []string{"", "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { // ReadDir only reads the first level of the hierarchy entries, _, err := s.az.StreamDir(internal.StreamDirOptions{Name: path}) @@ -661,7 +661,7 @@ func (s *datalakeTestSuite) TestStreamDirWindowsNameConvert() { // Testing dir and dir/ var paths = []string{windowsDirName, windowsDirName + "/"} for _, path := range paths { - log.Debug(path) + log.Debug("%s", path) s.Run(path, func() { entries, _, err := s.az.StreamDir(internal.StreamDirOptions{Name: path}) s.assert.NoError(err) diff --git a/component/entry_cache/entry_cache_test.go b/component/entry_cache/entry_cache_test.go index d456726ae..6c286582c 100644 --- a/component/entry_cache/entry_cache_test.go +++ b/component/entry_cache/entry_cache_test.go @@ -91,7 +91,7 @@ func (suite *entryCacheTestSuite) SetupTest() { "read-only: true\n\nentry_cache:\n timeout-sec: 7\n\nloopbackfs:\n path: %s", suite.fake_storage_path, ) - log.Debug(defaultConfig) + log.Debug("%s", defaultConfig) // Delete the temp directories created os.RemoveAll(suite.fake_storage_path) diff --git a/component/file_cache/cache_policy.go b/component/file_cache/cache_policy.go index b20ac657f..620f37b7d 100644 --- a/component/file_cache/cache_policy.go +++ b/component/file_cache/cache_policy.go @@ -76,14 +76,14 @@ func getUsagePercentage(path string, maxSize float64) float64 { log.Err( "cachePolicy::getUsagePercentage : failed to get disk usage for %s [%v]", path, - err.Error, + err.Error(), ) } } else { // We need to compute % usage of temp directory against configured limit currSize, err = common.GetUsage(path) if err != nil { - log.Err("cachePolicy::getUsagePercentage : failed to get directory usage for %s [%v]", path, err.Error) + log.Err("cachePolicy::getUsagePercentage : failed to get directory usage for %s [%v]", path, err.Error()) } usagePercent = (currSize / float64(maxSize)) * 100 diff --git a/component/file_cache/file_cache.go b/component/file_cache/file_cache.go index 01325aded..66b89f0b5 100644 --- a/component/file_cache/file_cache.go +++ b/component/file_cache/file_cache.go @@ -405,7 +405,7 @@ func (fc *FileCache) Configure(_ bool) error { } log.Crit( - "FileCache::Configure : create-empty %t, cache-timeout %d, tmp-path %s, max-size-mb %d, high-mark %d, low-mark %d, refresh-sec %v, max-eviction %v, hard-limit %v, policy %s, allow-non-empty-temp %t, cleanup-on-start %t, policy-trace %t, offload-io %t, sync-to-flush %t, ignore-sync %t, defaultPermission %v, diskHighWaterMark %v, maxCacheSize %v, mountPath %v", + "FileCache::Configure : create-empty %t, cache-timeout %d, tmp-path %s, max-size-mb %d, high-mark %d, low-mark %d, refresh-sec %v, max-eviction %v, hard-limit %v, policy %s, allow-non-empty-temp %t, cleanup-on-start %t, policy-trace %t, offload-io %t, sync-to-flush %t, ignore-sync %t, defaultPermission %v, diskHighWaterMark %v, maxCacheSize %v, mountPath %v, schedule-len %v", fc.createEmptyFile, int(fc.cacheTimeout), fc.tmpPath, diff --git a/component/file_cache/file_cache_linux_test.go b/component/file_cache/file_cache_linux_test.go index 4a304e890..93629f95d 100644 --- a/component/file_cache/file_cache_linux_test.go +++ b/component/file_cache/file_cache_linux_test.go @@ -67,7 +67,7 @@ func (suite *fileCacheLinuxTestSuite) SetupTest() { suite.cache_path, suite.fake_storage_path, ) - log.Debug(defaultConfig) + log.Debug("%s", defaultConfig) // Delete the temp directories created err = os.RemoveAll(suite.cache_path) diff --git a/component/file_cache/file_cache_test.go b/component/file_cache/file_cache_test.go index 7719bd979..3dc46b427 100644 --- a/component/file_cache/file_cache_test.go +++ b/component/file_cache/file_cache_test.go @@ -109,7 +109,7 @@ func (suite *fileCacheTestSuite) SetupTest() { suite.fake_storage_path, ) suite.useMock = false - log.Debug(defaultConfig) + log.Debug("%s", defaultConfig) // Delete the temp directories created err = os.RemoveAll(suite.cache_path) diff --git a/component/s3storage/client.go b/component/s3storage/client.go index c16a19910..1f19bee26 100644 --- a/component/s3storage/client.go +++ b/component/s3storage/client.go @@ -1020,7 +1020,7 @@ func (cl *Client) Write(options internal.WriteFileOptions) error { // WriteFromBuffer should be able to handle the case where now the block is too big and gets split into multiple parts err := cl.WriteFromBuffer(name, options.Metadata, *dataBuffer) if err != nil { - log.Err("Client::Write : Failed to upload to object. Here's why: %v ", name, err) + log.Err("Client::Write : Failed to upload to object %s. Here's why: %v", name, err) return err } } else { @@ -1143,7 +1143,7 @@ func (cl *Client) StageAndCommit(name string, bol *common.BlockOffsetList) error if combineBlocks { bol.BlockList, err = cl.combineSmallBlocks(name, bol.BlockList) if err != nil { - log.Err("Client::StageAndCommit : Failed to combine small blocks: %v ", name, err) + log.Err("Client::StageAndCommit : Failed to combine small blocks for %s: %v", name, err) return err } } @@ -1167,7 +1167,7 @@ func (cl *Client) StageAndCommit(name string, bol *common.BlockOffsetList) error createOutput, err := cl.AwsS3Client.CreateMultipartUpload(ctx, createMultipartUploadInput) if err != nil { log.Err( - "Client::StageAndCommit : Failed to create multipart upload. Here's why: %v ", + "Client::StageAndCommit : Failed to create multipart upload for %s. Here's why: %v", name, err, ) @@ -1180,7 +1180,7 @@ func (cl *Client) StageAndCommit(name string, bol *common.BlockOffsetList) error } if uploadID == "" { log.Err( - "Client::StageAndCommit : No upload id found in start upload request. Here's why: %v ", + "Client::StageAndCommit : No upload id found in start upload request for %s. Here's why: %v", name, err, ) @@ -1265,7 +1265,7 @@ func (cl *Client) StageAndCommit(name string, bol *common.BlockOffsetList) error if err != nil { log.Info( - "Client::StageAndCommit : Attempting to abort upload due to error: ", + "Client::StageAndCommit : Attempting to abort upload due to error: %s", err.Error(), ) abortErr := cl.abortMultipartUpload(key, uploadID) @@ -1302,7 +1302,7 @@ func (cl *Client) StageAndCommit(name string, bol *common.BlockOffsetList) error }, }) if err != nil { - log.Info("Client::StageAndCommit : Attempting to abort upload due to error: ", err.Error()) + log.Info("Client::StageAndCommit : Attempting to abort upload due to error: %s", err.Error()) abortErr := cl.abortMultipartUpload(key, uploadID) return errors.Join(err, abortErr) } @@ -1339,14 +1339,14 @@ func (cl *Client) combineSmallBlocks( if len(blk.Data) == 0 && !blk.Truncated() { result, err := cl.getObject(getObjectOptions{name: name, offset: blk.StartIndex, count: blk.EndIndex - blk.StartIndex}) if err != nil { - log.Err("Client::combineSmallBlocks : Unable to get object with error: ", err.Error()) + log.Err("Client::combineSmallBlocks : Unable to get object with error: %s", err.Error()) return nil, err } defer result.Close() addData, err = io.ReadAll(result) if err != nil { - log.Err("Client::combineSmallBlocks : Unable to read bytes from object with error: ", err.Error()) + log.Err("Client::combineSmallBlocks : Unable to read bytes from object with error: %s", err.Error()) return nil, err } } else { @@ -1487,7 +1487,7 @@ func (cl *Client) CommitBlocks(name string, blockList []string) error { createOutput, err := cl.AwsS3Client.CreateMultipartUpload(ctx, createMultipartUploadInput) if err != nil { log.Err( - "Client::CommitBlocks : Failed to create multipart upload. Here's why: %v ", + "Client::CommitBlocks : Failed to create multipart upload for %s. Here's why: %v", name, err, ) @@ -1500,7 +1500,7 @@ func (cl *Client) CommitBlocks(name string, blockList []string) error { } if uploadID == "" { log.Err( - "Client::CommitBlocks : No upload id found in start upload request. Here's why: %v ", + "Client::CommitBlocks : No upload id found in start upload request for %s. Here's why: %v", name, err, ) @@ -1551,7 +1551,7 @@ func (cl *Client) CommitBlocks(name string, blockList []string) error { partResp, err := cl.AwsS3Client.UploadPart(ctx, uploadPartInput) if err != nil { - log.Err("Client::CommitBlocks : failed to upload part: ", uploadErr) + log.Err("Client::CommitBlocks : failed to upload part: %v", uploadErr) break } diff --git a/component/s3storage/s3storage.go b/component/s3storage/s3storage.go index 6d3aad8a7..7ca0330ea 100644 --- a/component/s3storage/s3storage.go +++ b/component/s3storage/s3storage.go @@ -95,7 +95,7 @@ func (s3 *S3Storage) Configure(isParent bool) error { if encryptedKeyID == nil { err := errors.New("unable to store key-id securely") - log.Err("S3Storage::Configure : ", err.Error()) + log.Err("S3Storage::Configure : %s", err.Error()) return err } secrets.KeyID = encryptedKeyID @@ -106,7 +106,7 @@ func (s3 *S3Storage) Configure(isParent bool) error { if encryptedSecretKey == nil { err := errors.New("unable to store secret-key securely") - log.Err("S3Storage::Configure : ", err.Error()) + log.Err("S3Storage::Configure : %s", err.Error()) return err } secrets.SecretKey = encryptedSecretKey @@ -144,13 +144,13 @@ func (s3 *S3Storage) OnConfigChange() { err = ParseAndReadDynamicConfig(s3, conf, true) if err != nil { - log.Err("S3Storage::OnConfigChange : failed to reparse config", err.Error()) + log.Err("S3Storage::OnConfigChange : failed to reparse config [%s]", err.Error()) return } err = s3.Storage.UpdateConfig(s3.stConfig) if err != nil { - log.Err("S3Storage::OnConfigChange : failed to UpdateConfig", err.Error()) + log.Err("S3Storage::OnConfigChange : failed to UpdateConfig [%s]", err.Error()) return } } diff --git a/component/s3storage/s3storage_test.go b/component/s3storage/s3storage_test.go index fe30a5160..b43275064 100644 --- a/component/s3storage/s3storage_test.go +++ b/component/s3storage/s3storage_test.go @@ -452,7 +452,7 @@ func (s *s3StorageTestSuite) TestCreateDir() { // Testing dir and dir/ var paths = []string{generateDirectoryName(), generateDirectoryName() + "/"} for _, obj_path := range paths { - log.Debug(obj_path) + log.Debug("%s", obj_path) s.Run(obj_path, func() { err := s.s3Storage.CreateDir(internal.CreateDirOptions{Name: obj_path}) @@ -482,7 +482,7 @@ func (s *s3StorageTestSuite) TestDeleteDir() { // Testing dir and dir/ var paths = []string{generateDirectoryName(), generateDirectoryName() + "/"} for _, obj_path := range paths { - log.Debug(obj_path) + log.Debug("%s", obj_path) s.Run(obj_path, func() { err := s.s3Storage.CreateDir(internal.CreateDirOptions{Name: obj_path}) s.assert.NoError(err) @@ -692,7 +692,7 @@ func (s *s3StorageTestSuite) TestIsDirEmpty() { // Testing dir and dir/ var paths = []string{name, name + "/"} for _, obj_path := range paths { - log.Debug(obj_path) + log.Debug("%s", obj_path) s.Run(obj_path, func() { empty := s.s3Storage.IsDirEmpty(internal.IsDirEmptyOptions{Name: name}) @@ -716,7 +716,7 @@ func (s *s3StorageTestSuite) TestIsDirEmptyNoDirectoryMarker() { // Testing dir and dir/ var paths = []string{name, name + "/"} for _, obj_path := range paths { - log.Debug(obj_path) + log.Debug("%s", obj_path) s.Run(obj_path, func() { empty := s.s3Storage.IsDirEmpty(internal.IsDirEmptyOptions{Name: name}) @@ -762,7 +762,7 @@ func (s *s3StorageTestSuite) TestStreamDirNoVirtualDirectory() { // Testing dir and dir/ var paths = []string{"", "/"} for _, obj_path := range paths { - log.Debug(obj_path) + log.Debug("%s", obj_path) s.Run(obj_path, func() { entries, _, err := s.s3Storage.StreamDir(internal.StreamDirOptions{Name: obj_path}) // this only works if the test can create an empty test bucket @@ -807,7 +807,7 @@ func (s *s3StorageTestSuite) TestStreamDirRoot() { // Testing dir and dir/ var paths = []string{"", "/"} for _, obj_path := range paths { - log.Debug(obj_path) + log.Debug("%s", obj_path) s.Run(obj_path, func() { // ReadDir only reads the first level of the hierarchy entries, _, err := s.s3Storage.StreamDir(internal.StreamDirOptions{Name: obj_path}) @@ -893,7 +893,7 @@ func (s *s3StorageTestSuite) TestStreamDirWindowsNameConvert() { // Testing dir and dir/ var paths = []string{windowsDirName, windowsDirName + "/"} for _, obj_path := range paths { - log.Debug(obj_path) + log.Debug("%s", obj_path) s.Run(obj_path, func() { entries, _, err := s.s3Storage.StreamDir(internal.StreamDirOptions{Name: obj_path}) s.assert.NoError(err) @@ -2290,7 +2290,7 @@ func (s *s3StorageTestSuite) TestStreamDir() { // Testing dir and dir/ var paths = []string{name, name + "/"} for _, obj_path := range paths { - log.Debug(obj_path) + log.Debug("%s", obj_path) s.Run(obj_path, func() { entries, _, err := s.s3Storage.StreamDir(internal.StreamDirOptions{Name: obj_path}) s.assert.NoError(err) diff --git a/component/s3storage/s3wrappers.go b/component/s3storage/s3wrappers.go index 437c58910..5359b4a47 100644 --- a/component/s3storage/s3wrappers.go +++ b/component/s3storage/s3wrappers.go @@ -235,8 +235,8 @@ func (cl *Client) deleteObjects(objects []*internal.ObjAttr) error { for i := 0; i < len(result.Errors); i++ { log.Err( "Client::DeleteDirectory : Failed to delete key %s. Here's why: %s", - result.Errors[i].Key, - result.Errors[i].Message, + *result.Errors[i].Key, + *result.Errors[i].Message, ) } } @@ -348,7 +348,7 @@ func (cl *Client) abortMultipartUpload(key string, uploadID string) error { }, ) if abortErr != nil { - log.Err("Client::StageAndCommit : Error aborting multipart upload: ", abortErr.Error()) + log.Err("Client::StageAndCommit : Error aborting multipart upload: %s", abortErr.Error()) } // AWS states you need to call listparts to verify that multipart upload was properly aborted @@ -359,10 +359,10 @@ func (cl *Client) abortMultipartUpload(key string, uploadID string) error { }) if listErr != nil { log.Err( - "Client::StageAndCommit : Error calling list parts. Unable to verify if multipart upload was properly aborted with key: %s, uploadId: %s, error: ", + "Client::StageAndCommit : Error calling list parts. Unable to verify if multipart upload was properly aborted with key: %s, uploadId: %s, error: %v", key, uploadID, - abortErr.Error(), + abortErr, ) return errors.Join(abortErr, listErr) } diff --git a/component/s3storage/utils.go b/component/s3storage/utils.go index 87a60fdf7..c2e3bfe22 100644 --- a/component/s3storage/utils.go +++ b/component/s3storage/utils.go @@ -135,9 +135,9 @@ func parseS3Err(err error, attemptedAction string) error { errorCode, ) if strings.HasPrefix(attemptedAction, "HeadObject") { - log.Warn(message) + log.Warn("%s", message) } else { - log.Err(message) + log.Err("%s", message) } return syscall.ENOENT } diff --git a/component/stream/read.go b/component/stream/read.go index 5b2626a8e..30f26d833 100644 --- a/component/stream/read.go +++ b/component/stream/read.go @@ -96,7 +96,7 @@ func (r *ReadCache) OpenFile(options internal.OpenFileOptions) (*handlemap.Handl handlemap.CreateCacheObject(int64(r.BufferSize), handle) if r.CachedObjects >= r.CachedObjLimit { log.Trace( - "Stream::OpenFile : file handle limit exceeded - switch handle to stream only mode %s [%s]", + "Stream::OpenFile : file handle limit exceeded - switch handle to stream only mode %s [%v]", options.Name, handle.ID, ) diff --git a/component/stream/stream.go b/component/stream/stream.go index d0b1a6f2e..f01f4971b 100644 --- a/component/stream/stream.go +++ b/component/stream/stream.go @@ -109,7 +109,7 @@ func (st *Stream) Configure(_ bool) error { st.cache = NewStreamConnection(conf, st) log.Info( - "Stream::Configure : Buffer size %v, Block size %v, Handle limit %v, FileCaching %v, Read-only %v, StreamCacheMb %v, MaxBlocksPerFile %v", + "Stream::Configure : Buffer size %v, Block size %v, Handle limit %v, FileCaching %v, Read-only %v", conf.BufferSize, conf.BlockSize, conf.CachedObjLimit, diff --git a/component/xload/xload_test.go b/component/xload/xload_test.go index 983ac6bbd..a92e92ccf 100644 --- a/component/xload/xload_test.go +++ b/component/xload/xload_test.go @@ -88,7 +88,7 @@ func (suite *xloadTestSuite) SetupTest() { suite.local_path, suite.fake_storage_path, ) - log.Debug(defaultConfig) + log.Debug("%s", defaultConfig) // Delete the temp directories created os.RemoveAll(suite.local_path) diff --git a/tools/health-monitor/internal/stats_export.go b/tools/health-monitor/internal/stats_export.go index 8295555c6..84c5ef54c 100644 --- a/tools/health-monitor/internal/stats_export.go +++ b/tools/health-monitor/internal/stats_export.go @@ -243,7 +243,7 @@ func (se *StatsExporter) checkOutputFile() error { err = se.getNewFile() if err != nil { - log.Err("stats_exporter::checkOutputFile : [%v]") + log.Err("stats_exporter::checkOutputFile : [%v]", err) return err } return nil diff --git a/tools/health-monitor/main.go b/tools/health-monitor/main.go index 77af2ba36..c778985c1 100644 --- a/tools/health-monitor/main.go +++ b/tools/health-monitor/main.go @@ -114,8 +114,8 @@ func main() { "Cloudfuse Stats poll interval: %v \n"+ "Health Stats poll interval: %v \n"+ "Cache Path: %v \n"+ - "Max cache size in MB: %v \n", - "Output path: %v", + "Max cache size in MB: %v \n"+ + "Output path: %v", hmcommon.Pid, common.TransferPipe, common.PollingPipe, From 0db170d4ef9660c735b6258318d24277398b4128 Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Wed, 17 Dec 2025 15:25:55 -0700 Subject: [PATCH 4/8] Fix more go vet issues --- component/file_cache/file_cache_windows_test.go | 2 +- internal/winservice/service_windows.go | 4 ++-- .../monitor/cloudfuse_stats/stats_reader_windows.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/component/file_cache/file_cache_windows_test.go b/component/file_cache/file_cache_windows_test.go index e176715b5..ad9529df5 100644 --- a/component/file_cache/file_cache_windows_test.go +++ b/component/file_cache/file_cache_windows_test.go @@ -61,7 +61,7 @@ func (suite *fileCacheWindowsTestSuite) SetupTest() { suite.cache_path = common.JoinUnixFilepath(home_dir, "file_cache"+rand) suite.fake_storage_path = common.JoinUnixFilepath(home_dir, "fake_storage"+rand) defaultConfig := fmt.Sprintf("file_cache:\n path: %s\n offload-io: true\n timeout-sec: 1\n\nloopbackfs:\n path: %s", suite.cache_path, suite.fake_storage_path) - log.Debug(defaultConfig) + log.Debug("%s", defaultConfig) // Delete the temp directories created err = os.RemoveAll(suite.cache_path) diff --git a/internal/winservice/service_windows.go b/internal/winservice/service_windows.go index 457f075a3..54407613e 100644 --- a/internal/winservice/service_windows.go +++ b/internal/winservice/service_windows.go @@ -127,7 +127,7 @@ func StartMounts(useSystem bool) error { for _, inst := range mounts.Mounts { err := StartMount(inst.MountPath, inst.ConfigFile, nil) if err != nil { - log.Err("Unable to start mount with mountpath: ", inst.MountPath) + log.Err("Unable to start mount with mountpath: %s", inst.MountPath) } } @@ -146,7 +146,7 @@ func StopMounts(useSystem bool) error { for _, inst := range mounts.Mounts { err := StopMount(inst.MountPath) if err != nil { - log.Err("Unable to start mount with mountpath: ", inst.MountPath) + log.Err("Unable to start mount with mountpath: %s", inst.MountPath) } } diff --git a/tools/health-monitor/monitor/cloudfuse_stats/stats_reader_windows.go b/tools/health-monitor/monitor/cloudfuse_stats/stats_reader_windows.go index 6247d55a5..73d511f3d 100644 --- a/tools/health-monitor/monitor/cloudfuse_stats/stats_reader_windows.go +++ b/tools/health-monitor/monitor/cloudfuse_stats/stats_reader_windows.go @@ -64,7 +64,7 @@ func (cfs *CloudfuseStats) statsReader() error { // See https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-connectnamedpipe err = windows.ConnectNamedPipe(handle, nil) if err == windows.ERROR_PIPE_CONNECTED { - log.Err("StatsReader::statsReader : There is a process at other end of pipe %s: retrying...", cfs.transferPipe, err) + log.Err("StatsReader::statsReader : There is a process at other end of pipe %s: retrying... [%v]", cfs.transferPipe, err) windows.Close(handle) time.Sleep(1 * time.Second) } else if err != nil { @@ -169,7 +169,7 @@ func (cfs *CloudfuseStats) statsPoll() { for t := range ticker.C { _, err = writer.WriteString(fmt.Sprintf("Poll at %v", t.Format(time.RFC3339))) - log.Debug("stats_manager::statsDumper : writing to polling pipe file:", fmt.Sprintf("Poll at %v", t.Format(time.RFC3339))) + log.Debug("stats_manager::statsDumper : writing to polling pipe file: %s", fmt.Sprintf("Poll at %v", t.Format(time.RFC3339))) if err != nil { log.Err("StatsReader::statsPoll : [%v]", err) break From 94a0a9d3e304db0902d8fe84ded6ea9c835b4ccd Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Tue, 3 Feb 2026 12:02:35 -0700 Subject: [PATCH 5/8] Cleanup by formatting code --- cmd/mount_list_test.go | 4 +- cmd/mount_windows.go | 14 ++- cmd/mount_windows_test.go | 104 +++++++++++++++--- cmd/service_windows.go | 42 +++++-- cmd/unmount_windows.go | 11 +- component/azstorage/block_blob.go | 60 ++++++++-- component/block_cache/block_windows.go | 6 +- component/block_cache/consistency_windows.go | 7 +- component/file_cache/cache_policy.go | 6 +- .../file_cache/file_cache_windows_test.go | 34 +++++- component/libfuse/fuse3_options.go | 10 +- component/s3storage/client.go | 15 ++- component/size_tracker/journal_test.go | 7 +- component/xload/block_windows.go | 6 +- .../stats_manager/stats_manager_windows.go | 41 +++++-- internal/winservice/registry_windows.go | 6 +- internal/winservice/service_windows.go | 13 ++- .../cloudfuse_stats/stats_reader_windows.go | 28 ++++- tools/windows-service/main.go | 18 ++- 19 files changed, 359 insertions(+), 73 deletions(-) diff --git a/cmd/mount_list_test.go b/cmd/mount_list_test.go index 1d06c6ad6..28e978114 100644 --- a/cmd/mount_list_test.go +++ b/cmd/mount_list_test.go @@ -66,8 +66,8 @@ func (suite *mountListTestSuite) TestMountListNoMounts() { output, err := executeCommandC(rootCmd, "mount", "list") suite.assert.NoError(err) // Either no mounts or lists some mounts - both are valid - suite.assert.True( - len(output) > 0, + suite.assert.NotEmpty( + output, "Expected output from mount list command", ) } diff --git a/cmd/mount_windows.go b/cmd/mount_windows.go index bfcf20e39..e356a48b4 100644 --- a/cmd/mount_windows.go +++ b/cmd/mount_windows.go @@ -40,7 +40,14 @@ import ( // Create dummy function so that mount.go code can compile // This function is used only on Linux, so it creates an empty context here -func createDaemon(pipeline *internal.Pipeline, ctx context.Context, pidFileName string, pidFilePerm os.FileMode, umask int, fname string) error { +func createDaemon( + pipeline *internal.Pipeline, + ctx context.Context, + pidFileName string, + pidFilePerm os.FileMode, + umask int, + fname string, +) error { return nil } @@ -103,7 +110,10 @@ func readPassphraseFromPipe(pipeName string, timeout time.Duration) (string, err // We will retry until the timeout expires. if err == windows.ERROR_PIPE_BUSY { if time.Now().After(deadline) { - return "", fmt.Errorf("timed out waiting for pipe '%s' to become available", pipeName) + return "", fmt.Errorf( + "timed out waiting for pipe '%s' to become available", + pipeName, + ) } time.Sleep(50 * time.Millisecond) continue diff --git a/cmd/mount_windows_test.go b/cmd/mount_windows_test.go index b07e78221..6d35fec8d 100644 --- a/cmd/mount_windows_test.go +++ b/cmd/mount_windows_test.go @@ -103,11 +103,24 @@ func (suite *mountTestSuite) TestForegroundMountDirDoesExist() { tempDir := filepath.Join(mntDir, "tempdir") err = os.MkdirAll(tempDir, 0777) - op, err := executeCommandC(rootCmd, "mount", tempDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true") + op, err := executeCommandC( + rootCmd, + "mount", + tempDir, + fmt.Sprintf("--config-file=%s", confFileMntTest), + "--foreground=true", + ) suite.assert.NotNil(err) suite.assert.Contains(op, "mount directory already exists") - op, err = executeCommandC(rootCmd, "mount", "all", tempDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true") + op, err = executeCommandC( + rootCmd, + "mount", + "all", + tempDir, + fmt.Sprintf("--config-file=%s", confFileMntTest), + "--foreground=true", + ) suite.assert.NotNil(err) suite.assert.Contains(op, "mount directory already exists") } @@ -124,11 +137,25 @@ func (suite *mountTestSuite) TestForegroundMountDirNotEmpty() { suite.assert.Nil(err) defer os.RemoveAll(mntDir) - op, err := executeCommandC(rootCmd, "mount", mntDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true") + op, err := executeCommandC( + rootCmd, + "mount", + mntDir, + fmt.Sprintf("--config-file=%s", confFileMntTest), + "--foreground=true", + ) suite.assert.NotNil(err) suite.assert.Contains(op, "mount directory already exists") - op, err = executeCommandC(rootCmd, "mount", mntDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "-o", "nonempty", "--foreground=true") + op, err = executeCommandC( + rootCmd, + "mount", + mntDir, + fmt.Sprintf("--config-file=%s", confFileMntTest), + "-o", + "nonempty", + "--foreground=true", + ) suite.assert.NotNil(err) suite.assert.Contains(op, "mount directory already exists") } @@ -137,11 +164,24 @@ func (suite *mountTestSuite) TestForegroundMountDirNotEmpty() { func (suite *mountTestSuite) TestForegroundMountPathNotProvided() { defer suite.cleanupTest() - op, err := executeCommandC(rootCmd, "mount", "", fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true") + op, err := executeCommandC( + rootCmd, + "mount", + "", + fmt.Sprintf("--config-file=%s", confFileMntTest), + "--foreground=true", + ) suite.assert.NotNil(err) suite.assert.Contains(op, "mount path not provided") - op, err = executeCommandC(rootCmd, "mount", "all", "", fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true") + op, err = executeCommandC( + rootCmd, + "mount", + "all", + "", + fmt.Sprintf("--config-file=%s", confFileMntTest), + "--foreground=true", + ) suite.assert.NotNil(err) suite.assert.Contains(op, "mount path not provided") } @@ -163,7 +203,13 @@ func (suite *mountTestSuite) TestForegroundConfigFileTypeUnsupported() { mntDir := "mntdir" - op, err := executeCommandC(rootCmd, "mount", mntDir, "--config-file=cfgInvalid.yam", "--foreground=true") + op, err := executeCommandC( + rootCmd, + "mount", + mntDir, + "--config-file=cfgInvalid.yam", + "--foreground=true", + ) suite.assert.NotNil(err) suite.assert.Contains(op, "invalid config file") suite.assert.Contains(op, "Unsupported Config Type") @@ -175,12 +221,25 @@ func (suite *mountTestSuite) TestForegroundConfigFileNotFound() { mntDir := "mntdir" - op, err := executeCommandC(rootCmd, "mount", mntDir, "--config-file=cfgNotFound.yaml", "--foreground=true") + op, err := executeCommandC( + rootCmd, + "mount", + mntDir, + "--config-file=cfgNotFound.yaml", + "--foreground=true", + ) suite.assert.NotNil(err) suite.assert.Contains(op, "invalid config file") suite.assert.Contains(op, "cannot find the file specified") - op, err = executeCommandC(rootCmd, "mount", "all", mntDir, "--config-file=cfgNotFound.yaml", "--foreground=true") + op, err = executeCommandC( + rootCmd, + "mount", + "all", + mntDir, + "--config-file=cfgNotFound.yaml", + "--foreground=true", + ) suite.assert.NotNil(err) suite.assert.Contains(op, "invalid config file") suite.assert.Contains(op, "cannot find the file specified") @@ -233,7 +292,14 @@ func (suite *mountTestSuite) TestForegroundInvalidLogLevel() { mntDir := "mntdir" - op, err := executeCommandC(rootCmd, "mount", mntDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "--log-level=debug", "--foreground=true") + op, err := executeCommandC( + rootCmd, + "mount", + mntDir, + fmt.Sprintf("--config-file=%s", confFileMntTest), + "--log-level=debug", + "--foreground=true", + ) suite.assert.NotNil(err) suite.assert.Contains(op, "invalid log level") } @@ -245,9 +311,21 @@ func (suite *mountTestSuite) TestForegroundInvalidUmaskValue() { mntDir := "mntdir" // incorrect umask value - op, err := executeCommandC(rootCmd, "mount", mntDir, fmt.Sprintf("--config-file=%s", confFileMntTest), "--foreground=true", - "-o allow_other", "-o attr_timeout=120", "-o entry_timeout=120", "-o negative_timeout=120", - "-o ro", "-o allow_root", "-o default_permissions", "-o umask=abcd") + op, err := executeCommandC( + rootCmd, + "mount", + mntDir, + fmt.Sprintf("--config-file=%s", confFileMntTest), + "--foreground=true", + "-o allow_other", + "-o attr_timeout=120", + "-o entry_timeout=120", + "-o negative_timeout=120", + "-o ro", + "-o allow_root", + "-o default_permissions", + "-o umask=abcd", + ) suite.assert.NotNil(err) suite.assert.Contains(op, "failed to parse umask") } diff --git a/cmd/service_windows.go b/cmd/service_windows.go index c2657ac3b..902283453 100644 --- a/cmd/service_windows.go +++ b/cmd/service_windows.go @@ -60,7 +60,9 @@ var serviceCmd = &cobra.Command{ SuggestFor: []string{"ser", "serv"}, Example: "cloudfuse service install", RunE: func(cmd *cobra.Command, args []string) error { - return errors.New("missing command options\n\nDid you mean this?\n\tcloudfuse service install\n\nRun 'cloudfuse service --help' for usage") + return errors.New( + "missing command options\n\nDid you mean this?\n\tcloudfuse service install\n\nRun 'cloudfuse service --help' for usage", + ) }, } @@ -74,7 +76,10 @@ var installCmd = &cobra.Command{ // Create the registry for WinFsp err := winservice.CreateWinFspRegistry() if err != nil { - return fmt.Errorf("Failed to add Windows registry for WinFSP support. Here's why: [%v]", err) + return fmt.Errorf( + "Failed to add Windows registry for WinFSP support. Here's why: [%v]", + err, + ) } // Add our startup process to the registry var programPath string @@ -83,7 +88,12 @@ var installCmd = &cobra.Command{ // If we can't determine our location, use a standard path programFiles := os.Getenv("ProgramFiles") if programFiles == "" { - programPath = filepath.Join("C:", "Program Files", "Cloudfuse", "windows-startup.exe") + programPath = filepath.Join( + "C:", + "Program Files", + "Cloudfuse", + "windows-startup.exe", + ) } else { programPath = filepath.Join(programFiles, "Cloudfuse", "windows-startup.exe") } @@ -91,7 +101,11 @@ var installCmd = &cobra.Command{ programPath = filepath.Join(filepath.Dir(exepath), "windows-startup.exe") } - err = winservice.AddRegistryValue(`SOFTWARE\Microsoft\Windows\CurrentVersion\Run`, "Cloudfuse", programPath) + err = winservice.AddRegistryValue( + `SOFTWARE\Microsoft\Windows\CurrentVersion\Run`, + "Cloudfuse", + programPath, + ) if err != nil { return fmt.Errorf("Failed to add startup registry value. Here's why: %v", err) } @@ -113,19 +127,31 @@ var uninstallCmd = &cobra.Command{ Example: "cloudfuse service uninstall", RunE: func(cmd *cobra.Command, args []string) error { // Remove the cloudfuse startup registry entry - err := winservice.RemoveRegistryValue(`SOFTWARE\Microsoft\Windows\CurrentVersion\Run`, "Cloudfuse") + err := winservice.RemoveRegistryValue( + `SOFTWARE\Microsoft\Windows\CurrentVersion\Run`, + "Cloudfuse", + ) if err != nil { - return fmt.Errorf("Failed to remove cloudfuse remount service from Windows startup registry. Here's why: %v", err) + return fmt.Errorf( + "Failed to remove cloudfuse remount service from Windows startup registry. Here's why: %v", + err, + ) } // Remove the registry for WinFsp err = winservice.RemoveWinFspRegistry() if err != nil { - return fmt.Errorf("Failed to remove cloudfuse entry from WinFSP registry. Here's why: %v", err) + return fmt.Errorf( + "Failed to remove cloudfuse entry from WinFSP registry. Here's why: %v", + err, + ) } err = stopService() if err != nil { - cmd.PrintErrf("Attempted to stop service but failed, now attempting to remove service. Here's why: %v", err) + cmd.PrintErrf( + "Attempted to stop service but failed, now attempting to remove service. Here's why: %v", + err, + ) } err = removeService() diff --git a/cmd/unmount_windows.go b/cmd/unmount_windows.go index f1f9c3c1f..5c7abba44 100644 --- a/cmd/unmount_windows.go +++ b/cmd/unmount_windows.go @@ -34,13 +34,20 @@ import ( "github.com/Seagate/cloudfuse/internal/winservice" ) -func unmountCloudfuseWindows(mountPath string, disableRemountUser bool, disableRemountSystem bool) error { +func unmountCloudfuseWindows( + mountPath string, + disableRemountUser bool, + disableRemountSystem bool, +) error { // Remove the mount from json file so it does not remount on restart. if disableRemountUser || disableRemountSystem { err := winservice.RemoveMountJSON(mountPath, disableRemountSystem) // If error is not nill then ignore it if err != nil { - log.Err("failed to remove entry from json file [%s]. Are you sure this mount was enabled for remount?", err.Error()) + log.Err( + "failed to remove entry from json file [%s]. Are you sure this mount was enabled for remount?", + err.Error(), + ) } } diff --git a/component/azstorage/block_blob.go b/component/azstorage/block_blob.go index 6c8e9974e..526081421 100644 --- a/component/azstorage/block_blob.go +++ b/component/azstorage/block_blob.go @@ -1323,7 +1323,11 @@ func (bb *BlockBlob) GetFileBlockOffsets(name string) (*common.BlockOffsetList, ) if err != nil { - log.Err("BlockBlob::GetFileBlockOffsets : Failed to get block list %s [%s]", name, err.Error()) + log.Err( + "BlockBlob::GetFileBlockOffsets : Failed to get block list %s [%s]", + name, + err.Error(), + ) return &common.BlockOffsetList{}, err } @@ -1505,7 +1509,11 @@ func (bb *BlockBlob) TruncateFile(name string, size int64) error { if size < blockblob.MaxUploadBlobBytes { data, err := bb.HandleSmallFile(name, size, attr.Size) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to read small file %s [%s]", name, err.Error()) + log.Err( + "BlockBlob::TruncateFile : Failed to read small file %s [%s]", + name, + err.Error(), + ) return err } err = bb.WriteFromBuffer(name, nil, data) @@ -1530,12 +1538,20 @@ func (bb *BlockBlob) TruncateFile(name string, size int64) error { if bol.SmallFile() { data, err := bb.HandleSmallFile(name, size, attr.Size) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to read small file %s [%s]", name, err.Error()) + log.Err( + "BlockBlob::TruncateFile : Failed to read small file %s [%s]", + name, + err.Error(), + ) return err } err = bb.WriteFromBuffer(name, nil, data) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to write from buffer file %s [%s]", name, err.Error()) + log.Err( + "BlockBlob::TruncateFile : Failed to write from buffer file %s [%s]", + name, + err.Error(), + ) return err } } else { @@ -1548,13 +1564,21 @@ func (bb *BlockBlob) TruncateFile(name string, size int64) error { size-attr.Size, ) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to create new blocks for file %s [%s]", name, err.Error()) + log.Err( + "BlockBlob::TruncateFile : Failed to create new blocks for file %s [%s]", + name, + err.Error(), + ) return err } } err = bb.StageAndCommit(name, bol) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to stage and commit file %s [%s]", name, err.Error()) + log.Err( + "BlockBlob::TruncateFile : Failed to stage and commit file %s [%s]", + name, + err.Error(), + ) return err } } @@ -1569,12 +1593,20 @@ func (bb *BlockBlob) HandleSmallFile(name string, size int64, originalSize int64 if size > originalSize { err = bb.ReadInBuffer(name, 0, 0, data, nil) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to read small file %s [%s]", name, err.Error()) + log.Err( + "BlockBlob::TruncateFile : Failed to read small file %s [%s]", + name, + err.Error(), + ) } } else { err = bb.ReadInBuffer(name, 0, size, data, nil) if err != nil { - log.Err("BlockBlob::TruncateFile : Failed to read small file %s [%s]", name, err.Error()) + log.Err( + "BlockBlob::TruncateFile : Failed to read small file %s [%s]", + name, + err.Error(), + ) } } return data, err @@ -1642,7 +1674,11 @@ func (bb *BlockBlob) Write(options internal.WriteFileOptions) error { if exceedsFileBlocks { newBufferSize, err = bb.createNewBlocks(fileOffsets, offset, length) if err != nil { - log.Err("BlockBlob::Write : Failed to create new blocks for file %s [%s]", name, err.Error()) + log.Err( + "BlockBlob::Write : Failed to create new blocks for file %s [%s]", + name, + err.Error(), + ) return err } } @@ -1836,7 +1872,11 @@ func (bb *BlockBlob) GetCommittedBlockList(name string) (*internal.CommittedBloc ) if err != nil { - log.Err("BlockBlob::GetFileBlockOffsets : Failed to get block list %s [%s]", name, err.Error()) + log.Err( + "BlockBlob::GetFileBlockOffsets : Failed to get block list %s [%s]", + name, + err.Error(), + ) return nil, err } diff --git a/component/block_cache/block_windows.go b/component/block_cache/block_windows.go index cba7fe4dc..0123a1521 100644 --- a/component/block_cache/block_windows.go +++ b/component/block_cache/block_windows.go @@ -48,7 +48,11 @@ func AllocateBlock(size uint64) (*Block, error) { } else { if freeRam < size { // Not enough free RAM to allocate the requested size - return nil, fmt.Errorf("insufficient memory available: requested %d bytes, available %d bytes", size, freeRam) + return nil, fmt.Errorf( + "insufficient memory available: requested %d bytes, available %d bytes", + size, + freeRam, + ) } } diff --git a/component/block_cache/consistency_windows.go b/component/block_cache/consistency_windows.go index 429fd3ed6..3259e7bc7 100644 --- a/component/block_cache/consistency_windows.go +++ b/component/block_cache/consistency_windows.go @@ -33,6 +33,11 @@ func setBlockChecksum(localPath string, data []byte, n int) error { } // checkBlockConsistency is a no-op on Windows. -func checkBlockConsistency(blockCache *BlockCache, item *workItem, numberOfBytes int, localPath, fileName string) bool { +func checkBlockConsistency( + blockCache *BlockCache, + item *workItem, + numberOfBytes int, + localPath, fileName string, +) bool { return true } diff --git a/component/file_cache/cache_policy.go b/component/file_cache/cache_policy.go index 620f37b7d..ab587be12 100644 --- a/component/file_cache/cache_policy.go +++ b/component/file_cache/cache_policy.go @@ -83,7 +83,11 @@ func getUsagePercentage(path string, maxSize float64) float64 { // We need to compute % usage of temp directory against configured limit currSize, err = common.GetUsage(path) if err != nil { - log.Err("cachePolicy::getUsagePercentage : failed to get directory usage for %s [%v]", path, err.Error()) + log.Err( + "cachePolicy::getUsagePercentage : failed to get directory usage for %s [%v]", + path, + err.Error(), + ) } usagePercent = (currSize / float64(maxSize)) * 100 diff --git a/component/file_cache/file_cache_windows_test.go b/component/file_cache/file_cache_windows_test.go index ad9529df5..7b464b8dd 100644 --- a/component/file_cache/file_cache_windows_test.go +++ b/component/file_cache/file_cache_windows_test.go @@ -60,17 +60,29 @@ func (suite *fileCacheWindowsTestSuite) SetupTest() { rand := randomString(8) suite.cache_path = common.JoinUnixFilepath(home_dir, "file_cache"+rand) suite.fake_storage_path = common.JoinUnixFilepath(home_dir, "fake_storage"+rand) - defaultConfig := fmt.Sprintf("file_cache:\n path: %s\n offload-io: true\n timeout-sec: 1\n\nloopbackfs:\n path: %s", suite.cache_path, suite.fake_storage_path) + defaultConfig := fmt.Sprintf( + "file_cache:\n path: %s\n offload-io: true\n timeout-sec: 1\n\nloopbackfs:\n path: %s", + suite.cache_path, + suite.fake_storage_path, + ) log.Debug("%s", defaultConfig) // Delete the temp directories created err = os.RemoveAll(suite.cache_path) if err != nil { - fmt.Printf("fileCacheWindowsTestSuite::SetupTest : os.RemoveAll(%s) failed [%v]\n", suite.cache_path, err) + fmt.Printf( + "fileCacheWindowsTestSuite::SetupTest : os.RemoveAll(%s) failed [%v]\n", + suite.cache_path, + err, + ) } err = os.RemoveAll(suite.fake_storage_path) if err != nil { - fmt.Printf("fileCacheWindowsTestSuite::SetupTest : os.RemoveAll(%s) failed [%v]\n", suite.fake_storage_path, err) + fmt.Printf( + "fileCacheWindowsTestSuite::SetupTest : os.RemoveAll(%s) failed [%v]\n", + suite.fake_storage_path, + err, + ) } suite.setupTestHelper(defaultConfig) } @@ -99,11 +111,19 @@ func (suite *fileCacheWindowsTestSuite) cleanupTest() { // Delete the temp directories created err = os.RemoveAll(suite.cache_path) if err != nil { - fmt.Printf("fileCacheWindowsTestSuite::cleanupTest : os.RemoveAll(%s) failed [%v]\n", suite.cache_path, err) + fmt.Printf( + "fileCacheWindowsTestSuite::cleanupTest : os.RemoveAll(%s) failed [%v]\n", + suite.cache_path, + err, + ) } err = os.RemoveAll(suite.fake_storage_path) if err != nil { - fmt.Printf("fileCacheWindowsTestSuite::cleanupTest : os.RemoveAll(%s) failed [%v]\n", suite.fake_storage_path, err) + fmt.Printf( + "fileCacheWindowsTestSuite::cleanupTest : os.RemoveAll(%s) failed [%v]\n", + suite.fake_storage_path, + err, + ) } } @@ -131,7 +151,9 @@ func (suite *fileCacheWindowsTestSuite) TestChownInCache() { defer suite.cleanupTest() // Setup path := "file" - createHandle, _ := suite.fileCache.CreateFile(internal.CreateFileOptions{Name: path, Mode: 0777}) + createHandle, _ := suite.fileCache.CreateFile( + internal.CreateFileOptions{Name: path, Mode: 0777}, + ) openHandle, _ := suite.fileCache.OpenFile(internal.OpenFileOptions{Name: path, Mode: 0777}) suite.fileCache.CloseFile(internal.CloseFileOptions{Handle: createHandle}) diff --git a/component/libfuse/fuse3_options.go b/component/libfuse/fuse3_options.go index dec93b1e0..a65ac83d7 100644 --- a/component/libfuse/fuse3_options.go +++ b/component/libfuse/fuse3_options.go @@ -34,7 +34,15 @@ import ( ) // createFuseOptions creates the command line options for Fuse3. Some are not available in Fuse3 such as nonempty mount -func createFuseOptions(host *fuse.FileSystemHost, allowOther bool, allowRoot bool, readOnly bool, nonEmptyMount bool, maxFuseThreads uint32, umask uint32) string { +func createFuseOptions( + host *fuse.FileSystemHost, + allowOther bool, + allowRoot bool, + readOnly bool, + nonEmptyMount bool, + maxFuseThreads uint32, + umask uint32, +) string { var options string // While reading a file let kernel do readahead for better perf // options += fmt.Sprintf(",max_readahead=%d", 4*1024*1024) diff --git a/component/s3storage/client.go b/component/s3storage/client.go index 26914abed..030ae6614 100644 --- a/component/s3storage/client.go +++ b/component/s3storage/client.go @@ -1331,7 +1331,10 @@ func (cl *Client) StageAndCommit(name string, bol *common.BlockOffsetList) error }, }) if err != nil { - log.Info("Client::StageAndCommit : Attempting to abort upload due to error: %s", err.Error()) + log.Info( + "Client::StageAndCommit : Attempting to abort upload due to error: %s", + err.Error(), + ) abortErr := cl.abortMultipartUpload(key, uploadID) return errors.Join(err, abortErr) } @@ -1374,14 +1377,20 @@ func (cl *Client) combineSmallBlocks( }, ) if err != nil { - log.Err("Client::combineSmallBlocks : Unable to get object with error: %s", err.Error()) + log.Err( + "Client::combineSmallBlocks : Unable to get object with error: %s", + err.Error(), + ) return nil, err } defer result.Close() addData, err = io.ReadAll(result) if err != nil { - log.Err("Client::combineSmallBlocks : Unable to read bytes from object with error: %s", err.Error()) + log.Err( + "Client::combineSmallBlocks : Unable to read bytes from object with error: %s", + err.Error(), + ) return nil, err } } else { diff --git a/component/size_tracker/journal_test.go b/component/size_tracker/journal_test.go index 3d537c913..5710558b3 100644 --- a/component/size_tracker/journal_test.go +++ b/component/size_tracker/journal_test.go @@ -9,7 +9,6 @@ package size_tracker import ( "bufio" "encoding/binary" - "fmt" "os" "path/filepath" "testing" @@ -156,7 +155,7 @@ func TestJournal_EpochBumpDiscardsDelta(t *testing.T) { require.Contains( t, content, "size_bytes=999", - fmt.Sprintf("content: %s", content), + "content: %s", content, ) } @@ -224,7 +223,7 @@ func TestJournal_HigherLocalEpochOverwritesFile(t *testing.T) { require.Contains( t, content, "size_bytes=150", - fmt.Sprintf("expected size_bytes=150 in content: %s", content), + "expected size_bytes=150 in content: %s", content, ) // To further verify: write a file with lower epoch @@ -253,6 +252,6 @@ func TestJournal_HigherLocalEpochOverwritesFile(t *testing.T) { require.Contains( t, content, "size_bytes=175", - fmt.Sprintf("expected size_bytes=175 in content: %s", content), + "expected size_bytes=175 in content: %s", content, ) } diff --git a/component/xload/block_windows.go b/component/xload/block_windows.go index 9a9b38fb2..7ec971028 100644 --- a/component/xload/block_windows.go +++ b/component/xload/block_windows.go @@ -57,7 +57,11 @@ func AllocateBlock(size uint64) (*Block, error) { } else { if freeRam < size { // Not enough free RAM to allocate the requested size - return nil, fmt.Errorf("insufficient memory available: requested %d bytes, available %d bytes", size, freeRam) + return nil, fmt.Errorf( + "insufficient memory available: requested %d bytes, available %d bytes", + size, + freeRam, + ) } } diff --git a/internal/stats_manager/stats_manager_windows.go b/internal/stats_manager/stats_manager_windows.go index 04923aa26..797a0e7f2 100644 --- a/internal/stats_manager/stats_manager_windows.go +++ b/internal/stats_manager/stats_manager_windows.go @@ -62,13 +62,20 @@ func (sc *StatsCollector) statsDumper() { windows.Close(tPipe) if err == windows.ERROR_FILE_NOT_FOUND { - log.Info("stats_manager::statsDumper : Named pipe %s not found, retrying...", common.TransferPipe) + log.Info( + "stats_manager::statsDumper : Named pipe %s not found, retrying...", + common.TransferPipe, + ) time.Sleep(1 * time.Second) } else if err == windows.ERROR_PIPE_BUSY { log.Err("stats_manager::statsDumper: Pipe instances are busy, retrying...") time.Sleep(1 * time.Second) } else { - log.Err("stats_manager::statsDumper: Unable to open pipe %s with error [%v]", common.TransferPipe, err) + log.Err( + "stats_manager::statsDumper: Unable to open pipe %s with error [%v]", + common.TransferPipe, + err, + ) return } } @@ -130,8 +137,12 @@ func (sc *StatsCollector) statsDumper() { case Decrement: stMgrOpt.statsList[idx].Value[stat.Key] = stMgrOpt.statsList[idx].Value[stat.Key].(int64) - stat.Value.(int64) if stMgrOpt.statsList[idx].Value[stat.Key].(int64) < 0 { - log.Err("stats_manager::statsDumper : Negative value %v after decrement of %v for component %v", - stMgrOpt.statsList[idx].Value[stat.Key], stat.Key, stMgrOpt.statsList[idx].ComponentName) + log.Err( + "stats_manager::statsDumper : Negative value %v after decrement of %v for component %v", + stMgrOpt.statsList[idx].Value[stat.Key], + stat.Key, + stMgrOpt.statsList[idx].ComponentName, + ) } case Replace: @@ -174,7 +185,11 @@ func statsPolling() { // See https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-connectnamedpipe err = windows.ConnectNamedPipe(handle, nil) if err != nil { - log.Err("stats_manager::statsPolling : unable to connect to named pipe %s: [%v]", common.PollingPipe, err) + log.Err( + "stats_manager::statsPolling : unable to connect to named pipe %s: [%v]", + common.PollingPipe, + err, + ) return } log.Info("StatsReader::statsReader : Connected polling pipe") @@ -203,13 +218,20 @@ func statsPolling() { windows.Close(tPipe) if err == windows.ERROR_FILE_NOT_FOUND { - log.Info("stats_manager::statsPolling : Named pipe %s not found, retrying...", common.TransferPipe) + log.Info( + "stats_manager::statsPolling : Named pipe %s not found, retrying...", + common.TransferPipe, + ) time.Sleep(1 * time.Second) } else if err == windows.ERROR_PIPE_BUSY { log.Err("stats_manager::statsPolling: Pipe instances are busy, retrying...") time.Sleep(1 * time.Second) } else { - log.Err("stats_manager::statsPolling: Unable to open pipe %s with error [%v]", common.TransferPipe, err) + log.Err( + "stats_manager::statsPolling: Unable to open pipe %s with error [%v]", + common.TransferPipe, + err, + ) return } } @@ -255,7 +277,10 @@ func statsPolling() { } if cmpSt.Timestamp == stMgrOpt.cmpTimeMap[cmpSt.ComponentName] { - log.Debug("stats_manager::statsPolling : Skipping as there is no change in stats collected for %v", cmpSt.ComponentName) + log.Debug( + "stats_manager::statsPolling : Skipping as there is no change in stats collected for %v", + cmpSt.ComponentName, + ) continue } diff --git a/internal/winservice/registry_windows.go b/internal/winservice/registry_windows.go index 71a7cb239..1bbe32ea5 100644 --- a/internal/winservice/registry_windows.go +++ b/internal/winservice/registry_windows.go @@ -117,7 +117,11 @@ func AddRegistryValue(keyName string, valueName string, value string) error { } func RemoveRegistryValue(keyName string, valueName string) error { - key, err := registry.OpenKey(registry.LOCAL_MACHINE, keyName, registry.SET_VALUE|registry.QUERY_VALUE) + key, err := registry.OpenKey( + registry.LOCAL_MACHINE, + keyName, + registry.SET_VALUE|registry.QUERY_VALUE, + ) if err != nil { return err } diff --git a/internal/winservice/service_windows.go b/internal/winservice/service_windows.go index 54407613e..38e11e61f 100644 --- a/internal/winservice/service_windows.go +++ b/internal/winservice/service_windows.go @@ -81,7 +81,18 @@ func StartMount(mountPath string, configFile string, passphrase *memguard.Enclav ) defer buff.Destroy() } else { - _, err = winFspCommand(writeCommandToUtf16(startCmd, SvcName, instanceName, mountPath, configFile, fmt.Sprint(userId), fmt.Sprint(groupId), "")) + _, err = winFspCommand( + writeCommandToUtf16( + startCmd, + SvcName, + instanceName, + mountPath, + configFile, + fmt.Sprint(userId), + fmt.Sprint(groupId), + "", + ), + ) } return err } diff --git a/tools/health-monitor/monitor/cloudfuse_stats/stats_reader_windows.go b/tools/health-monitor/monitor/cloudfuse_stats/stats_reader_windows.go index 73d511f3d..de2ca1983 100644 --- a/tools/health-monitor/monitor/cloudfuse_stats/stats_reader_windows.go +++ b/tools/health-monitor/monitor/cloudfuse_stats/stats_reader_windows.go @@ -64,11 +64,19 @@ func (cfs *CloudfuseStats) statsReader() error { // See https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-connectnamedpipe err = windows.ConnectNamedPipe(handle, nil) if err == windows.ERROR_PIPE_CONNECTED { - log.Err("StatsReader::statsReader : There is a process at other end of pipe %s: retrying... [%v]", cfs.transferPipe, err) + log.Err( + "StatsReader::statsReader : There is a process at other end of pipe %s: retrying... [%v]", + cfs.transferPipe, + err, + ) windows.Close(handle) time.Sleep(1 * time.Second) } else if err != nil { - log.Err("StatsReader::statsReader : unable to connect to named pipe %s: [%v]", cfs.transferPipe, err) + log.Err( + "StatsReader::statsReader : unable to connect to named pipe %s: [%v]", + cfs.transferPipe, + err, + ) windows.Close(handle) return err } @@ -148,13 +156,20 @@ func (cfs *CloudfuseStats) statsPoll() { windows.Close(hPipe) if err == windows.ERROR_FILE_NOT_FOUND { - log.Err("StatsReader::statsReader : Named pipe %s not found, retrying...", cfs.pollingPipe) + log.Err( + "StatsReader::statsReader : Named pipe %s not found, retrying...", + cfs.pollingPipe, + ) time.Sleep(1 * time.Second) } else if err == windows.ERROR_PIPE_BUSY { log.Err("StatsReader::statsReader : Pipe instances are busy, retrying...") time.Sleep(1 * time.Second) } else { - log.Err("StatsReader::statsReader : Unable to open pipe %s with error [%v]", cfs.pollingPipe, err) + log.Err( + "StatsReader::statsReader : Unable to open pipe %s with error [%v]", + cfs.pollingPipe, + err, + ) return } } @@ -169,7 +184,10 @@ func (cfs *CloudfuseStats) statsPoll() { for t := range ticker.C { _, err = writer.WriteString(fmt.Sprintf("Poll at %v", t.Format(time.RFC3339))) - log.Debug("stats_manager::statsDumper : writing to polling pipe file: %s", fmt.Sprintf("Poll at %v", t.Format(time.RFC3339))) + log.Debug( + "stats_manager::statsDumper : writing to polling pipe file: %s", + fmt.Sprintf("Poll at %v", t.Format(time.RFC3339)), + ) if err != nil { log.Err("StatsReader::statsPoll : [%v]", err) break diff --git a/tools/windows-service/main.go b/tools/windows-service/main.go index ad925a258..9b9ee30e3 100644 --- a/tools/windows-service/main.go +++ b/tools/windows-service/main.go @@ -49,7 +49,11 @@ var networkTargets = []string{"seagate.com:80", "google.com:80", "8.8.8.8:53", " type Cloudfuse struct{} -func (m *Cloudfuse) Execute(_ []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (ssec bool, errno uint32) { +func (m *Cloudfuse) Execute( + _ []string, + r <-chan svc.ChangeRequest, + changes chan<- svc.Status, +) (ssec bool, errno uint32) { // Notify the Service Control Manager that the service is starting changes <- svc.Status{State: svc.StartPending} log.Trace("Starting %s service", SvcName) @@ -105,7 +109,12 @@ func (m *Cloudfuse) Execute(_ []string, r <-chan svc.ChangeRequest, changes chan } } -func waitForNetwork(ctx context.Context, targets []string, interval time.Duration, timeout time.Duration) error { +func waitForNetwork( + ctx context.Context, + targets []string, + interval time.Duration, + timeout time.Duration, +) error { ticker := time.NewTicker(interval) defer ticker.Stop() @@ -128,7 +137,10 @@ func waitForNetwork(ctx context.Context, targets []string, interval time.Duratio func main() { isService, err := svc.IsWindowsService() if err != nil || !isService { - log.Err("Unable to determine if running as Windows service or not running as Windows service: %v", err.Error()) + log.Err( + "Unable to determine if running as Windows service or not running as Windows service: %v", + err.Error(), + ) return } From 1e178979460ff14540402562f79955d56c91b6cb Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Thu, 5 Feb 2026 09:24:21 -0700 Subject: [PATCH 6/8] Try rc3 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 1b60f262f..38cf8f54c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/Seagate/cloudfuse -go 1.26rc2 +go 1.26rc3 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 From 96466a8c6a994f9a36cd0629f8cd74401bed48ac Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Tue, 10 Feb 2026 13:13:29 -0700 Subject: [PATCH 7/8] Update to go 1.26 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 38cf8f54c..d385c5efe 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/Seagate/cloudfuse -go 1.26rc3 +go 1.26.0 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 From 22d38c07a55bd3eb0d164b02e1fadb074900cfac Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Tue, 10 Feb 2026 13:32:53 -0700 Subject: [PATCH 8/8] Update CI-CD to go 1.26 --- .github/workflows/code-coverage.yml | 6 +++--- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/fuzz-test.yml | 2 +- .github/workflows/publish-release.yml | 4 ++-- .github/workflows/unit-test.yml | 6 +++--- .github/zizmor.yml | 3 +++ .pre-commit-config.yaml | 6 +++--- scripts/go_installer.sh | 2 +- 8 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 2fb9c54a1..4320dc5f0 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -17,7 +17,7 @@ jobs: name: Build and Test with Code Coverage strategy: matrix: - go: ["1.25"] + go: ["1.26"] job_name: ["linux-fuse3", "linux-fuse2"] include: @@ -1058,7 +1058,7 @@ jobs: name: Build and Test with Code Coverage on Windows strategy: matrix: - go: ["1.25"] + go: ["1.26"] job_name: ["windows"] include: @@ -1983,7 +1983,7 @@ jobs: name: Cleanup Test Accounts strategy: matrix: - go: ["1.25"] + go: ["1.26"] job_name: ["linux"] include: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e912a57c3..0591d0836 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -59,7 +59,7 @@ jobs: if: matrix.language == 'go' uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 with: - go-version: "1.25" + go-version: "1.26" check-latest: true - name: Cache Go build cache diff --git a/.github/workflows/fuzz-test.yml b/.github/workflows/fuzz-test.yml index d18ed6b41..d5403f579 100644 --- a/.github/workflows/fuzz-test.yml +++ b/.github/workflows/fuzz-test.yml @@ -29,7 +29,7 @@ jobs: timeout-minutes: 30 env: - go: "1.25" + go: "1.26" steps: - name: Checkout code diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index c673dfdd1..5a87b1291 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -16,7 +16,7 @@ jobs: name: Create Windows Installer runs-on: windows-latest env: - go: "1.25" + go: "1.26" cgo: "0" winfsp: winfsp-2.1.25156.msi steps: @@ -109,7 +109,7 @@ jobs: needs: create-installer runs-on: ubuntu-latest env: - go: "1.25" + go: "1.26" zig: 0.15.2 permissions: contents: write # Needed to create releases diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 010a6d5d2..e40cbff3c 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -60,7 +60,7 @@ jobs: env: cgo: "1" - go: "1.25" + go: "1.26" zig: 0.15.2 containerName: "test-cnt-ubn" @@ -232,7 +232,7 @@ jobs: runs-on: ${{ matrix.os }} timeout-minutes: 15 env: - go: "1.25" + go: "1.26" cgo: "0" containerName: "test-cnt-win" @@ -267,7 +267,7 @@ jobs: name: Lint runs-on: ubuntu-latest env: - go: "1.25" + go: "1.26" steps: - name: Checkout code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/.github/zizmor.yml b/.github/zizmor.yml index 9eaa7babf..8ba3ebea4 100644 --- a/.github/zizmor.yml +++ b/.github/zizmor.yml @@ -3,3 +3,6 @@ rules: ignore: - unit-test.yml:47 - unit-test.yml:55 + template-injection: + ignore: + - publish-release.yml:97 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2cbf2d0c5..b07af89ac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-docstring-first - id: check-executables-have-shebangs @@ -16,11 +16,11 @@ repos: args: [--markdown-linebreak-ext=md] - repo: https://github.com/rhysd/actionlint - rev: v1.7.7 + rev: v1.7.10 hooks: - id: actionlint - repo: https://github.com/woodruffw/zizmor-pre-commit - rev: v1.5.2 + rev: v1.22.0 hooks: - id: zizmor diff --git a/scripts/go_installer.sh b/scripts/go_installer.sh index 6f778342d..26c5de13a 100755 --- a/scripts/go_installer.sh +++ b/scripts/go_installer.sh @@ -1,6 +1,6 @@ #!/bin/bash work_dir="${1%/}" -version="1.24.4" +version="1.26.0" arch=$(hostnamectl | grep "Arch" | rev | cut -d " " -f 1 | rev) if [ "$arch" != "arm64" ]