shared/cliconfig: 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:24 -04:00 committed by Stéphane Graber
parent 0bef06dc6a
commit ed5778e5ef
No known key found for this signature in database
GPG Key ID: C638974D64792D67
3 changed files with 7 additions and 7 deletions

View File

@ -1,8 +1,8 @@
package cliconfig
import (
"fmt"
"errors"
)
// ErrNotLinux is returned when attempting to access the "local" remote on non-Linux systems.
var ErrNotLinux = fmt.Errorf("Can't connect to a local server on a non-Linux system")
var ErrNotLinux = errors.New("Can't connect to a local server on a non-Linux system")

View File

@ -3,11 +3,11 @@
package cliconfig
import (
"fmt"
"errors"
incus "github.com/lxc/incus/v6/client"
)
func (c *Config) handleKeepAlive(remote Remote, name string, args *incus.ConnectionArgs) (incus.InstanceServer, error) {
return nil, fmt.Errorf("Keepalive isn't supported on Windows")
return nil, errors.New("Keepalive isn't supported on Windows")
}

View File

@ -70,7 +70,7 @@ func (c *Config) GetInstanceServer(name string) (incus.InstanceServer, error) {
// Quick checks.
if remote.Public || remote.Protocol != "incus" {
return nil, fmt.Errorf("The remote isn't a private server")
return nil, errors.New("The remote isn't a private server")
}
// Get connection arguments
@ -115,7 +115,7 @@ func (c *Config) GetInstanceServer(name string) (incus.InstanceServer, error) {
// HTTPs
if !slices.Contains([]string{api.AuthenticationMethodOIDC}, remote.AuthType) && (args.TLSClientCert == "" || args.TLSClientKey == "") {
return nil, fmt.Errorf("Missing TLS client certificate and key")
return nil, errors.New("Missing TLS client certificate and key")
}
var d incus.InstanceServer
@ -347,7 +347,7 @@ func (c *Config) getConnectionArgs(name string) (*incus.ConnectionArgs, error) {
isSSH := pemKey.Type == "OPENSSH PRIVATE KEY"
if isEncrypted || isSSH {
if c.PromptPassword == nil {
return nil, fmt.Errorf("Private key is password protected and no helper was configured")
return nil, errors.New("Private key is password protected and no helper was configured")
}
password, err := c.PromptPassword(pathClientKey)