feat(multiple): Add version command, improve dependencies file managment
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
@ -242,7 +243,7 @@ func (g Golang) PostInstall(path string) error {
|
||||
log.Debug("Adding env variable to .bashrc")
|
||||
|
||||
fh, err := os.OpenFile(
|
||||
fmt.Sprintf("%s.bashrc", homeDir),
|
||||
filepath.Join(homeDir, ".bashrc"),
|
||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY,
|
||||
0644,
|
||||
)
|
||||
@ -263,7 +264,7 @@ func (g Golang) PostInstall(path string) error {
|
||||
|
||||
log.Debug("creating gopath directory")
|
||||
|
||||
err = helpers.CheckAndCreateDir(fmt.Sprintf("%sgo", homeDir))
|
||||
err = helpers.CheckAndCreateDir(filepath.Join(homeDir, "go"))
|
||||
if err != nil {
|
||||
return errors.Trace(err)
|
||||
}
|
||||
@ -289,7 +290,7 @@ func (g Golang) GetInstallDirectory() (string, error) {
|
||||
|
||||
// concat default install dir with home and we have our path
|
||||
if !isInstalled {
|
||||
return fmt.Sprintf("%s%s", homeDir, defaultGolangInstallDir), nil
|
||||
return filepath.Join(homeDir, defaultGolangInstallDir), nil
|
||||
}
|
||||
|
||||
// now let's play and find the current install path
|
||||
@ -308,7 +309,7 @@ func (g Golang) GetInstallDirectory() (string, error) {
|
||||
cleanOut := strings.TrimSpace(string(stdout))
|
||||
|
||||
if !strings.Contains(cleanOut, homeDir) {
|
||||
return fmt.Sprintf("%s%s", homeDir, defaultGolangInstallDir), nil
|
||||
return filepath.Join(homeDir, defaultGolangInstallDir), nil
|
||||
}
|
||||
|
||||
return cleanOut, nil
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
@ -163,7 +164,7 @@ func (s Swagger) Install(path string) error {
|
||||
}
|
||||
|
||||
fh, err := os.OpenFile(
|
||||
fmt.Sprintf("%s/swagger", path),
|
||||
filepath.Join(path, "swagger"),
|
||||
os.O_RDWR|os.O_CREATE|os.O_TRUNC,
|
||||
0744,
|
||||
)
|
||||
@ -226,7 +227,7 @@ func (s Swagger) PostInstall(path string) error {
|
||||
log.Debug("Adding env variable to .bashrc")
|
||||
|
||||
fh, err := os.OpenFile(
|
||||
fmt.Sprintf("%s.bashrc", homeDir),
|
||||
filepath.Join(homeDir, ".bashrc"),
|
||||
os.O_APPEND|os.O_CREATE|os.O_WRONLY,
|
||||
0644,
|
||||
)
|
||||
@ -263,7 +264,7 @@ func (s Swagger) GetInstallDirectory() (string, error) {
|
||||
|
||||
// concat default install dir with home and we have our path
|
||||
if !isInstalled {
|
||||
return fmt.Sprintf("%s%s", homeDir, defaultSwaggerInstallDir), nil
|
||||
return filepath.Join(homeDir, defaultSwaggerInstallDir), nil
|
||||
}
|
||||
|
||||
// now let's play and find the current install path
|
||||
|
Reference in New Issue
Block a user