Skip to content

Commit

Permalink
Cleaning lints
Browse files Browse the repository at this point in the history
  • Loading branch information
tjayrush committed Jan 31, 2025
1 parent 0a0027f commit 4ca21a9
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/action_init_general.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ var g3 = wizard.Question{
}
cfg.General.DataFolder = input
if !file.FolderExists(path) {
file.EstablishFolder(path)
_ = file.EstablishFolder(path)
return input, copy, validWarn(`"%s" was created`, path)
}
return input, copy, validOk(`the index will be stored at %s`, path)
Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewKhedraApp() *KhedraApp {
}

func (k *KhedraApp) Run() {
k.cli.Run(os.Args)
_ = k.cli.Run(os.Args)
}

func (k *KhedraApp) ConfigMaker() (types.Config, error) {
Expand Down
2 changes: 1 addition & 1 deletion app/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func initCli(k *KhedraApp) *cli.App {
showError := func(c *cli.Context, showHelp bool, err error) {
_, _ = c.App.Writer.Write([]byte("\n" + colors.Red + "Error: " + err.Error() + colors.Off + "\n\n"))
if showHelp {
cli.ShowAppHelp(c)
_ = cli.ShowAppHelp(c)
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,6 @@ func captureOutput(t *testing.T, f func()) string {
os.Stdout = old

var buf bytes.Buffer
io.Copy(&buf, r)
_, _ = io.Copy(&buf, r)
return buf.String()
}
8 changes: 4 additions & 4 deletions app/config_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func TestLoadFileConfig(t *testing.T) {
invalidFile := func() {
defer types.SetupTest([]string{})()
coreFile.StringToAsciiFile(types.GetConfigFn(), "invalid: [:::]")
_ = coreFile.StringToAsciiFile(types.GetConfigFn(), "invalid: [:::]")

_, err := loadFileConfig()
assert.Error(t, err)
Expand All @@ -31,7 +31,7 @@ func TestLoadFileConfig(t *testing.T) {
chain.RPCs = []string{"http://localhost:8545", "http://localhost:8546"}
cfg.Chains["mainnet"] = chain
bytes, _ := yamlv2.Marshal(cfg)
coreFile.StringToAsciiFile(types.GetConfigFn(), string(bytes))
_ = coreFile.StringToAsciiFile(types.GetConfigFn(), string(bytes))
// fmt.Println(string(bytes))

result, err := loadFileConfig()
Expand Down Expand Up @@ -134,8 +134,8 @@ func TestInitializeFolders(t *testing.T) {
},
}

os.MkdirAll(cfg.Logging.Folder, os.ModePerm)
os.MkdirAll(cfg.General.DataFolder, os.ModePerm)
_ = os.MkdirAll(cfg.Logging.Folder, os.ModePerm)
_ = os.MkdirAll(cfg.General.DataFolder, os.ModePerm)

err := initializeFolders(cfg)
assert.NoError(t, err)
Expand Down
10 changes: 5 additions & 5 deletions app/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestLoadConfig_ValidConfig(t *testing.T) {
}

bytes, _ := yamlv2.Marshal(cfg)
coreFile.StringToAsciiFile(types.GetConfigFn(), string(bytes))
_ = coreFile.StringToAsciiFile(types.GetConfigFn(), string(bytes))

result, err := LoadConfig()
assert.NoError(t, err, t.Name())
Expand All @@ -55,7 +55,7 @@ func TestLoadConfig_ValidConfig(t *testing.T) {
func TestLoadConfig_InvalidFileConfig(t *testing.T) {
defer types.SetupTest([]string{})()

os.WriteFile(types.GetConfigFn(), []byte("invalid_yaml"), 0644)
_ = os.WriteFile(types.GetConfigFn(), []byte("invalid_yaml"), 0644)

_, err := LoadConfig()
assert.Error(t, err, t.Name())
Expand Down Expand Up @@ -103,7 +103,7 @@ func TestLoadConfig_EnvOverrides(t *testing.T) {
}

bytes, _ := yamlv2.Marshal(cfg)
coreFile.StringToAsciiFile(types.GetConfigFn(), string(bytes))
_ = coreFile.StringToAsciiFile(types.GetConfigFn(), string(bytes))

result, err := LoadConfig()
assert.NoError(t, err, t.Name())
Expand Down Expand Up @@ -148,7 +148,7 @@ func TestLoadConfig_ValidationFailure(t *testing.T) {
}

bytes, _ := yamlv2.Marshal(cfg)
coreFile.StringToAsciiFile(types.GetConfigFn(), string(bytes))
_ = coreFile.StringToAsciiFile(types.GetConfigFn(), string(bytes))

_, err := LoadConfig()
assert.Error(t, err, t.Name())
Expand Down Expand Up @@ -264,7 +264,7 @@ func TestChainLargeNumberOfChains(t *testing.T) {
}

bytes, _ := yamlv2.Marshal(cfg)
coreFile.StringToAsciiFile(types.GetConfigFn(), string(bytes))
_ = coreFile.StringToAsciiFile(types.GetConfigFn(), string(bytes))

var err error
if cfg, err = LoadConfig(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/config_descriptors.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type Explorer struct {

func UpdateChainList() (*ChainList, error) {
configPath := utils.ResolvePath("~/.khedra")
file.EstablishFolder(configPath)
_ = file.EstablishFolder(configPath)
chainUrl := "https://chainid.network/chains.json"
chainsFn := filepath.Join(configPath, "chains.json")
if bytes, err := utils.DownloadAndStore(chainUrl, chainsFn, 24*time.Hour); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestConfigEstablish(t *testing.T) {

cfg := NewConfig()
bytes, _ := yamlv2.Marshal(cfg)
coreFile.StringToAsciiFile(configFile, string(bytes))
_ = coreFile.StringToAsciiFile(configFile, string(bytes))

assert.FileExists(t, configFile)
os.Remove(configFile)
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,5 @@ func init() {
return validate.Passed(fv, "valid", serviceName)
}

validate.RegisterValidator("service_field", serviceFieldValidator)
_ = validate.RegisterValidator("service_field", serviceFieldValidator)
}
2 changes: 1 addition & 1 deletion pkg/types/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func SetupTest(env []string) func() {
tempConfigFile := GetConfigFn()
cfg := NewConfig()
bytes, _ := yamlv2.Marshal(cfg)
coreFile.StringToAsciiFile(tempConfigFile, string(bytes))
_ = coreFile.StringToAsciiFile(tempConfigFile, string(bytes))
return func() {
envCleanup()
os.Remove(tempConfigFile)
Expand Down
4 changes: 2 additions & 2 deletions pkg/wizard/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ func displayScreen(w *Wizard, screenIndex int) error {
i--
case errors.Is(err, ErrUserEdit):
configPath := types.GetConfigFn()
curScreen.EditFile(configPath)
_ = curScreen.EditFile(configPath)
if err := curScreen.Reload(configPath); err != nil {
return err
}
i--
case errors.Is(err, ErrUserChains):
chainsPath := strings.ReplaceAll(types.GetConfigFn(), "config.yaml", "chains.json")
curScreen.EditFile(chainsPath)
_ = curScreen.EditFile(chainsPath)
i--
case errors.Is(err, ErrUserBack):
if i == 0 {
Expand Down

0 comments on commit 4ca21a9

Please sign in to comment.