Skip to content

Commit

Permalink
🐛 Corrected bad installations if user doesn't input 2 dots in version
Browse files Browse the repository at this point in the history
The constraint with only one dot returns the first version in the list, the last published.
  • Loading branch information
afreyermuth98 committed Jun 15, 2022
1 parent 73ca476 commit 6c622c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/list_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func GetTFLatest(mirrorURL string) (string, error) {

//GetTFLatestImplicit : Get the latest implicit terraform version given the hashicorp url
func GetTFLatestImplicit(mirrorURL string, preRelease bool, version string) (string, error) {

if preRelease == true {
//TODO: use GetTFList() instead of GetTFURLBody
versions, error := GetTFURLBody(mirrorURL)
Expand All @@ -94,6 +93,9 @@ func GetTFLatestImplicit(mirrorURL string, preRelease bool, version string) (str
}
}
} else if preRelease == false {
if strings.Count(version, string(".")) == 1 {
version += ".0"
}
listAll := false
tflist, _ := GetTFList(mirrorURL, listAll) //get list of versions
version = fmt.Sprintf("~> %v", version)
Expand Down

0 comments on commit 6c622c5

Please sign in to comment.