Skip to content

Commit 3617f07

Browse files
authored
Merge branch 'master' into dev
2 parents 038896a + a4a9dd8 commit 3617f07

File tree

12 files changed

+56
-36
lines changed

12 files changed

+56
-36
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# These are supported funding model platforms
22

33
patreon: koddr
4-
custom: https://paypal.me/koddr
4+
custom: ["https://www.producthunt.com/posts/create-go-app", "https://paypal.me/koddr"]

.github/stale.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Number of days of inactivity before an issue becomes stale
2-
daysUntilStale: 15
2+
daysUntilStale: 10
33

44
# Number of days of inactivity before a stale issue is closed
55
daysUntilClose: 3
@@ -14,7 +14,7 @@ staleLabel: wontfix
1414

1515
# Comment to post when marking an issue as stale. Set to `false` to disable
1616
markComment: >
17-
👋 Hello. Is this still relevant? If so, what is blocking it? Is there
17+
👋 Hello. Is this still relevant? If so, what is blocking it? Is there
1818
anything you can do to help move it forward?
1919
2020
> This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Apache License
32
Version 2.0, January 2004
43
http://www.apache.org/licenses/
@@ -187,7 +186,7 @@
187186
same "printed page" as the copyright notice for easier
188187
identification within third-party archives.
189188

190-
Copyright 2019-present Vic Shóstak <[email protected]> (https://shostak.dev)
189+
Copyright 2021 Vic Shóstak and Create Go App Contributors
191190

192191
Licensed under the Apache License, Version 2.0 (the "License");
193192
you may not use this file except in compliance with the License.

Makefile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
.PHONY: clean test security install build release
1+
.PHONY: clean lint security critic test install build release
22

33
clean:
44
rm -rf ./tmp coverage.out
55

6-
test: clean
7-
go test -coverprofile=coverage.out ./...
8-
go tool cover -func=coverage.out
9-
106
lint:
11-
golangci-lint run
7+
golangci-lint run ./...
128

139
security:
1410
gosec -quiet ./...
1511

16-
install: security lint test
12+
critic:
13+
gocritic check -enableAll ./...
14+
15+
test: clean lint security critic
16+
go test -coverprofile=coverage.out ./...
17+
go tool cover -func=coverage.out
18+
19+
install: test
1720
CGO_ENABLED=0 go build -ldflags="-s -w" -o $(GOPATH)/bin/cgapp ./cmd/cgapp/main.go
1821

19-
build: security test
22+
build: test
2023
goreleaser --snapshot --skip-publish --rm-dist
2124

22-
release: security test
25+
release: test
2326
git tag -a $(VERSION) -m "$(VERSION)"
2427
goreleaser --snapshot --skip-publish --rm-dist
2528

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</h1>
55
<p align="center">Create a new production-ready project with <b>backend</b> (Golang), <b>frontend</b> (JavaScript, TypeScript)<br/>and <b>deploy automation</b> (Ansible, Docker) by running one CLI command.<br/><br/>Focus on <b>writing</b> code and <b>thinking</b> of business-logic! The CLI will take care of the rest.</p>
66

7-
<p align="center"><a href="https://github.com/create-go-app/cli/releases" target="_blank"><img src="https://img.shields.io/badge/version-v3.1.2-blue?style=for-the-badge&logo=none" alt="cli version" /></a>&nbsp;<a href="https://pkg.go.dev/github.com/create-go-app/cli/v3?tab=doc" target="_blank"><img src="https://img.shields.io/badge/Go-1.17+-00ADD8?style=for-the-badge&logo=go" alt="go version" /></a>&nbsp;<a href="https://gocover.io/github.com/create-go-app/cli/pkg/cgapp" target="_blank"><img src="https://img.shields.io/badge/Go_Cover-89.2%25-success?style=for-the-badge&logo=none" alt="go cover" /></a>&nbsp;<a href="https://goreportcard.com/report/github.com/create-go-app/cli" target="_blank"><img src="https://img.shields.io/badge/Go_report-A+-success?style=for-the-badge&logo=none" alt="go report" /></a>&nbsp;<img src="https://img.shields.io/badge/license-apache_2.0-red?style=for-the-badge&logo=none" alt="license" /></p>
7+
<p align="center"><a href="https://github.com/create-go-app/cli/releases" target="_blank"><img src="https://img.shields.io/badge/version-v3.2.1-blue?style=for-the-badge&logo=none" alt="cli version" /></a>&nbsp;<a href="https://pkg.go.dev/github.com/create-go-app/cli/v3?tab=doc" target="_blank"><img src="https://img.shields.io/badge/Go-1.17+-00ADD8?style=for-the-badge&logo=go" alt="go version" /></a>&nbsp;<a href="https://gocover.io/github.com/create-go-app/cli/pkg/cgapp" target="_blank"><img src="https://img.shields.io/badge/Go_Cover-89.2%25-success?style=for-the-badge&logo=none" alt="go cover" /></a>&nbsp;<a href="https://goreportcard.com/report/github.com/create-go-app/cli" target="_blank"><img src="https://img.shields.io/badge/Go_report-A+-success?style=for-the-badge&logo=none" alt="go report" /></a>&nbsp;<img src="https://img.shields.io/badge/license-apache_2.0-red?style=for-the-badge&logo=none" alt="license" /></p>
88

99
## ⚡️ Quick start
1010

@@ -15,7 +15,7 @@ First of all, [download](https://golang.org/dl/) and install **Go**. Version `1.
1515
Installation is done by using the [`go install`](https://golang.org/cmd/go/#hdr-Compile_and_install_packages_and_dependencies) command and rename installed binary in `$GOPATH/bin`:
1616

1717
```bash
18-
go install github.com/create-go-app/cli/v3/cmd/cgapp
18+
go install github.com/create-go-app/cli/v3/cmd/cgapp@latest
1919
```
2020

2121
Also, macOS and GNU/Linux users available way to install via [Homebrew](https://brew.sh/):

cmd/create.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func runCreateCmd(cmd *cobra.Command, args []string) error {
7373
// Define variables for better display.
7474
backend = fmt.Sprintf(
7575
"github.com/create-go-app/%v-go-template",
76-
strings.Replace(createAnswers.Backend, "/", "_", -1),
76+
strings.ReplaceAll(createAnswers.Backend, "/", "_"),
7777
)
7878
frontend = createAnswers.Frontend
7979
proxy = createAnswers.Proxy
@@ -208,11 +208,12 @@ func runCreateCmd(cmd *cobra.Command, args []string) error {
208208
*/
209209

210210
// Set unused proxy roles.
211-
if proxy == "traefik" || proxy == "traefik-acme-dns" {
211+
switch proxy {
212+
case "traefik", "traefik-acme-dns":
212213
proxyList = []string{"nginx"}
213-
} else if proxy == "nginx" {
214-
proxyList = []string{"traefik"}
215-
} else {
214+
case "nginx":
215+
proxyList = []string{"nginx"}
216+
default:
216217
proxyList = []string{"traefik", "nginx"}
217218
}
218219

cmd/root.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package cmd
66

77
import (
88
"github.com/AlecAivazis/survey/v2"
9+
"github.com/create-go-app/cli/v3/pkg/cgapp"
910
"github.com/create-go-app/cli/v3/pkg/registry"
1011
"github.com/spf13/cobra"
1112
)
@@ -48,6 +49,11 @@ frontend (JavaScript, TypeScript) and deploy automation
4849
A helpful documentation and next steps -> https://create-go.app/`,
4950
}
5051

52+
func init() {
53+
rootCmd.SetOut(cgapp.Stdout)
54+
rootCmd.SetErr(cgapp.Stderr)
55+
}
56+
5157
// Execute adds all child commands to the root command and sets flags appropriately.
5258
// This is called by main.main(). It only needs to happen once to the rootCmd.
5359
func Execute() {

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.17
55
require (
66
github.com/AlecAivazis/survey/v2 v2.3.2
77
github.com/go-git/go-git/v5 v5.4.2
8+
github.com/mattn/go-colorable v0.1.11
89
github.com/spf13/cobra v1.2.1
910
)
1011

pkg/cgapp/files.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"embed"
99
"fmt"
1010
"io/fs"
11-
"io/ioutil"
1211
"os"
1312
"path/filepath"
1413
"strings"
@@ -89,7 +88,7 @@ func GenerateFileFromTemplate(fileName string, variables map[string]interface{})
8988
_ = file.Close()
9089

9190
// Rename output file.
92-
newFileName := strings.Replace(fileName, ".tmpl", "", -1)
91+
newFileName := strings.ReplaceAll(fileName, ".tmpl", "")
9392
if errRename := os.Rename(fileName, newFileName); errRename != nil {
9493
return ShowError(errRename.Error())
9594
}
@@ -100,7 +99,7 @@ func GenerateFileFromTemplate(fileName string, variables map[string]interface{})
10099
// MakeFile function for single file create.
101100
func MakeFile(fileName string, fileData []byte) error {
102101
// Write to created file.
103-
if err := ioutil.WriteFile(fileName, fileData, 0600); err != nil {
102+
if err := os.WriteFile(fileName, fileData, 0o600); err != nil {
104103
return err
105104
}
106105

@@ -110,7 +109,7 @@ func MakeFile(fileName string, fileData []byte) error {
110109
// MakeFolder function for create folder.
111110
func MakeFolder(folderName string) error {
112111
// Check if folder exists, fail if it does.
113-
if err := os.Mkdir(folderName, 0750); err != nil {
112+
if err := os.Mkdir(folderName, 0o750); err != nil {
114113
return err
115114
}
116115

pkg/cgapp/files_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func TestMakeFolder(t *testing.T) {
8989
},
9090
}
9191

92-
_ = os.Mkdir("cgapp-project", 0750)
92+
_ = os.Mkdir("cgapp-project", 0o750)
9393

9494
for _, tt := range tests {
9595
t.Run(tt.name, func(t *testing.T) {
@@ -121,7 +121,7 @@ func TestRemoveFolders(t *testing.T) {
121121
},
122122
}
123123

124-
_ = os.MkdirAll("../../tmp/folder-1", 0750)
124+
_ = os.MkdirAll("../../tmp/folder-1", 0o750)
125125

126126
for _, tt := range tests {
127127
t.Run(tt.name, func(t *testing.T) {
@@ -219,7 +219,7 @@ func TestGenerateFileFromTemplate(t *testing.T) {
219219
},
220220
}
221221

222-
_ = os.Mkdir("../../tmp", 0750)
222+
_ = os.Mkdir("../../tmp", 0o750)
223223
_, _ = os.Create("../../tmp/test.txt")
224224

225225
for _, tt := range tests {

0 commit comments

Comments
 (0)