Skip to content

Commit

Permalink
more formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
warrensbox committed May 21, 2018
1 parent e61686e commit 5645b39
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package main
* Compatible with Mac OS X ONLY
*/

/*** WORKFLOW ***/
/*** OPERATION WORKFLOW ***/
/*
* 1- Create /usr/local/terraform directory if does not exist
* 2- Download zip file from url to /usr/local/terraform
Expand Down Expand Up @@ -41,6 +41,7 @@ const (
installVersion = "terraform_"
binLocation = "/usr/local/bin/terraform"
installPath = "/.terraform.versions/"
macOS = "_darwin_amd64.zip"
)

func main() {
Expand Down Expand Up @@ -135,10 +136,10 @@ func main() {

/* if selected version already exist, */
/* proceed to download it from the hashicorp release page */
url := hashiURL + version + "/terraform_" + version + "_darwin_amd64.zip"
url := hashiURL + version + "/" + installVersion + version + macOS
zipFile, _ := lib.DownloadFromURL(installLocation, url)

fmt.Printf("Downloaded zipFile: %q \n", zipFile)
fmt.Printf("Downloaded zipFile: %v \n", zipFile)

/* unzip the downloaded zipfile */
files, errUnzip := lib.Unzip(zipFile, installLocation)
Expand All @@ -148,13 +149,13 @@ func main() {
os.Exit(1)
}

fmt.Println("Unzipped:" + strings.Join(files, "\n"))
fmt.Println("Unzipped: " + strings.Join(files, "\n"))

/* rename unzipped file to terraform version name - terraform_x.x.x */
lib.RenameFile(installLocation+installFile, installLocation+installVersion+version)

/* remove zipped file to clear clutter */
lib.RemoveFiles(installLocation + installVersion + version + "_darwin_amd64.zip")
lib.RemoveFiles(installLocation + installVersion + version + macOS)

/* remove current symlink and set new symlink to desired version */
lib.RemoveSymlink(installedBinPath)
Expand Down

0 comments on commit 5645b39

Please sign in to comment.