vendor: containerd/go-runc 7016d3ce2328dd2cb1192b2076ebd565c4e8df0c

full diff: a5c2862aed...7016d3ce23

- add go.mod
- Parse runc version even if commit is missing

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-05-11 23:13:39 +02:00
parent d9d1d5b624
commit f09e999099
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
3 changed files with 25 additions and 25 deletions

View File

@ -6,7 +6,7 @@ github.com/containerd/cgroups b4448137398923af7f4918b8b2ad
github.com/containerd/console v1.0.0
github.com/containerd/continuity d3ef23f19fbb106bb73ffde425d07a9187e30745
github.com/containerd/fifo f15a3290365b9d2627d189e619ab4008e0069caf
github.com/containerd/go-runc a5c2862aed5e6358b305b0e16bfce58e0549b1cd
github.com/containerd/go-runc 7016d3ce2328dd2cb1192b2076ebd565c4e8df0c
github.com/containerd/ttrpc v1.0.1
github.com/containerd/typeurl v1.0.1
github.com/coreos/go-systemd/v22 v22.0.0

10
vendor/github.com/containerd/go-runc/go.mod generated vendored Normal file
View File

@ -0,0 +1,10 @@
module github.com/containerd/go-runc
go 1.13
require (
github.com/containerd/console v0.0.0-20191206165004-02ecf6a7291e
github.com/opencontainers/runtime-spec v1.0.1
github.com/pkg/errors v0.8.1
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449
)

View File

@ -623,32 +623,22 @@ func (r *Runc) Version(context context.Context) (Version, error) {
func parseVersion(data []byte) (Version, error) {
var v Version
parts := strings.Split(strings.TrimSpace(string(data)), "\n")
if len(parts) != 3 {
if len(parts) > 0 {
if !strings.HasPrefix(parts[0], "runc version ") {
return v, nil
}
for i, p := range []struct {
dest *string
split string
}{
{
dest: &v.Runc,
split: "version ",
},
{
dest: &v.Commit,
split: ": ",
},
{
dest: &v.Spec,
split: ": ",
},
} {
p2 := strings.Split(parts[i], p.split)
if len(p2) != 2 {
return v, fmt.Errorf("unable to parse version line %q", parts[i])
v.Runc = parts[0][13:]
for _, part := range parts[1:] {
if strings.HasPrefix(part, "commit: ") {
v.Commit = part[8:]
} else if strings.HasPrefix(part, "spec: ") {
v.Spec = part[6:]
}
*p.dest = p2[1]
}
}
return v, nil
}