Skip to content

armnerd/go-skeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-skeleton

Golang 脚手架,Go 简单,Go 直接

Run

// 配置
cp .env.example .env

// 日志
mkdir runtime

// 构建
go build main.go

// 构建时指定 CPU 核心数量
go build -ldflags "-X main.SetCpuCount=1" main.go

// 获取运行参数
./main server -h

// 开启接口服务
./main server

// 运行脚本
./main cmd demo hello
./main cmd demo world

Doc

  • 依赖
go get -u github.com/swaggo/swag/cmd/[email protected]
go get -u github.com/swaggo/[email protected] 
go get -u github.com/swaggo/files
go get -u github.com/alecthomas/template
  • 初始化
swag init
  • 访问

https://127.0.0.1:9551/swagger/index.html

Test

go get github.com/smartystreets/goconvey

cd test/redis
go test -v

cd test/curl
goconvey

Lib

Role Package Link
命令 cobra https://github.com/spf13/cobra
路由 Gin https://github.com/gin-gonic/gin
配置 godotenv https://github.com/joho/godotenv
ORM Gorm https://github.com/go-gorm/gorm
redis redigo https://github.com/gomodule/redigo
Curl goz https://github.com/idoubi/goz
Json gjson https://github.com/tidwall/gjson
日志 logrus https://github.com/sirupsen/logrus
鉴权 jwt-go https://github.com/golang-jwt/jwt
文档 gin-swagger https://github.com/swaggo/gin-swagger
测试 goconvey https://github.com/smartystreets/goconvey
Kafka kafka-go https://github.com/segmentio/kafka-go
RabbitMq amqp https://github.com/streadway/amqp
Etcd etcd https://github.com/coreos/etcd/clientv3

About

集成 Gin 和 Gorm 的 Go 脚手架

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages