Skip to content

SiiWay-CLI-Templates/go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Template (SiiWay Style)

本模板基于 SiiWay Go 代码规范,目标是统一开发流程与质量门槛。

目录结构

.
├── cmd/
│   └── server/
│       └── main.go
├── internal/
│   ├── app/
│   │   └── server.go
│   ├── handler/
│   │   └── health_handler.go
│   └── service/
│       ├── health_service.go
│       └── health_service_test.go
├── .golangci.yml
├── .gitignore
├── go.mod
├── lefthook.yml
└── Makefile

快速开始

go run ./cmd/server
curl http://localhost:8080/healthz

开发命令

make fmt
make lint
make test
make vuln
make check

提交前建议流程

gofmt -w .
gofumpt -w .
gci write .
golangci-lint run ./...
go test ./...
govulncheck ./...

规范约定

  • 包名使用简短小写单词。
  • 文件名使用小写加下划线。
  • 导出符号使用 PascalCase,非导出符号使用 camelCase。
  • context.Context 放在参数第一位。
  • 错误必须显式处理,并使用 %w 包装上下文。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors