Skip to content

Commit f4628c3

Browse files
Alexey Boykoketchoop
Alexey Boyko
authored andcommitted
Fix linter issues
1 parent ccc5f3d commit f4628c3

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

.golangci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ linters:
3535
disable:
3636
- maligned
3737
- prealloc
38+
- wsl
39+
- gocognit

cmd/flora/flora.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ var (
1818
VersionBuildDate = "Unknown" //nolint:gochecknoglobals
1919
)
2020

21-
func main() { //nolint:gocyclo
21+
//nolint:gocyclo,funlen
22+
func main() {
2223
app := cli.NewApp()
2324
app.Name = "flora"
2425
app.Usage = "Simple app to upgrade your terraform"
@@ -144,7 +145,6 @@ func main() { //nolint:gocyclo
144145
Name: "current",
145146
Usage: "Show currently used version of terraform",
146147
Action: func(c *cli.Context) error {
147-
148148
homeDir, _ := homedir.Dir()
149149
floraPath := path.Join(homeDir, ".flora")
150150

unzip.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@ import (
1111
)
1212

1313
func unzip(src, dest string) ([]string, error) {
14-
1514
var filenames []string
1615

1716
r, err := zip.OpenReader(src)
17+
1818
if err != nil {
1919
return filenames, err
2020
}
21+
2122
defer r.Close()
2223

2324
for _, f := range r.File {
24-
2525
rc, err := f.Open()
26+
2627
if err != nil {
2728
return filenames, err
2829
}
30+
2931
defer rc.Close()
3032

3133
// Store filename/path for returning and using later on
@@ -37,9 +39,7 @@ func unzip(src, dest string) ([]string, error) {
3739
if err = os.MkdirAll(fpath, os.ModePerm); err != nil {
3840
return nil, err
3941
}
40-
4142
} else {
42-
4343
// Make File
4444
var fdir string
4545
if lastIndex := strings.LastIndex(fpath, string(os.PathSeparator)); lastIndex > -1 {
@@ -61,8 +61,8 @@ func unzip(src, dest string) ([]string, error) {
6161
if err != nil {
6262
return filenames, err
6363
}
64-
6564
}
6665
}
66+
6767
return filenames, nil
6868
}

versions.go

+2
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ func ListRemoteVersions() ([]*version.Version, error) {
100100
versions = make([]*version.Version, len(versionsWrapper.Versions))
101101

102102
i := 0
103+
103104
for ver := range versionsWrapper.Versions {
104105
versions[i], _ = version.NewVersion(ver)
105106
i++
@@ -158,6 +159,7 @@ func getVersionMatchingConstraint(constraintString string, versions []*version.V
158159
func GetLatestVersionMatchingConstraint(versionConstraint string) string {
159160
versions, _ := ListRemoteVersions()
160161
tfVersion := getVersionMatchingConstraint(versionConstraint, versions)
162+
161163
if tfVersion == nil {
162164
return ""
163165
}

0 commit comments

Comments
 (0)