Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support github.com/coreos/go-systemd/v22 #87

Merged
merged 1 commit into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions godl/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"sync"

"github.com/LK4D4/vndr/godl/singleflight"
"github.com/LK4D4/vndr/versioned"
)

// envForDir returns a copy of the environment
Expand Down Expand Up @@ -512,6 +513,9 @@ func repoRootFromVCSPaths(importPath, scheme string, security securityMode, vcsP
repo: match["repo"],
root: match["root"],
}
if versioned.IsVersioned(importPath) {
rr.root = importPath
}
return rr, nil
}
return nil, errUnknownSite
Expand Down Expand Up @@ -581,6 +585,9 @@ func repoRootForImportDynamic(importPath string, security securityMode) (*repoRo
if rr.vcs == nil {
return nil, fmt.Errorf("%s: unknown vcs %q", urlStr, mmi.VCS)
}
if versioned.IsVersioned(importPath) {
rr.root = importPath
}
return rr, nil
}

Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/LK4D4/vndr/build"
"github.com/LK4D4/vndr/godl"
"github.com/LK4D4/vndr/versioned"
)

const (
Expand Down Expand Up @@ -155,7 +156,7 @@ func validateDeps(deps []depEntry) error {
rootDeps := roots[r]
if len(rootDeps) == 1 {
d := rootDeps[0]
if d.importPath != r {
if d.importPath != r && !versioned.IsVersioned(d.importPath) {
Warnf("package %s is not root import, should be %s", d.importPath, r)
invalid = true
newDeps = append(newDeps, depEntry{importPath: r, rev: d.rev, repoPath: d.repoPath})
Expand Down
12 changes: 12 additions & 0 deletions versioned/versioned.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package versioned

import (
"regexp"
)

var re = regexp.MustCompile(`/v[0-9]+$`)

// IsVersioned true for string like "github.com/coreos/go-systemd/v22"
func IsVersioned(s string) bool {
return re.MatchString(s)
}