argo-cd/test/fixture/path/hack_path.go
jannfis ae49b45249
chore: Upgrade Go module to v2 (#5931)
* chore: Upgrade Go module to v2

Signed-off-by: jannfis <jann@mistrust.net>

* Restore import order

Signed-off-by: jannfis <jann@mistrust.net>

* fix knowntypes_normalizer codegen error

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>

* fix codegen

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>

* fix Procfile

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>

Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
2021-04-01 20:44:18 +02:00

27 lines
574 B
Go

package path
import (
"fmt"
"os"
"path/filepath"
"github.com/argoproj/argo-cd/v2/util/errors"
)
type AddBinDirToPath struct {
originalPath string
}
func (h AddBinDirToPath) Close() {
_ = os.Setenv("PATH", h.originalPath)
}
// add the hack path which has the git-ask-pass.sh shell script
func NewBinDirToPath() AddBinDirToPath {
originalPath := os.Getenv("PATH")
binDir, err := filepath.Abs("../../hack")
errors.CheckError(err)
err = os.Setenv("PATH", fmt.Sprintf("%s:%s", originalPath, binDir))
errors.CheckError(err)
return AddBinDirToPath{originalPath}
}