mirror of
https://github.com/tweag/gomod2nix.git
synced 2024-11-10 04:21:33 +00:00
Fix fetching repositories with repo root relative tags
This commit is contained in:
parent
85684cb652
commit
634635dc70
1 changed files with 16 additions and 1 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type packageJob struct {
|
type packageJob struct {
|
||||||
|
@ -138,7 +139,21 @@ func fetchPackage(importPath string, goPackagePath string, rev string) (*types.P
|
||||||
"--url", repoRoot.Repo,
|
"--url", repoRoot.Repo,
|
||||||
"--rev", rev).Output()
|
"--rev", rev).Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
// It's a relatively common idiom to tag storage/v1.0.0
|
||||||
|
newRev := fmt.Sprintf("%s/%s", strings.TrimPrefix(goPackagePath, repoRoot.Root+"/"), rev)
|
||||||
|
originalErr := err
|
||||||
|
|
||||||
|
stdout, err = exec.Command(
|
||||||
|
"nix-prefetch-git",
|
||||||
|
"--quiet",
|
||||||
|
"--fetch-submodules",
|
||||||
|
"--url", repoRoot.Repo,
|
||||||
|
"--rev", newRev).Output()
|
||||||
|
if err != nil {
|
||||||
|
return nil, originalErr
|
||||||
|
}
|
||||||
|
|
||||||
|
rev = newRev
|
||||||
}
|
}
|
||||||
|
|
||||||
var output *prefetchOutput
|
var output *prefetchOutput
|
||||||
|
|
Loading…
Reference in a new issue