Fix non-constant format string errors with Go 1.24 (#1745)

Use `errors.New` instead of `fmt.Errorf` and `fmt.Fprint` instead of
`fmt.Fprintf` if a non-constant string is used

Signed-off-by: Michel Lind <salimma@fedoraproject.org>
This commit is contained in:
Michel Lind 2025-02-05 14:32:23 +01:00 committed by GitHub
parent 225072384a
commit bd2497a285
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View file

@ -5,6 +5,7 @@
package cst
import (
"errors"
"fmt"
"github.com/johnkerl/miller/v6/pkg/bifs"
@ -78,7 +79,7 @@ func (root *RootNode) BuildMultipleArityFunctionCallsiteNode(
return root.BuildTernaryFunctionCallsiteNode(astNode, builtinFunctionInfo)
}
return nil, fmt.Errorf(
return nil, errors.New(
"at CST BuildMultipleArityFunctionCallsiteNode: function name not found: " +
builtinFunctionInfo.name,
)

View file

@ -6,6 +6,7 @@
package cst
import (
"errors"
"fmt"
"os"
@ -62,7 +63,7 @@ func (root *RootNode) BuildAssignableNode(
return root.BuildEnvironmentVariableLvalueNode(astNode)
}
return nil, fmt.Errorf(
return nil, errors.New(
"at CST BuildAssignableNode: unhandled AST node " + string(astNode.Type),
)
}

View file

@ -7,6 +7,7 @@ package cst
import (
"container/list"
"errors"
"fmt"
"os"
"strings"
@ -163,7 +164,7 @@ func (root *RootNode) IngestAST(
err = nil
if ast.RootNode == nil {
return hadWarnings, fmt.Errorf("cannot build CST from nil AST root")
return hadWarnings, errors.New("cannot build CST from nil AST root")
}
// Check for things that are syntax errors but not done in the AST for
@ -417,7 +418,7 @@ func (root *RootNode) resolveSubroutineCallsites() error {
return err
}
if uds == nil {
return fmt.Errorf("mlr: subroutine name not found: " + subroutineName)
return errors.New("mlr: subroutine name not found: " + subroutineName)
}
unresolvedSubroutineCallsite.uds = uds