Skip to content

Commit

Permalink
update gs to v1.2.0 (#3)
Browse files Browse the repository at this point in the history
* use project name as main file name

* update `gs` to `v1.2.0`
  • Loading branch information
dan-kuroto authored Jan 6, 2024
1 parent 733f74f commit 043a326
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var createCmd = &cobra.Command{
utils.Save(utils.GetPath(projectName, "scripts", utils.GetScriptName("build")), utils.GetBuildScript(projectName))
utils.Save(utils.GetPath(projectName, "scripts", utils.GetScriptName("rundev")), utils.GetRunDevScript(projectName))
utils.Save(utils.GetPath(projectName, "scripts", utils.GetScriptName("runrelease")), utils.GetRunReleaseScript(projectName))
utils.Save(utils.GetPath(projectName, "main.go"), utils.GetMainGo(projectName, customConfig))
utils.Save(utils.GetPath(projectName, projectName+".go"), utils.GetMainGo(projectName, customConfig))
utils.Save(utils.GetPath(projectName, "routers.go"), utils.GetRoutersGo(projectName))
if customConfig {
utils.Mkdir(utils.GetPath(projectName, "utils"))
Expand Down
24 changes: 14 additions & 10 deletions utils/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
)

const Version = "v1.1.2 Ginga Strium"
const ShortVersion = "v1.1.2"
const Version = "v1.2.0 Victory"
const ShortVersion = "v1.2.0"

func GetBanner() string {
return fmt.Sprintf(` _____ _____
Expand Down Expand Up @@ -45,6 +45,10 @@ gin:
message: hello world
`)
}
builder.WriteString(`
snow-flake:
start-stmp: 1626779686000
`)

return builder.String()
}
Expand Down Expand Up @@ -92,17 +96,17 @@ Done. Now run:
func GetBuildRunScript(projectName string) string {
if IsWindows() {
return fmt.Sprintf(`# build app
go build -o target/%s.exe ./main.go ./routers.go
go build -o target/%s.exe ./%s.go ./routers.go
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
# run app
./target/%s.exe
`, projectName, projectName)
`, projectName, projectName, projectName)
} else {
return fmt.Sprintf(`# build app
go build -o target/%s main.go routers.go
go build -o target/%s %s.go routers.go
code=$?
if [ $code -ne 0 ]; then
Expand All @@ -111,19 +115,19 @@ fi
# run app
target/%s
`, projectName, projectName)
`, projectName, projectName, projectName)
}
}

func GetBuildScript(projectName string) string {
if IsWindows() {
return fmt.Sprintf(`# build app
go build -o target/%s.exe ./main.go ./routers.go
`, projectName)
go build -o target/%s.exe ./%s.go ./routers.go
`, projectName, projectName)
} else {
return fmt.Sprintf(`# build app
go build -o target/%s main.go routers.go
`, projectName)
go build -o target/%s %s.go routers.go
`, projectName, projectName)
}
}

Expand Down

0 comments on commit 043a326

Please sign in to comment.