目 录CONTENT

文章目录

Uber Go编码规范和Go lint配置

Sakura
2024-03-13 / 0 评论 / 0 点赞 / 20 阅读 / 1472 字 / 正在检测是否收录...

Uber Go编码规范和Go lint配置

1. 编码规范

uber-go/guide: The Uber Go Style Guide. (github.com)

2. Golangci-lint 配置

https://golangci-lint.run/usage/configuration/#issues-configuration

.golangci.yaml

# Refer to golangci-lint's example config file for more options and information:
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml

run:
  timeout: 5m
  modules-download-mode: readonly
   go: '1.22'


output:
  format: colored-line-number
  uniq-by-line: true
  sort-results: true

linters:
  enable:
    - errcheck
    - goimports
    - revive
    - govet
    - staticcheck

issues:
  exclude-use-default: false
  max-issues-per-linter: 0
  max-same-issues: 0

tip

Sakrua

0

评论区