1
0
mirror of https://github.com/lxc/incus.git synced 2026-02-05 09:46:19 +01:00

shared/archive: Don't needlessly use format string functions

Signed-off-by: Nathan Chase <ntc477@utexas.edu>
This commit is contained in:
Nathan Chase
2025-05-23 01:30:47 -04:00
committed by Stéphane Graber
parent f1880c830e
commit 72b3baf3f7
2 changed files with 5 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ import (
"archive/tar"
"bytes"
"context"
"errors"
"fmt"
"io"
"os"
@@ -267,10 +268,10 @@ func Unpack(file string, path string, blockBackend bool, maxMemory int64, tracke
// Check if we're running out of space
if int64(fs.Bfree) < 10 {
if blockBackend {
return fmt.Errorf("Unable to unpack image, run out of disk space (consider increasing your pool's volume.size)")
return errors.New("Unable to unpack image, run out of disk space (consider increasing your pool's volume.size)")
}
return fmt.Errorf("Unable to unpack image, run out of disk space")
return errors.New("Unable to unpack image, run out of disk space")
}
logger.Warn("Unpack failed", logger.Ctx{"file": file, "allowedCmds": allowedCmds, "extension": extension, "path": path, "err": err})

View File

@@ -2,7 +2,7 @@ package archive
import (
"bytes"
"fmt"
"errors"
"io"
"os"
)
@@ -60,6 +60,6 @@ func DetectCompressionFile(f io.Reader) ([]string, string, []string, error) {
case bytes.Equal(header[0:4], []byte{0x04, 0x22, 0x4d, 0x18}):
return []string{"-Ilz4", "-xf"}, ".tar.lz4", []string{"lz4", "-d"}, nil
default:
return nil, "", nil, fmt.Errorf("Unsupported compression")
return nil, "", nil, errors.New("Unsupported compression")
}
}