goapi

module
v1.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2020 License: Apache-2.0

README

API Service

Build Status Go Report Card LICENSE Godoc

使用CircleCI进程CI Pipeline校验,Go Report Card进行Golang项目代码分析

  1. CircleCI: https://circleci.com/gh/chenguolin/goapi/tree/master
  2. Go Report Card: https://goreportcard.com/report/github.com/chenguolin/goapi

用Gin实现的通用的Web API Service框架, 提供HTTP API接口

API 包括以下3个部分

  1. 业务API
  2. 性能API (引入gopprof自带)
  3. Prometheus API (引入goprometheus自带)

业务 API

  1. 查询用户信息: curl "http://localhost:8080/user/select?uid=111&sig_timestamp=1565264175&signature=..."
  2. 创建新用户: curl "http://localhost:8080/user/create?sig_timestamp=1565264175&signature=..." -d "uid=111&name=cgl&phone=123456&signature=..."
  3. 更新用户信息: curl "http://localhost:8080/user/update?sig_timestamp=1565264175&signature=..." -d "uid=111&name=cgl2&phone=123456789"
  4. 删除用户: curl "http://localhost:8080/user/delete?sig_timestamp=1565264175&signature=..." -d "uid=111"

性能 API (默认使用38888端口)

  1. 服务状态检查: curl "http://localhost:38888/debug/health"
  2. 服务性能分析

Prometheus API (默认使用28888端口)

  1. Metrics数据: curl "http://localhost:28888/metrics"

CI Workflow Check

  1. gocyclo: 校验代码复杂度
  2. gofmt: 校验代码是否都已经格式化
  3. golint: 校验代码风格规范是否按照指定标准
  4. gosimple: 校验代码是否可以简化
  5. govet: 代码静态校验
  6. misspell: 校验是否有英文单词拼写错误
  7. unused: 校验是否有未使用变量、常量、函数、结构体等
  8. gotest: 单元测试校验

Gitlab CI

如果使用Gitlab,也可以通过.gitlab-ci.yml运行Gitlab CI Pipeline,详细介绍请参考下面2篇文章

  1. Gitlab 安装使用
  2. Gitlab CI和CD配置

Directories

Path Synopsis
cmd
1.
1.
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL