1
0
mirror of https://github.com/ko-build/ko.git synced 2024-12-12 08:54:09 +02:00

Resolving #21 issue. Adding git-dir flag to always execute inside ko's directory in GOPATH

This commit is contained in:
cezkuj 2019-05-17 05:53:06 +00:00
parent 0aca6f6de8
commit 672e478602

View File

@ -17,6 +17,7 @@ package commands
import (
"fmt"
"log"
"os"
"os/exec"
"strings"
@ -39,7 +40,8 @@ func addVersion(topLevel *cobra.Command) {
func version() {
if Version == "" {
hash, err := exec.Command("git", "rev-parse", "HEAD").Output()
gitDir := fmt.Sprintf("--git-dir=%v/src/github.com/google/ko/.git", os.Getenv("GOPATH"))
hash, err := exec.Command("git", gitDir, "rev-parse", "HEAD").Output()
if err != nil {
log.Fatalf("error during command execution: %v", err)
}