From 5d5815bc446b3b7abbfbe900d99e93aa7f21d4c6 Mon Sep 17 00:00:00 2001 From: Vic Shostak Date: Mon, 3 Jan 2022 16:07:03 +0300 Subject: [PATCH] Fix project problem (GoLand) --- .dockerignore | 2 ++ .gitignore | 4 ++++ .goreleaser.yml | 2 +- LICENSE | 2 +- cmd/create.go | 3 ++- cmd/deploy.go | 3 ++- cmd/root.go | 7 ++++--- go.mod | 2 +- go.sum | 4 ++-- pkg/cgapp/exec.go | 2 +- pkg/cgapp/files.go | 2 +- pkg/cgapp/files_test.go | 10 ++++++++-- pkg/cgapp/git.go | 2 +- pkg/cgapp/git_test.go | 5 ++++- pkg/cgapp/utils.go | 13 ++++++++----- pkg/registry/defaults.go | 2 +- 16 files changed, 43 insertions(+), 22 deletions(-) diff --git a/.dockerignore b/.dockerignore index d96f350..0dffef0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,4 +14,6 @@ LICENSE # Folders .git/ .github/ +.vscode/ +.idea/ tmp/ diff --git a/.gitignore b/.gitignore index 449fb7f..7b694c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ # macOS **/.DS_Store +# IDE +.vscode/ +.idea/ + # Dev builds **/build/ **/dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml index 20168ba..eb1dd9c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -33,7 +33,7 @@ brews: owner: create-go-app name: homebrew-cli - # Template for the url which is determined by the given Token (github or gitlab) + # Template for the url which is determined by the given Token (GitHub or gitlab) # Default for github is "https://github.com///releases/download/{{ .Tag }}/{{ .ArtifactName }}" url_template: "https://github.com/create-go-app/cli/releases/download/{{ .Tag }}/{{ .ArtifactName }}" diff --git a/LICENSE b/LICENSE index 2d85ab9..1f904db 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2021 Vic Shóstak and Create Go App Contributors + Copyright 2022 Vic Shóstak and Create Go App Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/cmd/create.go b/cmd/create.go index 837ea87..1b04603 100644 --- a/cmd/create.go +++ b/cmd/create.go @@ -10,9 +10,10 @@ import ( "time" "github.com/AlecAivazis/survey/v2" + "github.com/spf13/cobra" + "github.com/create-go-app/cli/v3/pkg/cgapp" "github.com/create-go-app/cli/v3/pkg/registry" - "github.com/spf13/cobra" ) func init() { diff --git a/cmd/deploy.go b/cmd/deploy.go index da3edac..c493fb9 100644 --- a/cmd/deploy.go +++ b/cmd/deploy.go @@ -8,9 +8,10 @@ import ( "fmt" "time" + "github.com/spf13/cobra" + "github.com/create-go-app/cli/v3/pkg/cgapp" "github.com/create-go-app/cli/v3/pkg/registry" - "github.com/spf13/cobra" ) func init() { diff --git a/cmd/root.go b/cmd/root.go index 1535bad..3a569f7 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -6,9 +6,10 @@ package cmd import ( "github.com/AlecAivazis/survey/v2" + "github.com/spf13/cobra" + "github.com/create-go-app/cli/v3/pkg/cgapp" "github.com/create-go-app/cli/v3/pkg/registry" - "github.com/spf13/cobra" ) var ( @@ -39,8 +40,8 @@ var rootCmd = &cobra.Command{ Long: ` A powerful CLI for the Create Go App project. -Create a new production-ready project with backend (Golang), -frontend (JavaScript, TypeScript) and deploy automation +Create a new production-ready project with backend (Golang), +frontend (JavaScript, TypeScript) and deploy automation (Ansible, Docker) by running one CLI command. -> Focus on writing code and thinking of business logic! diff --git a/go.mod b/go.mod index 0419115..49fe93e 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( require ( github.com/Microsoft/go-winio v0.5.1 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20211112122917-428f8eabeeb3 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20211221144345-a4f6767435ab // indirect github.com/acomagu/bufpipe v1.0.3 // indirect github.com/emirpasic/gods v1.12.0 // indirect github.com/go-git/gcfg v1.5.0 // indirect diff --git a/go.sum b/go.sum index 6dad73e..9e5cdaf 100644 --- a/go.sum +++ b/go.sum @@ -60,8 +60,8 @@ github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nB github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= -github.com/ProtonMail/go-crypto v0.0.0-20211112122917-428f8eabeeb3 h1:XcF0cTDJeiuZ5NU8w7WUDge0HRwwNRmxj/GGk6KSA6g= -github.com/ProtonMail/go-crypto v0.0.0-20211112122917-428f8eabeeb3/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= +github.com/ProtonMail/go-crypto v0.0.0-20211221144345-a4f6767435ab h1:5FiL/TCaiKCss/BLMIACDxxadYrx767l9kh0qYX+sLQ= +github.com/ProtonMail/go-crypto v0.0.0-20211221144345-a4f6767435ab/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= diff --git a/pkg/cgapp/exec.go b/pkg/cgapp/exec.go index f91b8f8..2b6fce8 100644 --- a/pkg/cgapp/exec.go +++ b/pkg/cgapp/exec.go @@ -15,7 +15,7 @@ import ( func ExecCommand(command string, options []string, silentMode bool) error { // Checking for nil. if command == "" || options == nil { - return fmt.Errorf("No command to execute!") + return fmt.Errorf("no command to execute") } // Create buffer for stderr. diff --git a/pkg/cgapp/files.go b/pkg/cgapp/files.go index daf39d5..6cbcdc6 100644 --- a/pkg/cgapp/files.go +++ b/pkg/cgapp/files.go @@ -14,7 +14,7 @@ import ( "text/template" ) -// EmbeddedFileSystems struct contains embedded file system fields. +// EmbeddedFileSystem struct contains embedded file system fields. type EmbeddedFileSystem struct { Name embed.FS RootFolder string diff --git a/pkg/cgapp/files_test.go b/pkg/cgapp/files_test.go index 62f8234..1de6ffb 100644 --- a/pkg/cgapp/files_test.go +++ b/pkg/cgapp/files_test.go @@ -53,7 +53,10 @@ func TestMakeFile(t *testing.T) { }) // Clean - os.RemoveAll("Makefile") + err := os.RemoveAll("Makefile") + if err != nil { + return + } } } @@ -99,7 +102,10 @@ func TestMakeFolder(t *testing.T) { }) // Clean - os.RemoveAll(tt.args.folderName) + err := os.RemoveAll(tt.args.folderName) + if err != nil { + return + } } } diff --git a/pkg/cgapp/git.go b/pkg/cgapp/git.go index 9db79d7..98ca951 100644 --- a/pkg/cgapp/git.go +++ b/pkg/cgapp/git.go @@ -16,7 +16,7 @@ import ( func GitClone(templateType, templateURL string) error { // Checking for nil. if templateType == "" || templateURL == "" { - return fmt.Errorf("Project template not found!") + return fmt.Errorf("project template not found") } // Get current directory. diff --git a/pkg/cgapp/git_test.go b/pkg/cgapp/git_test.go index 0192f5c..0513243 100644 --- a/pkg/cgapp/git_test.go +++ b/pkg/cgapp/git_test.go @@ -53,6 +53,9 @@ func TestGitClone(t *testing.T) { }) // Clean - os.RemoveAll("../../tmp") + err := os.RemoveAll("../../tmp") + if err != nil { + return + } } } diff --git a/pkg/cgapp/utils.go b/pkg/cgapp/utils.go index ba08284..3657eb9 100644 --- a/pkg/cgapp/utils.go +++ b/pkg/cgapp/utils.go @@ -33,7 +33,10 @@ func ShowMessage(level, text string, startWithNewLine, endWithNewLine bool) { message := fmt.Sprintf("%s %s %s %s", startLine, colorizeLevel(level), text, endLine) // Return output. - fmt.Fprintln(Stdout, message) + _, err := fmt.Fprintln(Stdout, message) + if err != nil { + return + } } // ShowError function for send error message to output. @@ -50,10 +53,10 @@ func CalculateDurationTime(startTimer time.Time) string { func colorizeLevel(level string) string { // Define variables. var ( - red string = "\033[0;31m" - green string = "\033[0;32m" - yellow string = "\033[1;33m" - noColor string = "\033[0m" + red = "\033[0;31m" + green = "\033[0;32m" + yellow = "\033[1;33m" + noColor = "\033[0m" color, icon string ) diff --git a/pkg/registry/defaults.go b/pkg/registry/defaults.go index 3aef658..1b02816 100644 --- a/pkg/registry/defaults.go +++ b/pkg/registry/defaults.go @@ -11,7 +11,7 @@ import ( ) // CLIVersion version of Create Go App CLI. -const CLIVersion string = "3.3.0" +const CLIVersion string = "3.3.1" // Variables struct for Ansible variables (inventory, hosts). type Variables struct {