From a6aed157baa0c6cf004bd7c3a5d8998cf4df9880 Mon Sep 17 00:00:00 2001 From: edwardmack Date: Mon, 6 Feb 2023 18:53:52 -0500 Subject: [PATCH] address PR comments --- cmd/gossamer/toml_config.go | 7 +++---- lib/utils/utils.go | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cmd/gossamer/toml_config.go b/cmd/gossamer/toml_config.go index c7a2f9bb0b7..e8277044d6f 100644 --- a/cmd/gossamer/toml_config.go +++ b/cmd/gossamer/toml_config.go @@ -19,8 +19,7 @@ import ( func loadConfigFromResource(cfg *ctoml.Config, resourcePath string) error { file, err := internal.DefaultConfigTomlFiles.Open(resourcePath) if err != nil { - logger.Errorf("opening toml configuration file: %w", err) - return err + return fmt.Errorf("opening toml configuration file: %w", err) } return loadConfig(cfg, file) } @@ -40,7 +39,7 @@ func loadConfigFromFile(cfg *ctoml.Config, fp string) error { } // loadConfig loads the values from the toml configuration file into the provided configuration -func loadConfig(cfg *ctoml.Config, file fs.File) error { +func loadConfig(cfg *ctoml.Config, file fs.File) (err error) { var tomlSettings = toml.Config{ NormFieldName: func(rt reflect.Type, key string) string { return key @@ -57,7 +56,7 @@ func loadConfig(cfg *ctoml.Config, file fs.File) error { }, } - if err := tomlSettings.NewDecoder(file).Decode(cfg); err != nil { + if err = tomlSettings.NewDecoder(file).Decode(cfg); err != nil { logger.Errorf("failed to decode configuration: %s", err) return err } diff --git a/lib/utils/utils.go b/lib/utils/utils.go index 31fe2d838d0..625b1c1a46d 100644 --- a/lib/utils/utils.go +++ b/lib/utils/utils.go @@ -192,14 +192,13 @@ var ( ) // GetProjectRootPath finds the root of the project where directory `cmd` -// and subdirectories `gossamer, testcases` are -// and returns it as an absolute path. +// and subdirectory `gossamer` is and returns it as an absolute path. func GetProjectRootPath() (rootPath string, err error) { _, fullpath, _, _ := runtime.Caller(0) rootPath = path.Dir(fullpath) const directoryToFind = "cmd" - const subPathsToFind = "gossamer,testcases" + const subPathsToFind = "gossamer" subPaths := strings.Split(subPathsToFind, ",")