goinit create a single package go project in $GOPATH/src/ or use go mod
update to go1.20.1
update to go1.16
add go mod
add Dockerfile
add docker-compose.yml
//TODO:postgresql
Download and install it:
$ go get -u -v github.com/alphayan/goinit
Create a go project:
$ goinit -c projectname -f echo -o xorm -s User,Log
Read help dockument:
$ goinit -h
<project>/
|- -c_controller.go
|- -m_model.go
|- -main.go
|- -s_config.go
|- -s_db.go
|- -s_redis.go
|- -s_router.go
|- -s_response.go
|- -.gitignore
|- -config.toml
|- -go.mod
|- -Dockerfile
|- -docker-compose.yml
打包成可执行程序并压缩
1.使用go build -ldflags '-w -s -extldflags "-static"'进行代码编译,得到.exe文件
2.使用upx小工具进行压缩,使得.exe文件大幅度缩小 upx官网