summaryrefslogtreecommitdiff
path: root/internal/configfile
diff options
context:
space:
mode:
authorJakob Unterwurzacher2025-07-07 19:54:48 +0200
committerJakob Unterwurzacher2025-07-07 19:59:35 +0200
commit8f5df19b353e02ffba842fd1b15ccf93da7ee3b4 (patch)
tree8f68b74e56a1d20af82e5093a059d180c925f9be /internal/configfile
parentcdb80ea9825d2e876f1cf579bf960e4da7656b4c (diff)
Fix a bunch of staticcheck errors
Tool-assisted.
Diffstat (limited to 'internal/configfile')
-rw-r--r--internal/configfile/config_file.go5
-rw-r--r--internal/configfile/scrypt.go10
-rw-r--r--internal/configfile/validate.go6
3 files changed, 10 insertions, 11 deletions
diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go
index 995a0c8..28a1ca5 100644
--- a/internal/configfile/config_file.go
+++ b/internal/configfile/config_file.go
@@ -5,7 +5,6 @@ package configfile
import (
"encoding/json"
"fmt"
- "io/ioutil"
"syscall"
"os"
@@ -183,12 +182,12 @@ func Load(filename string) (*ConfFile, error) {
cf.filename = filename
// Read from disk
- js, err := ioutil.ReadFile(filename)
+ js, err := os.ReadFile(filename)
if err != nil {
return nil, err
}
if len(js) == 0 {
- return nil, fmt.Errorf("Config file is empty")
+ return nil, fmt.Errorf("config file is empty")
}
// Unmarshal
diff --git a/internal/configfile/scrypt.go b/internal/configfile/scrypt.go
index 0ce8777..f6201ba 100644
--- a/internal/configfile/scrypt.go
+++ b/internal/configfile/scrypt.go
@@ -87,19 +87,19 @@ func (s *ScryptKDF) LogN() int {
func (s *ScryptKDF) validateParams() error {
minN := 1 << scryptMinLogN
if s.N < minN {
- return fmt.Errorf("Fatal: scryptn below 10 is too low to make sense")
+ return fmt.Errorf("fatal: scryptn below 10 is too low to make sense")
}
if s.R < scryptMinR {
- return fmt.Errorf("Fatal: scrypt parameter R below minimum: value=%d, min=%d", s.R, scryptMinR)
+ return fmt.Errorf("fatal: scrypt parameter R below minimum: value=%d, min=%d", s.R, scryptMinR)
}
if s.P < scryptMinP {
- return fmt.Errorf("Fatal: scrypt parameter P below minimum: value=%d, min=%d", s.P, scryptMinP)
+ return fmt.Errorf("fatal: scrypt parameter P below minimum: value=%d, min=%d", s.P, scryptMinP)
}
if len(s.Salt) < scryptMinSaltLen {
- return fmt.Errorf("Fatal: scrypt salt length below minimum: value=%d, min=%d", len(s.Salt), scryptMinSaltLen)
+ return fmt.Errorf("fatal: scrypt salt length below minimum: value=%d, min=%d", len(s.Salt), scryptMinSaltLen)
}
if s.KeyLen < cryptocore.KeyLen {
- return fmt.Errorf("Fatal: scrypt parameter KeyLen below minimum: value=%d, min=%d", s.KeyLen, cryptocore.KeyLen)
+ return fmt.Errorf("fatal: scrypt parameter KeyLen below minimum: value=%d, min=%d", s.KeyLen, cryptocore.KeyLen)
}
return nil
}
diff --git a/internal/configfile/validate.go b/internal/configfile/validate.go
index ab8917d..5428a7b 100644
--- a/internal/configfile/validate.go
+++ b/internal/configfile/validate.go
@@ -9,7 +9,7 @@ import (
// Validate that the combination of settings makes sense and is supported
func (cf *ConfFile) Validate() error {
if cf.Version != contentenc.CurrentVersion {
- return fmt.Errorf("Unsupported on-disk format %d", cf.Version)
+ return fmt.Errorf("unsupported on-disk format %d", cf.Version)
}
// scrypt params ok?
if err := cf.ScryptObject.validateParams(); err != nil {
@@ -18,13 +18,13 @@ func (cf *ConfFile) Validate() error {
// All feature flags that are in the config file are known?
for _, flag := range cf.FeatureFlags {
if !isFeatureFlagKnown(flag) {
- return fmt.Errorf("Unknown feature flag %q", flag)
+ return fmt.Errorf("unknown feature flag %q", flag)
}
}
// File content encryption
{
if cf.IsFeatureFlagSet(FlagXChaCha20Poly1305) && cf.IsFeatureFlagSet(FlagAESSIV) {
- return fmt.Errorf("Can't have both XChaCha20Poly1305 and AESSIV feature flags")
+ return fmt.Errorf("can't have both XChaCha20Poly1305 and AESSIV feature flags")
}
if cf.IsFeatureFlagSet(FlagAESSIV) && !cf.IsFeatureFlagSet(FlagGCMIV128) {