Merge pull request #822 from AkihiroSuda/fix-vet
fix `make vet` failures, and enable `make vet` on CI
This commit is contained in:
		| @@ -31,6 +31,7 @@ script: | |||||||
|   - export CGO_ENABLED=$TRAVIS_CGO_ENABLED |   - export CGO_ENABLED=$TRAVIS_CGO_ENABLED | ||||||
|   - GIT_CHECK_EXCLUDE="./vendor" TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE/.../..}" make dco |   - GIT_CHECK_EXCLUDE="./vendor" TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE/.../..}" make dco | ||||||
|   - make fmt |   - make fmt | ||||||
|  |   - make vet | ||||||
|   - make binaries |   - make binaries | ||||||
|   - if [ "$GOOS" != "windows" ]; then make coverage ; fi |   - if [ "$GOOS" != "windows" ]; then make coverage ; fi | ||||||
|   - if [ "$GOOS" != "windows" ]; then sudo PATH=$PATH GOPATH=$GOPATH make root-coverage ; fi |   - if [ "$GOOS" != "windows" ]; then sudo PATH=$PATH GOPATH=$GOPATH make root-coverage ; fi | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							| @@ -79,7 +79,7 @@ checkprotos: protos ## check if protobufs needs to be generated again | |||||||
| # imports | # imports | ||||||
| vet: binaries ## run go vet | vet: binaries ## run go vet | ||||||
| 	@echo "$(WHALE) $@" | 	@echo "$(WHALE) $@" | ||||||
| 	@test -z "$$(go vet ${PACKAGES} 2>&1 | grep -v 'constant [0-9]* not a string in call to Errorf' | egrep -v '(timestamp_test.go|duration_test.go|exit status 1)' | tee /dev/stderr)" | 	@test -z "$$(go vet ${PACKAGES} 2>&1 | grep -v 'constant [0-9]* not a string in call to Errorf' | grep -v 'unrecognized printf verb 'r'' | egrep -v '(timestamp_test.go|duration_test.go|fetch.go|exit status 1)' | tee /dev/stderr)" | ||||||
|  |  | ||||||
| fmt: ## run go fmt | fmt: ## run go fmt | ||||||
| 	@echo "$(WHALE) $@" | 	@echo "$(WHALE) $@" | ||||||
|   | |||||||
| @@ -42,6 +42,5 @@ var eventsCommand = cli.Command{ | |||||||
| 				return err | 				return err | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		return nil |  | ||||||
| 	}, | 	}, | ||||||
| } | } | ||||||
|   | |||||||
| @@ -29,11 +29,11 @@ func newExecRequest(context *cli.Context, tmpDir, id string) (*execution.ExecReq | |||||||
| 			Value:   data, | 			Value:   data, | ||||||
| 		}, | 		}, | ||||||
| 		Terminal: context.Bool("tty"), | 		Terminal: context.Bool("tty"), | ||||||
| 		Stdin:    fmt.Sprintf(`%s\ctr-%s-stdin-`, pipeRoot, id, now), | 		Stdin:    fmt.Sprintf(`%s\ctr-%s-stdin-%d`, pipeRoot, id, now), | ||||||
| 		Stdout:   fmt.Sprintf(`%s\ctr-%s-stdout-`, pipeRoot, id, now), | 		Stdout:   fmt.Sprintf(`%s\ctr-%s-stdout-%d`, pipeRoot, id, now), | ||||||
| 	} | 	} | ||||||
| 	if !request.Terminal { | 	if !request.Terminal { | ||||||
| 		request.Stderr = fmt.Sprintf(`%s\ctr-%s-stderr-`, pipeRoot, id, now) | 		request.Stderr = fmt.Sprintf(`%s\ctr-%s-stderr-%d`, pipeRoot, id, now) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return request, nil | 	return request, nil | ||||||
|   | |||||||
| @@ -285,7 +285,6 @@ var shimEventsCommand = cli.Command{ | |||||||
| 			} | 			} | ||||||
| 			fmt.Printf("type=%s id=%s pid=%d status=%d\n", e.Type, e.ID, e.Pid, e.ExitStatus) | 			fmt.Printf("type=%s id=%s pid=%d status=%d\n", e.Type, e.ID, e.Pid, e.ExitStatus) | ||||||
| 		} | 		} | ||||||
| 		return nil |  | ||||||
| 	}, | 	}, | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								cmd/dist/apply.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								cmd/dist/apply.go
									
									
									
									
										vendored
									
									
								
							| @@ -1,7 +1,6 @@ | |||||||
| package main | package main | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	contextpkg "context" |  | ||||||
| 	"os" | 	"os" | ||||||
|  |  | ||||||
| 	"github.com/containerd/containerd/archive" | 	"github.com/containerd/containerd/archive" | ||||||
| @@ -17,9 +16,10 @@ var applyCommand = cli.Command{ | |||||||
| 	Flags:     []cli.Flag{}, | 	Flags:     []cli.Flag{}, | ||||||
| 	Action: func(context *cli.Context) error { | 	Action: func(context *cli.Context) error { | ||||||
| 		var ( | 		var ( | ||||||
| 			ctx = contextpkg.Background() |  | ||||||
| 			dir = context.Args().First() | 			dir = context.Args().First() | ||||||
| 		) | 		) | ||||||
|  | 		ctx, cancel := appContext() | ||||||
|  | 		defer cancel() | ||||||
|  |  | ||||||
| 		log.G(ctx).Info("applying layer from stdin") | 		log.G(ctx).Info("applying layer from stdin") | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								cmd/dist/delete.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								cmd/dist/delete.go
									
									
									
									
										vendored
									
									
								
							| @@ -22,10 +22,11 @@ var deleteCommand = cli.Command{ | |||||||
| 	Flags: []cli.Flag{}, | 	Flags: []cli.Flag{}, | ||||||
| 	Action: func(context *cli.Context) error { | 	Action: func(context *cli.Context) error { | ||||||
| 		var ( | 		var ( | ||||||
| 			ctx       = background |  | ||||||
| 			args      = []string(context.Args()) | 			args      = []string(context.Args()) | ||||||
| 			exitError error | 			exitError error | ||||||
| 		) | 		) | ||||||
|  | 		ctx, cancel := appContext() | ||||||
|  | 		defer cancel() | ||||||
|  |  | ||||||
| 		conn, err := connectGRPC(context) | 		conn, err := connectGRPC(context) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								cmd/dist/edit.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								cmd/dist/edit.go
									
									
									
									
										vendored
									
									
								
							| @@ -27,10 +27,11 @@ var editCommand = cli.Command{ | |||||||
| 	}, | 	}, | ||||||
| 	Action: func(context *cli.Context) error { | 	Action: func(context *cli.Context) error { | ||||||
| 		var ( | 		var ( | ||||||
| 			ctx      = background |  | ||||||
| 			validate = context.String("validate") | 			validate = context.String("validate") | ||||||
| 			object   = context.Args().First() | 			object   = context.Args().First() | ||||||
| 		) | 		) | ||||||
|  | 		ctx, cancel := appContext() | ||||||
|  | 		defer cancel() | ||||||
|  |  | ||||||
| 		if validate != "" { | 		if validate != "" { | ||||||
| 			return errors.New("validating the edit result not supported") | 			return errors.New("validating the edit result not supported") | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								cmd/dist/fetch.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								cmd/dist/fetch.go
									
									
									
									
										vendored
									
									
								
							| @@ -42,9 +42,10 @@ Most of this is experimental and there are few leaps to make this work.`, | |||||||
| 	Flags: registryFlags, | 	Flags: registryFlags, | ||||||
| 	Action: func(clicontext *cli.Context) error { | 	Action: func(clicontext *cli.Context) error { | ||||||
| 		var ( | 		var ( | ||||||
| 			ctx = background |  | ||||||
| 			ref = clicontext.Args().First() | 			ref = clicontext.Args().First() | ||||||
| 		) | 		) | ||||||
|  | 		ctx, cancel := appContext() | ||||||
|  | 		defer cancel() | ||||||
|  |  | ||||||
| 		conn, err := connectGRPC(clicontext) | 		conn, err := connectGRPC(clicontext) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| @@ -176,8 +177,6 @@ Most of this is experimental and there are few leaps to make this work.`, | |||||||
| 				done = true // allow ui to update once more | 				done = true // allow ui to update once more | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		return nil |  | ||||||
| 	}, | 	}, | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								cmd/dist/fetchobject.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								cmd/dist/fetchobject.go
									
									
									
									
										vendored
									
									
								
							| @@ -1,7 +1,6 @@ | |||||||
| package main | package main | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	contextpkg "context" |  | ||||||
| 	"io" | 	"io" | ||||||
| 	"os" | 	"os" | ||||||
|  |  | ||||||
| @@ -18,25 +17,13 @@ var fetchObjectCommand = cli.Command{ | |||||||
| 	Usage:       "retrieve objects from a remote", | 	Usage:       "retrieve objects from a remote", | ||||||
| 	ArgsUsage:   "[flags] <remote> <object> [<hint>, ...]", | 	ArgsUsage:   "[flags] <remote> <object> [<hint>, ...]", | ||||||
| 	Description: `Fetch objects by identifier from a remote.`, | 	Description: `Fetch objects by identifier from a remote.`, | ||||||
| 	Flags: append([]cli.Flag{ | 	Flags:       registryFlags, | ||||||
| 		cli.DurationFlag{ |  | ||||||
| 			Name:   "timeout", |  | ||||||
| 			Usage:  "total timeout for fetch", |  | ||||||
| 			EnvVar: "CONTAINERD_FETCH_TIMEOUT", |  | ||||||
| 		}, |  | ||||||
| 	}, registryFlags...), |  | ||||||
| 	Action: func(context *cli.Context) error { | 	Action: func(context *cli.Context) error { | ||||||
| 		var ( | 		var ( | ||||||
| 			ctx     = background |  | ||||||
| 			timeout = context.Duration("timeout") |  | ||||||
| 			ref = context.Args().First() | 			ref = context.Args().First() | ||||||
| 		) | 		) | ||||||
|  | 		ctx, cancel := appContext() | ||||||
| 		if timeout > 0 { |  | ||||||
| 			var cancel func() |  | ||||||
| 			ctx, cancel = contextpkg.WithTimeout(ctx, timeout) |  | ||||||
| 		defer cancel() | 		defer cancel() | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		resolver, err := getResolver(ctx, context) | 		resolver, err := getResolver(ctx, context) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								cmd/dist/get.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								cmd/dist/get.go
									
									
									
									
										vendored
									
									
								
							| @@ -17,9 +17,8 @@ var getCommand = cli.Command{ | |||||||
| 	Description: "Display the image object.", | 	Description: "Display the image object.", | ||||||
| 	Flags:       []cli.Flag{}, | 	Flags:       []cli.Flag{}, | ||||||
| 	Action: func(context *cli.Context) error { | 	Action: func(context *cli.Context) error { | ||||||
| 		var ( | 		ctx, cancel := appContext() | ||||||
| 			ctx = background | 		defer cancel() | ||||||
| 		) |  | ||||||
|  |  | ||||||
| 		dgst, err := digest.Parse(context.Args().First()) | 		dgst, err := digest.Parse(context.Args().First()) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								cmd/dist/images.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								cmd/dist/images.go
									
									
									
									
										vendored
									
									
								
							| @@ -21,9 +21,8 @@ var imagesListCommand = cli.Command{ | |||||||
| 	Description: `List images registered with containerd.`, | 	Description: `List images registered with containerd.`, | ||||||
| 	Flags:       []cli.Flag{}, | 	Flags:       []cli.Flag{}, | ||||||
| 	Action: func(clicontext *cli.Context) error { | 	Action: func(clicontext *cli.Context) error { | ||||||
| 		var ( | 		ctx, cancel := appContext() | ||||||
| 			ctx = background | 		defer cancel() | ||||||
| 		) |  | ||||||
|  |  | ||||||
| 		imageStore, err := resolveImageStore(clicontext) | 		imageStore, err := resolveImageStore(clicontext) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| @@ -66,9 +65,10 @@ var rmiCommand = cli.Command{ | |||||||
| 	Flags:       []cli.Flag{}, | 	Flags:       []cli.Flag{}, | ||||||
| 	Action: func(clicontext *cli.Context) error { | 	Action: func(clicontext *cli.Context) error { | ||||||
| 		var ( | 		var ( | ||||||
| 			ctx     = background |  | ||||||
| 			exitErr error | 			exitErr error | ||||||
| 		) | 		) | ||||||
|  | 		ctx, cancel := appContext() | ||||||
|  | 		defer cancel() | ||||||
|  |  | ||||||
| 		imageStore, err := resolveImageStore(clicontext) | 		imageStore, err := resolveImageStore(clicontext) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								cmd/dist/ingest.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								cmd/dist/ingest.go
									
									
									
									
										vendored
									
									
								
							| @@ -1,7 +1,6 @@ | |||||||
| package main | package main | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	contextpkg "context" |  | ||||||
| 	"os" | 	"os" | ||||||
|  |  | ||||||
| 	contentapi "github.com/containerd/containerd/api/services/content" | 	contentapi "github.com/containerd/containerd/api/services/content" | ||||||
| @@ -29,14 +28,12 @@ var ingestCommand = cli.Command{ | |||||||
| 	}, | 	}, | ||||||
| 	Action: func(context *cli.Context) error { | 	Action: func(context *cli.Context) error { | ||||||
| 		var ( | 		var ( | ||||||
| 			ctx            = background |  | ||||||
| 			cancel         func() |  | ||||||
| 			ref            = context.Args().First() | 			ref            = context.Args().First() | ||||||
| 			expectedSize   = context.Int64("expected-size") | 			expectedSize   = context.Int64("expected-size") | ||||||
| 			expectedDigest = digest.Digest(context.String("expected-digest")) | 			expectedDigest = digest.Digest(context.String("expected-digest")) | ||||||
| 		) | 		) | ||||||
|  |  | ||||||
| 		ctx, cancel = contextpkg.WithCancel(ctx) | 		ctx, cancel := appContext() | ||||||
| 		defer cancel() | 		defer cancel() | ||||||
|  |  | ||||||
| 		if err := expectedDigest.Validate(); expectedDigest != "" && err != nil { | 		if err := expectedDigest.Validate(); expectedDigest != "" && err != nil { | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								cmd/dist/list.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								cmd/dist/list.go
									
									
									
									
										vendored
									
									
								
							| @@ -1,7 +1,6 @@ | |||||||
| package main | package main | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	contextpkg "context" |  | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"os" | 	"os" | ||||||
| 	"text/tabwriter" | 	"text/tabwriter" | ||||||
| @@ -28,10 +27,11 @@ var listCommand = cli.Command{ | |||||||
| 	}, | 	}, | ||||||
| 	Action: func(context *cli.Context) error { | 	Action: func(context *cli.Context) error { | ||||||
| 		var ( | 		var ( | ||||||
| 			ctx   = contextpkg.Background() |  | ||||||
| 			quiet = context.Bool("quiet") | 			quiet = context.Bool("quiet") | ||||||
| 			args  = []string(context.Args()) | 			args  = []string(context.Args()) | ||||||
| 		) | 		) | ||||||
|  | 		ctx, cancel := appContext() | ||||||
|  | 		defer cancel() | ||||||
|  |  | ||||||
| 		cs, err := resolveContentStore(context) | 		cs, err := resolveContentStore(context) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
|   | |||||||
							
								
								
									
										20
									
								
								cmd/dist/main.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								cmd/dist/main.go
									
									
									
									
										vendored
									
									
								
							| @@ -4,6 +4,7 @@ import ( | |||||||
| 	contextpkg "context" | 	contextpkg "context" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"os" | 	"os" | ||||||
|  | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/Sirupsen/logrus" | 	"github.com/Sirupsen/logrus" | ||||||
| 	"github.com/containerd/containerd" | 	"github.com/containerd/containerd" | ||||||
| @@ -11,7 +12,7 @@ import ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| var ( | var ( | ||||||
| 	background = contextpkg.Background() | 	timeout time.Duration | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| @@ -21,6 +22,14 @@ func init() { | |||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func appContext() (contextpkg.Context, contextpkg.CancelFunc) { | ||||||
|  | 	background := contextpkg.Background() | ||||||
|  | 	if timeout > 0 { | ||||||
|  | 		return contextpkg.WithTimeout(background, timeout) | ||||||
|  | 	} | ||||||
|  | 	return contextpkg.WithCancel(background) | ||||||
|  | } | ||||||
|  |  | ||||||
| func main() { | func main() { | ||||||
| 	app := cli.NewApp() | 	app := cli.NewApp() | ||||||
| 	app.Name = "dist" | 	app.Name = "dist" | ||||||
| @@ -70,17 +79,10 @@ distribution tool | |||||||
| 		rootfsCommand, | 		rootfsCommand, | ||||||
| 	} | 	} | ||||||
| 	app.Before = func(context *cli.Context) error { | 	app.Before = func(context *cli.Context) error { | ||||||
| 		var ( |  | ||||||
| 			debug   = context.GlobalBool("debug") |  | ||||||
| 		timeout = context.GlobalDuration("timeout") | 		timeout = context.GlobalDuration("timeout") | ||||||
| 		) | 		if context.GlobalBool("debug") { | ||||||
| 		if debug { |  | ||||||
| 			logrus.SetLevel(logrus.DebugLevel) | 			logrus.SetLevel(logrus.DebugLevel) | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if timeout > 0 { |  | ||||||
| 			background, _ = contextpkg.WithTimeout(background, timeout) |  | ||||||
| 		} |  | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 	if err := app.Run(os.Args); err != nil { | 	if err := app.Run(os.Args); err != nil { | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								cmd/dist/pull.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								cmd/dist/pull.go
									
									
									
									
										vendored
									
									
								
							| @@ -38,10 +38,12 @@ command. As part of this process, we do the following: | |||||||
| 	Flags: registryFlags, | 	Flags: registryFlags, | ||||||
| 	Action: func(clicontext *cli.Context) error { | 	Action: func(clicontext *cli.Context) error { | ||||||
| 		var ( | 		var ( | ||||||
| 			ctx = background |  | ||||||
| 			ref = clicontext.Args().First() | 			ref = clicontext.Args().First() | ||||||
| 		) | 		) | ||||||
|  |  | ||||||
|  | 		ctx, cancel := appContext() | ||||||
|  | 		defer cancel() | ||||||
|  |  | ||||||
| 		conn, err := connectGRPC(clicontext) | 		conn, err := connectGRPC(clicontext) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return err | 			return err | ||||||
| @@ -104,8 +106,9 @@ command. As part of this process, we do the following: | |||||||
| 		}() | 		}() | ||||||
|  |  | ||||||
| 		defer func() { | 		defer func() { | ||||||
| 			ctx := background | 			// we need new ctx here | ||||||
|  | 			ctx, cancel := appContext() | ||||||
|  | 			defer cancel() | ||||||
| 			// TODO(stevvooe): This section unpacks the layers and resolves the | 			// TODO(stevvooe): This section unpacks the layers and resolves the | ||||||
| 			// root filesystem chainid for the image. For now, we just print | 			// root filesystem chainid for the image. For now, we just print | ||||||
| 			// it, but we should keep track of this in the metadata storage. | 			// it, but we should keep track of this in the metadata storage. | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								cmd/dist/rootfs.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								cmd/dist/rootfs.go
									
									
									
									
										vendored
									
									
								
							| @@ -34,9 +34,8 @@ var rootfsUnpackCommand = cli.Command{ | |||||||
| 	ArgsUsage: "[flags] <digest>", | 	ArgsUsage: "[flags] <digest>", | ||||||
| 	Flags:     []cli.Flag{}, | 	Flags:     []cli.Flag{}, | ||||||
| 	Action: func(clicontext *cli.Context) error { | 	Action: func(clicontext *cli.Context) error { | ||||||
| 		var ( | 		ctx, cancel := appContext() | ||||||
| 			ctx = background | 		defer cancel() | ||||||
| 		) |  | ||||||
|  |  | ||||||
| 		dgst, err := digest.Parse(clicontext.Args().First()) | 		dgst, err := digest.Parse(clicontext.Args().First()) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| @@ -74,9 +73,8 @@ var rootfsPrepareCommand = cli.Command{ | |||||||
| 	ArgsUsage: "[flags] <digest> <target>", | 	ArgsUsage: "[flags] <digest> <target>", | ||||||
| 	Flags:     []cli.Flag{}, | 	Flags:     []cli.Flag{}, | ||||||
| 	Action: func(clicontext *cli.Context) error { | 	Action: func(clicontext *cli.Context) error { | ||||||
| 		var ( | 		ctx, cancel := appContext() | ||||||
| 			ctx = background | 		defer cancel() | ||||||
| 		) |  | ||||||
|  |  | ||||||
| 		if clicontext.NArg() != 2 { | 		if clicontext.NArg() != 2 { | ||||||
| 			return cli.ShowSubcommandHelp(clicontext) | 			return cli.ShowSubcommandHelp(clicontext) | ||||||
|   | |||||||
| @@ -324,8 +324,6 @@ func (s *Service) Write(session api.Content_WriteServer) (err error) { | |||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return nil |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (s *Service) Status(*api.StatusRequest, api.Content_StatusServer) error { | func (s *Service) Status(*api.StatusRequest, api.Content_StatusServer) error { | ||||||
|   | |||||||
| @@ -363,8 +363,6 @@ func parents(bkt *bolt.Bucket, parent *db.Snapshot) (parents []string, err error | |||||||
| 		} | 		} | ||||||
| 		parent = &ps | 		parent = &ps | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func getSnapshot(bkt *bolt.Bucket, key string, ss *db.Snapshot) error { | func getSnapshot(bkt *bolt.Bucket, key string, ss *db.Snapshot) error { | ||||||
|   | |||||||
| @@ -80,7 +80,7 @@ func inReadTransaction(fn testFunc, pf populateFunc) testFunc { | |||||||
|  |  | ||||||
| 		ctx, tx, err := ms.TransactionContext(ctx, false) | 		ctx, tx, err := ms.TransactionContext(ctx, false) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			t.Fatal("Failed start transaction: %+v", err) | 			t.Fatalf("Failed start transaction: %+v", err) | ||||||
| 		} | 		} | ||||||
| 		defer func() { | 		defer func() { | ||||||
| 			if err := tx.Rollback(); err != nil { | 			if err := tx.Rollback(); err != nil { | ||||||
| @@ -99,7 +99,7 @@ func inWriteTransaction(fn testFunc) testFunc { | |||||||
| 	return func(ctx context.Context, t *testing.T, ms *MetaStore) { | 	return func(ctx context.Context, t *testing.T, ms *MetaStore) { | ||||||
| 		ctx, tx, err := ms.TransactionContext(ctx, true) | 		ctx, tx, err := ms.TransactionContext(ctx, true) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			t.Fatal("Failed to start transaction: %+v", err) | 			t.Fatalf("Failed to start transaction: %+v", err) | ||||||
| 		} | 		} | ||||||
| 		defer func() { | 		defer func() { | ||||||
| 			if t.Failed() { | 			if t.Failed() { | ||||||
| @@ -108,7 +108,7 @@ func inWriteTransaction(fn testFunc) testFunc { | |||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				if err := tx.Commit(); err != nil { | 				if err := tx.Commit(); err != nil { | ||||||
| 					t.Fatal("Commit failed: %+v", err) | 					t.Fatalf("Commit failed: %+v", err) | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		}() | 		}() | ||||||
| @@ -311,7 +311,7 @@ func testGetActive(ctx context.Context, t *testing.T, ms *MetaStore) { | |||||||
| 		for key, expected := range activeMap { | 		for key, expected := range activeMap { | ||||||
| 			active, err := GetActive(ctx, key) | 			active, err := GetActive(ctx, key) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				t.Fatal("Failed to get active: %+v", err) | 				t.Fatalf("Failed to get active: %+v", err) | ||||||
| 			} | 			} | ||||||
| 			assert.Equal(t, expected, active) | 			assert.Equal(t, expected, active) | ||||||
| 		} | 		} | ||||||
| @@ -366,7 +366,7 @@ func testCreateActive(ctx context.Context, t *testing.T, ms *MetaStore) { | |||||||
| 		t.Fatal("Returned active identifiers must be unique") | 		t.Fatal("Returned active identifiers must be unique") | ||||||
| 	} | 	} | ||||||
| 	if len(a3.ParentIDs) != 1 { | 	if len(a3.ParentIDs) != 1 { | ||||||
| 		t.Fatal("Expected 1 parent, got %d", len(a3.ParentIDs)) | 		t.Fatalf("Expected 1 parent, got %d", len(a3.ParentIDs)) | ||||||
| 	} | 	} | ||||||
| 	if a3.ParentIDs[0] != commitID { | 	if a3.ParentIDs[0] != commitID { | ||||||
| 		t.Fatal("Expected active parent to be same as commit ID") | 		t.Fatal("Expected active parent to be same as commit ID") | ||||||
| @@ -383,7 +383,7 @@ func testCreateActive(ctx context.Context, t *testing.T, ms *MetaStore) { | |||||||
| 		t.Fatal("Returned active identifiers must be unique") | 		t.Fatal("Returned active identifiers must be unique") | ||||||
| 	} | 	} | ||||||
| 	if len(a3.ParentIDs) != 1 { | 	if len(a3.ParentIDs) != 1 { | ||||||
| 		t.Fatal("Expected 1 parent, got %d", len(a3.ParentIDs)) | 		t.Fatalf("Expected 1 parent, got %d", len(a3.ParentIDs)) | ||||||
| 	} | 	} | ||||||
| 	if a3.ParentIDs[0] != commitID { | 	if a3.ParentIDs[0] != commitID { | ||||||
| 		t.Fatal("Expected active parent to be same as commit ID") | 		t.Fatal("Expected active parent to be same as commit ID") | ||||||
| @@ -505,7 +505,7 @@ func testRemove(ctx context.Context, t *testing.T, ms *MetaStore) { | |||||||
| 		t.Fatal("Expected remove ID to match create ID") | 		t.Fatal("Expected remove ID to match create ID") | ||||||
| 	} | 	} | ||||||
| 	if k3 != snapshot.KindActive { | 	if k3 != snapshot.KindActive { | ||||||
| 		t.Fatal("Expected active kind, got %v", k3) | 		t.Fatalf("Expected active kind, got %v", k3) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	r2, k2, err := Remove(ctx, "active-2") | 	r2, k2, err := Remove(ctx, "active-2") | ||||||
| @@ -516,7 +516,7 @@ func testRemove(ctx context.Context, t *testing.T, ms *MetaStore) { | |||||||
| 		t.Fatal("Expected remove ID to match create ID") | 		t.Fatal("Expected remove ID to match create ID") | ||||||
| 	} | 	} | ||||||
| 	if k2 != snapshot.KindActive { | 	if k2 != snapshot.KindActive { | ||||||
| 		t.Fatal("Expected active kind, got %v", k2) | 		t.Fatalf("Expected active kind, got %v", k2) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	r1, k1, err := Remove(ctx, "committed-1") | 	r1, k1, err := Remove(ctx, "committed-1") | ||||||
| @@ -527,7 +527,7 @@ func testRemove(ctx context.Context, t *testing.T, ms *MetaStore) { | |||||||
| 		t.Fatal("Expected remove ID to match commit ID") | 		t.Fatal("Expected remove ID to match commit ID") | ||||||
| 	} | 	} | ||||||
| 	if k1 != snapshot.KindCommitted { | 	if k1 != snapshot.KindCommitted { | ||||||
| 		t.Fatal("Expected committed kind, got %v", k1) | 		t.Fatalf("Expected committed kind, got %v", k1) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ type Configuration struct { | |||||||
|  |  | ||||||
| 	Layers []string `json:"layers"` | 	Layers []string `json:"layers"` | ||||||
|  |  | ||||||
| 	TerminateDuration time.Duration `json:"terminateDuration",omitempty` | 	TerminateDuration time.Duration `json:"terminateDuration,omitempty"` | ||||||
|  |  | ||||||
| 	IgnoreFlushesDuringBoot bool `json:"ignoreFlushesDuringBoot,omitempty"` | 	IgnoreFlushesDuringBoot bool `json:"ignoreFlushesDuringBoot,omitempty"` | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stephen Day
					Stephen Day