runtime: Fix non constant Errorf formatting

As part of the go 1.24.6 bump there are errors about the incorrect
use of a errorf, so switch to the non-formatting version, or add
the format string as appropriate

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
stevenhorsman 2025-08-21 15:17:00 +01:00 committed by Fabiano Fidêncio
parent 381da9e603
commit 8cbb1a4357
4 changed files with 6 additions and 6 deletions

View File

@ -31,9 +31,9 @@ func toGRPC(err error) error {
err = errors.Cause(err)
switch {
case isInvalidArgument(err):
return status.Errorf(codes.InvalidArgument, err.Error())
return status.Error(codes.InvalidArgument, err.Error())
case isNotFound(err):
return status.Errorf(codes.NotFound, err.Error())
return status.Error(codes.NotFound, err.Error())
}
return err

View File

@ -178,7 +178,7 @@ func notImplemented(name string) error {
err := errors.Errorf("%s: not implemented", name)
hvLogger.Errorf(err.Error())
hvLogger.Error(err.Error())
if tracer, ok := err.(interface{ StackTrace() errors.StackTrace }); ok {
for _, f := range tracer.StackTrace() {

View File

@ -96,14 +96,14 @@ func (mounter *SafeMountFormater) SafeFormatWithFstype(source string, fstype str
if output, err := doSafeCommand(mkfsCmd, args...); err != nil {
detailedErr := fmt.Sprintf("format disk %q failed: type:(%q) errcode:(%v) output:(%v) ", source, fstype, err, string(output))
klog.Error(detailedErr)
return mountutils.NewMountError(mountutils.FormatFailed, detailedErr)
return mountutils.NewMountError(mountutils.FormatFailed, "%s", detailedErr)
}
klog.Infof("Disk successfully formatted (mkfs): %s - %s", fstype, source)
} else {
if fstype != existingFormat {
// Do verify the disk formatted with expected fs type.
return mountutils.NewMountError(mountutils.FilesystemMismatch, err.Error())
return mountutils.NewMountError(mountutils.FilesystemMismatch, "%s", err.Error())
}
if !readOnly {

View File

@ -202,7 +202,7 @@ func CreateDirectBlockDevice(volID, capacityInBytesStr, storagePath string) (*st
// create raw disk
if _, err = diskfs.Create(devicePath, capacityInBytes, diskfs.Raw, diskfs.SectorSizeDefault); err != nil {
errMsg := fmt.Errorf("diskfs create disk failed: %v", err)
klog.Errorf(errMsg.Error())
klog.Error(errMsg.Error())
return nil, errMsg
}