From be970b33404a4367d9dbbffa7d5503934fda2654 Mon Sep 17 00:00:00 2001 From: RiceChuan Date: Thu, 12 Dec 2024 11:30:08 +0800 Subject: [PATCH] chore: use errors.New to replace fmt.Errorf with no parameters Signed-off-by: RiceChuan --- go/cmd/dolt/dolt.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/go/cmd/dolt/dolt.go b/go/cmd/dolt/dolt.go index 81a0d7460ea..28f209add5f 100644 --- a/go/cmd/dolt/dolt.go +++ b/go/cmd/dolt/dolt.go @@ -431,7 +431,7 @@ func runMain() int { case featureVersionFlag: var err error if len(args) == 0 { - err = fmt.Errorf("missing argument for the --feature-version flag") + err = errors.New("missing argument for the --feature-version flag") } else { if featureVersion, err := strconv.Atoi(args[1]); err == nil { doltdb.DoltFeatureVersion = doltdb.FeatureVersion(featureVersion) @@ -742,12 +742,12 @@ If you're interested in running this command against a remote host, hit us up on if noValidRepository && isValidRepositoryRequired { return func(ctx context.Context) (cli.Queryist, *sql.Context, func(), error) { - err := fmt.Errorf("The current directory is not a valid dolt repository.") + err := errors.New("The current directory is not a valid dolt repository.") if errors.Is(rootEnv.DBLoadError, nbs.ErrUnsupportedTableFileFormat) { // This is fairly targeted and specific to allow for better error messaging. We should consider // breaking this out into its own function if we add more conditions. - err = fmt.Errorf("The data in this database is in an unsupported format. Please upgrade to the latest version of Dolt.") + err = errors.New("The data in this database is in an unsupported format. Please upgrade to the latest version of Dolt.") } return nil, nil, nil, err @@ -894,7 +894,7 @@ func parseGlobalArgsAndSubCommandName(globalConfig config.ReadWriteConfig, args if err != nil { if err == config.ErrConfigParamNotFound { if hasProfile { - return nil, nil, "", fmt.Errorf("no profiles found") + return nil, nil, "", errors.New("no profiles found") } else { return apr, remaining, subcommandName, nil }