-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clone and build dlv instead of go install
Signed-off-by: Dan Luhring <[email protected]>
- Loading branch information
Showing
3 changed files
with
56 additions
and
14 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,25 @@ | ||
package git | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"os/exec" | ||
) | ||
|
||
// Clone the git repository from the repoURL to the specified dir. | ||
func Clone(ctx context.Context, dir string, repoURL string) error { | ||
rc := runConfig{ | ||
dir: dir, | ||
args: []string{"clone", "--depth", "1", repoURL}, | ||
} | ||
|
||
cmd := exec.CommandContext(ctx, "git", "clone", repoURL, dir) | ||
cmd.Dir = dir | ||
|
||
_, err := run(ctx, rc) | ||
if err != nil { | ||
return fmt.Errorf("running git clone: %v", err) | ||
} | ||
|
||
return nil | ||
} |