From a79bffb12dedaf99fd0041367b02b9f8a42a5e50 Mon Sep 17 00:00:00 2001 From: Vic Shostak Date: Fri, 22 Oct 2021 12:44:13 +0300 Subject: [PATCH] Fix Homebrew warning; Fix go-critic issues --- Makefile | 4 ++-- README.md | 2 +- go.mod | 4 ++-- go.sum | 8 ++++---- pkg/cgapp/files.go | 5 ++--- pkg/cgapp/files_test.go | 6 +++--- pkg/registry/defaults.go | 2 +- 7 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 88e05bb..8049a44 100644 --- a/Makefile +++ b/Makefile @@ -4,13 +4,13 @@ clean: rm -rf ./tmp coverage.out lint: - golangci-lint run + golangci-lint run ./... security: gosec -quiet ./... critic: - gocritic check ./... + gocritic check -enableAll ./... test: clean lint security critic go test -coverprofile=coverage.out ./... diff --git a/README.md b/README.md index aee9799..660e275 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

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! The CLI will take care of the rest.

-

cli version go version go cover go report license

+

cli version go version go cover go report license

## ⚡️ Quick start diff --git a/go.mod b/go.mod index 3d811c2..a21f670 100644 --- a/go.mod +++ b/go.mod @@ -28,8 +28,8 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/xanzy/ssh-agent v0.3.1 // indirect golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect - golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect - golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 // indirect + golang.org/x/net v0.0.0-20211020060615-d418f374d309 // indirect + golang.org/x/sys v0.0.0-20211020174200-9d6173849985 // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index c408648..a44e147 100644 --- a/go.sum +++ b/go.sum @@ -402,8 +402,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211020060615-d418f374d309 h1:A0lJIi+hcTR6aajJH4YqKWwohY4aW9RO7oRMcdv+HKI= +golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -479,8 +479,8 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 h1:KzbpndAYEM+4oHRp9JmB2ewj0NHHxO3Z0g7Gus2O1kk= -golang.org/x/sys v0.0.0-20211015200801-69063c4bb744/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211020174200-9d6173849985 h1:LOlKVhfDyahgmqa97awczplwkjzNaELFg3zRIJ13RYo= +golang.org/x/sys v0.0.0-20211020174200-9d6173849985/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= diff --git a/pkg/cgapp/files.go b/pkg/cgapp/files.go index ab07bd4..daf39d5 100644 --- a/pkg/cgapp/files.go +++ b/pkg/cgapp/files.go @@ -8,7 +8,6 @@ import ( "embed" "fmt" "io/fs" - "io/ioutil" "os" "path/filepath" "strings" @@ -100,7 +99,7 @@ func GenerateFileFromTemplate(fileName string, variables map[string]interface{}) // MakeFile function for single file create. func MakeFile(fileName string, fileData []byte) error { // Write to created file. - if err := ioutil.WriteFile(fileName, fileData, 0600); err != nil { + if err := os.WriteFile(fileName, fileData, 0o600); err != nil { return err } @@ -110,7 +109,7 @@ func MakeFile(fileName string, fileData []byte) error { // MakeFolder function for create folder. func MakeFolder(folderName string) error { // Check if folder exists, fail if it does. - if err := os.Mkdir(folderName, 0750); err != nil { + if err := os.Mkdir(folderName, 0o750); err != nil { return err } diff --git a/pkg/cgapp/files_test.go b/pkg/cgapp/files_test.go index 97cb3bb..62f8234 100644 --- a/pkg/cgapp/files_test.go +++ b/pkg/cgapp/files_test.go @@ -89,7 +89,7 @@ func TestMakeFolder(t *testing.T) { }, } - _ = os.Mkdir("cgapp-project", 0750) + _ = os.Mkdir("cgapp-project", 0o750) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -121,7 +121,7 @@ func TestRemoveFolders(t *testing.T) { }, } - _ = os.MkdirAll("../../tmp/folder-1", 0750) + _ = os.MkdirAll("../../tmp/folder-1", 0o750) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -219,7 +219,7 @@ func TestGenerateFileFromTemplate(t *testing.T) { }, } - _ = os.Mkdir("../../tmp", 0750) + _ = os.Mkdir("../../tmp", 0o750) _, _ = os.Create("../../tmp/test.txt") for _, tt := range tests { diff --git a/pkg/registry/defaults.go b/pkg/registry/defaults.go index d47eccb..c8a0ad8 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.2.0" +const CLIVersion string = "3.2.1" // Variables struct for Ansible variables (inventory, hosts). type Variables struct {