fixing lint and minor fix

This commit is contained in:
Prashant 2019-10-03 21:29:40 +05:30
parent 24c2dcc867
commit f9424d43e7
3 changed files with 27 additions and 30 deletions

View File

@ -54,23 +54,23 @@ func init() {
var RootCmd = &cobra.Command{
Use: "executor",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if cmd.Use == "executor" {
if err := util.ConfigureLogging(logLevel); err != nil {
return err
}
if !opts.NoPush && len(opts.Destinations) == 0 {
return errors.New("You must provide --destination, or use --no-push")
}
if err := cacheFlagsValid(); err != nil {
return errors.Wrap(err, "cache flags invalid")
}
if err := resolveSourceContext(); err != nil {
return errors.Wrap(err, "error resolving source context")
}
if err := resolveDockerfilePath(); err != nil {
return errors.Wrap(err, "error resolving dockerfile path")
}
}
if cmd.Use == "executor" {
if err := util.ConfigureLogging(logLevel); err != nil {
return err
}
if !opts.NoPush && len(opts.Destinations) == 0 {
return errors.New("You must provide --destination, or use --no-push")
}
if err := cacheFlagsValid(); err != nil {
return errors.Wrap(err, "cache flags invalid")
}
if err := resolveSourceContext(); err != nil {
return errors.Wrap(err, "error resolving source context")
}
if err := resolveDockerfilePath(); err != nil {
return errors.Wrap(err, "error resolving dockerfile path")
}
}
return nil
},
Run: func(cmd *cobra.Command, args []string) {

View File

@ -1,20 +1,20 @@
package cmd
import (
"fmt"
"fmt"
"github.com/spf13/cobra"
"github.com/GoogleContainerTools/kaniko/pkg/version"
"github.com/GoogleContainerTools/kaniko/pkg/version"
"github.com/spf13/cobra"
)
func init() {
RootCmd.AddCommand(versionCmd)
RootCmd.AddCommand(versionCmd)
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of kaniko",
Run: func(cmd *cobra.Command, args []string) {
fmt.Print("Kaniko version : ", version.Version())
},
}
Use: "version",
Short: "Print the version number of kaniko",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Kaniko version : ", version.Version())
},
}

View File

@ -359,9 +359,6 @@ func RelativeFiles(fp string, root string) ([]string, error) {
if CheckWhitelist(path) && !HasFilepathPrefix(path, root, false) {
return nil
}
if err != nil {
return err
}
relPath, err := filepath.Rel(root, path)
if err != nil {
return err