-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- extracted defaultBin constant to an extra package as it is reused i…
…n main and lib. - added detection of home directory in case we are using windows. - updated tests accordingly.
- Loading branch information
1 parent
996f5b7
commit a6a9ae0
Showing
8 changed files
with
156 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package lib | ||
|
||
import ( | ||
"github.com/mitchellh/go-homedir" | ||
"log" | ||
"runtime" | ||
) | ||
|
||
// GetDefaultBin Get default binary path | ||
func GetDefaultBin() string { | ||
var defaultBin = "/usr/local/bin/terraform" | ||
if runtime.GOOS == "windows" { | ||
home, err := homedir.Dir() | ||
if err != nil { | ||
log.Fatalf(`Could not detect home directory.`) | ||
} | ||
defaultBin = home + `/bin/terraform.exe` | ||
} | ||
return defaultBin | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters