fix make vet failures, and enable make vet on CI

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2017-05-09 04:40:21 +00:00
parent 25a161bf5d
commit 837205005f
21 changed files with 58 additions and 76 deletions

22
cmd/dist/main.go vendored
View File

@@ -4,6 +4,7 @@ import (
contextpkg "context"
"fmt"
"os"
"time"
"github.com/Sirupsen/logrus"
"github.com/containerd/containerd"
@@ -11,7 +12,7 @@ import (
)
var (
background = contextpkg.Background()
timeout time.Duration
)
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() {
app := cli.NewApp()
app.Name = "dist"
@@ -70,17 +79,10 @@ distribution tool
rootfsCommand,
}
app.Before = func(context *cli.Context) error {
var (
debug = context.GlobalBool("debug")
timeout = context.GlobalDuration("timeout")
)
if debug {
timeout = context.GlobalDuration("timeout")
if context.GlobalBool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
if timeout > 0 {
background, _ = contextpkg.WithTimeout(background, timeout)
}
return nil
}
if err := app.Run(os.Args); err != nil {