File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# goinit
22goinit create a single package go project in ` $GOPATH/src/ or use go mod `
33
4+ ## 2021-03-03 update
5+ update to go1.16
6+
47## 2020-03-21 update
58add go mod
69add Dockerfile
@@ -11,20 +14,23 @@ add docker-compose.yml
1114Download and install it:
1215` $ go get -u -v github.com/alphayan/goinit `
1316Create a go project:
14- ` $ goinit -c projectname -f echo -o xorm -m `
17+ ` $ goinit -c projectname -f echo -o xorm -s User,Log `
1518
1619## Get help
1720Read help dockument:
1821` $ goinit -h `
1922
2023## Project directory hierarchy
2124```
22- <project>/
23- |- -main.go
24- |- -config.go
25- |- -db.go
26- |- -redis.go
27- |- -router.go
25+ <project>/
26+ |- -c_controller.go
27+ |- -m_model.go
28+ |- -main.go
29+ |- -s_config.go
30+ |- -s_db.go
31+ |- -s_redis.go
32+ |- -s_router.go
33+ |- -s_response.go
2834 |- -.gitignore
2935 |- -config.toml
3036 |- -go.mod
@@ -33,5 +39,5 @@ Read help dockument:
3339```
3440## Tips
3541打包成可执行程序并压缩
36- 1.使用go build -ldflags '-w -s'进行代码编译,得到.exe文件
42+ 1.使用go build -ldflags '-w -s -extldflags "-static" '进行代码编译,得到.exe文件
37432.使用upx小工具进行压缩,使得.exe文件大幅度缩小 [ upx官网] ( https://upx.github.io/ " 点击upx下载 ")
Original file line number Diff line number Diff line change @@ -3,4 +3,5 @@ module github.com/alphayan/goinit
33go 1.16
44
55retract v0.4.2
6+
67require github.com/spf13/cobra v1.1.3
You can’t perform that action at this time.
0 commit comments