Skip to content

Commit

Permalink
Fix golint issues + add golint & gocyclo to golangci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hbollon committed Feb 6, 2021
1 parent b55f6f9 commit f3ecd77
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ linters:
enable:
- dupl
- exportloopref
- gocyclo
- godox
- gofmt
- goimports
- golint
- govet
- misspell
- prealloc
Expand Down
8 changes: 4 additions & 4 deletions actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ func (bot *IGopher) sendMessageWebDriver(user, message string) (bool, error) {
return false, errors.New("Error during user searching")
}
randomSleep()
if usernames, err := bot.SeleniumStruct.WebDriver.FindElements(selenium.ByXPATH, "//div[@aria-labelledby]/div/span//img[@data-testid='user-avatar']"); err != nil {
usernames, err := bot.SeleniumStruct.WebDriver.FindElements(selenium.ByXPATH, "//div[@aria-labelledby]/div/span//img[@data-testid='user-avatar']")
if err != nil {
return false, errors.New("Error during user selection")
} else {
usernames[0].Click()
log.Debug("User to dm selected")
}
usernames[0].Click()
log.Debug("User to dm selected")
} else {
return false, errors.New("Error during user selection")
}
Expand Down
8 changes: 4 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,19 @@ func CheckConfigValidity() error {
config := ImportConfig()
validate := validator.New()
if err := validate.Struct(config.Account); err != nil {
return errors.New("Invalid credentials format! Please check your settings.\n\n")
return errors.New("Invalid credentials format! Please check your settings")
}
if err := validate.Struct(config.SrcUsers); err != nil {
return errors.New("Invalid scrapper configuration! Please check your settings.\n\n")
return errors.New("Invalid scrapper configuration! Please check your settings")
}
if err := validate.Struct(config.AutoDm); err != nil {
return errors.New("Invalid autodm module configuration! Please check your settings.\n\n")
return errors.New("Invalid autodm module configuration! Please check your settings")
}

return nil
}

// Read config yml file and initialize it for use with bot
// ReadBotConfigYaml read config yml file and initialize it for use with bot
func ReadBotConfigYaml() IGopher {
var c IGopher
file, err := ioutil.ReadFile(filepath.FromSlash("./config/config.yaml"))
Expand Down
4 changes: 1 addition & 3 deletions internal/tui/homePage.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ func (m model) UpdateHomePage(msg tea.Msg) (model, tea.Cmd) {
if err == nil {
execBot = true
return m, tea.Quit
} else {
errorMessage = err.Error()
break
}
errorMessage = err.Error() + "\n\n"
case 1:
config = igopher.ImportConfig()
m.screen = settingsMenu
Expand Down

0 comments on commit f3ecd77

Please sign in to comment.