Skip to content

Commit

Permalink
Remove uneccesary lines in init
Browse files Browse the repository at this point in the history
  • Loading branch information
jukie committed Mar 24, 2023
1 parent b209461 commit 408dc99
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions lib/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,22 @@ var (
// initialize : removes existing symlink to terraform binary based on provided binPath
func initialize(binPath string) {

/* Step 1 */
/* initilize default binary path for terraform */
/* assumes that terraform is installed here */
/* we will find the terraform path instalation later and replace this variable with the correct installed bin path */
installedBinPath := binPath + "terraform"

/* find terraform binary location if terraform is already installed*/
cmd := NewCommand(installedBinPath)
cmd := NewCommand(binPath)
next := cmd.Find()

/* overrride installation default binary path if terraform is already installed */
/* find the last bin path */
for path := next(); len(path) > 0; path = next() {
installedBinPath = path
binPath = path
}

/* check if current symlink to terraform binary exist */
symlinkExist := CheckSymlink(installedBinPath)
symlinkExist := CheckSymlink(binPath)

/* remove current symlink if exist*/
if symlinkExist {
RemoveSymlink(installedBinPath)
RemoveSymlink(binPath)
}

}
Expand Down

0 comments on commit 408dc99

Please sign in to comment.