fix(lint): Continue to apply linter recommandation
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Matthieu 'JP' DERASSE
2022-08-03 11:17:15 +00:00
parent 101ca9a79c
commit 660a4ef162
35 changed files with 187 additions and 159 deletions

View File

@ -10,14 +10,13 @@ import (
"github.com/spf13/cobra"
)
// generateCmd represents the generate command
// generateCmd represents the generate command.
var generateCmd = &cobra.Command{
Use: "generate",
Short: "Generate all the files (API, DB, ...)",
Long: `Generate will automatically create all the files of the Project.
You can also generate files for each 'modules' by using the command bellows`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("generate called")
},
}

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)
// apiCmd represents the api command
// apiCmd represents the api command.
var apiCmd = &cobra.Command{
Use: "api",
Short: "Generate Go-Swagger Files and Controllers",

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)
// dbCmd represents the db command
// dbCmd represents the db command.
var dbCmd = &cobra.Command{
Use: "db",
Short: "Generate Database Struct from pkg/dbmodels/schema.yaml",

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)
// dockerCmd represents the docker command
// dockerCmd represents the docker command.
var dockerCmd = &cobra.Command{
Use: "docker",
Short: "Generate Dockerfile for API & Workers",

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)
// helmCmd represents the helm command
// helmCmd represents the helm command.
var helmCmd = &cobra.Command{
Use: "helm",
Short: "Generate Kubernetes Helm chart for API & Workers",

View File

@ -8,7 +8,7 @@ import (
"github.com/spf13/cobra"
)
// helpCmd represents the help command
// helpCmd represents the help command.
var helpCmd = &cobra.Command{
Use: "help",
Short: "Show that help",

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)
// launcherCmd represents the launcher command
// launcherCmd represents the launcher command.
var launcherCmd = &cobra.Command{
Use: "launcher",
Short: "Generate Launcher Bash script",

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)
// makefileCmd represents the makefile command
// makefileCmd represents the makefile command.
var makefileCmd = &cobra.Command{
Use: "makefile",
Short: "Generate Makefile",

View File

@ -19,7 +19,7 @@ import (
log "github.com/sirupsen/logrus"
)
// initCmd represents the init command
// initCmd represents the init command.
var initCmd = &cobra.Command{
Use: "init",
Short: "Initialize a new project",
@ -39,11 +39,10 @@ func init() {
// runInitAction
// Steps:
// 1 - Check that we have the dependencies
// 2 - Check that we are not in project directory
// 3 - Ask info to the user
// 1 - Check that we have the dependencies.
// 2 - Check that we are not in project directory.
// 3 - Ask info to the user.
func runInitAction(cmd *cobra.Command, args []string) {
log.Debugf("Starting command Init")
log.Debugf("Checking dependencies")
@ -90,7 +89,7 @@ func runInitAction(cmd *cobra.Command, args []string) {
}
// ask which API type we want to use
var possibleAPITypes []string
possibleAPITypes := make([]string, 0)
for _, apiType := range models.GetListOfAPITypeName() {
possibleAPITypes = append(possibleAPITypes, string(apiType))
}

View File

@ -13,7 +13,8 @@ import (
log "github.com/sirupsen/logrus"
)
var version = "0.0.1"
const version = "0.0.1"
var verbose = false
var acceptAll = false
var dependencyList = []dependencies.DependencyInterface{
@ -22,7 +23,7 @@ var dependencyList = []dependencies.DependencyInterface{
dependencies.Swagger{},
}
// rootCmd represents the base command when called without any subcommands
// rootCmd represents the base command when called without any subcommands.
var rootCmd = &cobra.Command{
Use: "boot",
Short: "Boot is a toolbox app to bootstrap quickly a Go-Swagger API",
@ -32,7 +33,7 @@ It will:
- Auto-Update
- Download dependencies (go-swagger, ...)
- Initialize an API with default middlewares
- Generate Models / Controlers
- Generate Models / Controllers
- Generate Database structs
- ....`,
@ -46,8 +47,7 @@ It will:
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
err := rootCmd.Execute()
if err != nil {
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}
@ -57,11 +57,9 @@ func init() {
rootCmd.PersistentFlags().BoolVarP(&acceptAll, "yes", "y", false, "accept all change, disable interactive process")
}
// checkDependencies
// checkDependencies will go through all the dependencies a check if they are installed and respect minimum version.
func checkDependencies() bool {
for _, dependency := range dependencyList {
isSupported, err := dependency.IsVersionSupported()
if err != nil {
log.Errorf("Fail to check %s version. The following error happen: %s", dependency.GetName(), err.Error())

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)
// testCmd represents the test command
// testCmd represents the test command.
var testCmd = &cobra.Command{
Use: "test",
Short: "Launch Test",

View File

@ -12,7 +12,7 @@ import (
log "github.com/sirupsen/logrus"
)
// upgradeCmd represents the upgrade command
// upgradeCmd represents the upgrade command.
var upgradeCmd = &cobra.Command{
Use: "upgrade",
Short: "Upgrade all development dependencies",
@ -29,11 +29,9 @@ func init() {
}
func runUpgradeAction(cmd *cobra.Command, args []string) {
log.Debug("Starting Upgrade command")
for _, dependency := range dependencyList {
log.Debugf("Checking if dependency %s is supported", dependency.GetName())
isSupported, err := dependency.IsVersionSupported()
@ -81,7 +79,6 @@ func runUpgradeAction(cmd *cobra.Command, args []string) {
log.Infof("Where do you want to install %s ?", dependency.GetName())
installDirectory = helpers.PathInput()
}
} else {
log.Infof("Installing %s in the following directory: %s", dependency.GetName(), installDirectory)
}
@ -91,7 +88,7 @@ func runUpgradeAction(cmd *cobra.Command, args []string) {
// check if the path is ok, else ask user for new path if we are in a interactive mode, else stop
_, err = helpers.CheckAndCreateDir(installDirectory)
if err != nil {
log.Errorf("Impossible to create the instalation directory for %s", dependency.GetName())
log.Errorf("Impossible to create the installation directory for %s", dependency.GetName())
if acceptAll {
return
}

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)
// versionCmd represents the version command
// versionCmd represents the version command.
var versionCmd = &cobra.Command{
Use: "version",
Short: "Show gouick version",