Skip to content

Latest commit

 

History

History
116 lines (82 loc) · 2.21 KB

Linters.md

File metadata and controls

116 lines (82 loc) · 2.21 KB

Linters and other analysis tools

golangci-lint --enable-all -v run --disable depguard,varnamelen,gomnd,nlreturn,exhaustivestruct,exhaustruct,nonamedreturns

Stricter gofmt

gofumpt -w fileName

Add whitespaces

wsl -fix fileName

Reformat the code when it exceeds a certain column length

# 80 columns length
golines -w -m 80 fileName

Checks the Wrap error message

go vet -vettool=$(which wrapmsg) ./...

Checks and enforces Go lingo

# lingo.yml
matchers:
  - type: "glob"
    config:
      pattern: "**/*.go"
  - type: "not"
    config:
      type: "glob"
      config:
        pattern: "**/*_test.go"

checkers:
  local_return:
  multi_word_ident_name:
  exported_ident_doc:
  consistent_receiver_names:
  left_quantifiers:
  pass_context_first:
  return_error_last:
lingo check ./...

Very cool but I really have no clue how to make use of it.

go-ssaviz ./...

Static analisys tool code generator.

go install golang.org/x/tools/cmd/ssadump@latest

ssadump -build=F main.go
go install github.com/knsh14/astree/cmd/astree@latest

astree main.go

Personal made linter to add a defer function call when there is a named return err.

Not for Go code but: kube-score Kubernetes, actionlint Github Actions,