Skip to content

Commit

Permalink
resolved golangci-lint warnings and issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillip Miller committed Nov 29, 2021
1 parent 1e5a5ce commit 30f9ef3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,8 @@ linters-settings:
checks: ["all", "-S1028"]
staticcheck:
checks: ["all"]
gosec:
# To specify a set of rules to explicitly exclude.
# Available rules: https://github.com/securego/gosec#available-rules
excludes:
- G306
12 changes: 4 additions & 8 deletions localio/localio.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
func GitClone(url, directory string) error {
Info("git clone %s %s", url, directory)
_, err := git.PlainClone(directory, false, &git.CloneOptions{
URL: url,
URL: url,
Progress: os.Stdout,
})
CheckIfError(err)
Expand Down Expand Up @@ -406,10 +406,7 @@ func Contains(s []string, str string) bool {
// CorrectOS ... Useful for go tests
func CorrectOS(osType string) bool {
operatingSystem := runtime.GOOS
if operatingSystem == osType {
return true
}
return false
return operatingSystem == osType
}

// BrewInstallProgram ...
Expand Down Expand Up @@ -487,9 +484,8 @@ func NewAptInstalled() (*AptInstalled, error) {
if err != nil {
return nil, err
}
for _, name := range installedList {
ai.Name = append(ai.Name, name)
}

ai.Name = append(ai.Name, installedList...)

return ai, nil
}
Expand Down
4 changes: 2 additions & 2 deletions osrelease/osrelease.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ func parseLine(line string) (key string, value string, err error) {

// Handle double quotes
if strings.ContainsAny(value, `"`) {
first := string(value[0:1])
last := string(value[len(value)-1:])
first := value[0:1]
last := value[len(value)-1:]

if first == last && strings.ContainsAny(first, `"'`) {
value = strings.TrimPrefix(value, `'`)
Expand Down
2 changes: 1 addition & 1 deletion tmux/tmux.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func InstallOhMyTmux(osType string, dirs *localio.Directories, packages *localio
}
}

if exists, err := localio.Exists(fmt.Sprintf("%s/.tmux.conf.local", dirs.HomeDir)); err == nil && exists == true {
if exists, err := localio.Exists(fmt.Sprintf("%s/.tmux.conf.local", dirs.HomeDir)); err == nil && exists {
return nil
}

Expand Down

0 comments on commit 30f9ef3

Please sign in to comment.