Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Boyko authored and ketchoop committed Nov 12, 2019
1 parent ccc5f3d commit f4628c3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ linters:
disable:
- maligned
- prealloc
- wsl
- gocognit
4 changes: 2 additions & 2 deletions cmd/flora/flora.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ var (
VersionBuildDate = "Unknown" //nolint:gochecknoglobals
)

func main() { //nolint:gocyclo
//nolint:gocyclo,funlen
func main() {
app := cli.NewApp()
app.Name = "flora"
app.Usage = "Simple app to upgrade your terraform"
Expand Down Expand Up @@ -144,7 +145,6 @@ func main() { //nolint:gocyclo
Name: "current",
Usage: "Show currently used version of terraform",
Action: func(c *cli.Context) error {

homeDir, _ := homedir.Dir()
floraPath := path.Join(homeDir, ".flora")

Expand Down
10 changes: 5 additions & 5 deletions unzip.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@ import (
)

func unzip(src, dest string) ([]string, error) {

var filenames []string

r, err := zip.OpenReader(src)

if err != nil {
return filenames, err
}

defer r.Close()

for _, f := range r.File {

rc, err := f.Open()

if err != nil {
return filenames, err
}

defer rc.Close()

// Store filename/path for returning and using later on
Expand All @@ -37,9 +39,7 @@ func unzip(src, dest string) ([]string, error) {
if err = os.MkdirAll(fpath, os.ModePerm); err != nil {
return nil, err
}

} else {

// Make File
var fdir string
if lastIndex := strings.LastIndex(fpath, string(os.PathSeparator)); lastIndex > -1 {
Expand All @@ -61,8 +61,8 @@ func unzip(src, dest string) ([]string, error) {
if err != nil {
return filenames, err
}

}
}

return filenames, nil
}
2 changes: 2 additions & 0 deletions versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func ListRemoteVersions() ([]*version.Version, error) {
versions = make([]*version.Version, len(versionsWrapper.Versions))

i := 0

for ver := range versionsWrapper.Versions {
versions[i], _ = version.NewVersion(ver)
i++
Expand Down Expand Up @@ -158,6 +159,7 @@ func getVersionMatchingConstraint(constraintString string, versions []*version.V
func GetLatestVersionMatchingConstraint(versionConstraint string) string {
versions, _ := ListRemoteVersions()
tfVersion := getVersionMatchingConstraint(versionConstraint, versions)

if tfVersion == nil {
return ""
}
Expand Down

0 comments on commit f4628c3

Please sign in to comment.