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:
		
							
								
								
									
										10
									
								
								vendor/github.com/containerd/go-runc/go.mod
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/containerd/go-runc/go.mod
									
									
									
										generated
									
									
										vendored
									
									
										Normal 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 | ||||
| ) | ||||
							
								
								
									
										38
									
								
								vendor/github.com/containerd/go-runc/runc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										38
									
								
								vendor/github.com/containerd/go-runc/runc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -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 { | ||||
| 		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]) | ||||
|  | ||||
| 	if len(parts) > 0 { | ||||
| 		if !strings.HasPrefix(parts[0], "runc version ") { | ||||
| 			return v, nil | ||||
| 		} | ||||
| 		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 | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sebastiaan van Stijn
					Sebastiaan van Stijn