LoginSignup
15
16

More than 3 years have passed since last update.

VSCodeでgolangci-lintを設定する

Last updated at Posted at 2019-12-31

環境

Go: go version go1.13 darwin/amd64
Homebrew: Homebrew 2.1.15

手順

インストール

READMEに沿ってインストールする

設定ファイル

# .golangci-lint.yaml
run:
  deadline: 5m

linters-settings:
  errcheck:
    # ファイルや任意のパッケージの関数のチェックを除外することができる。
    # https://github.com/kisielk/errcheck#excluding-functions
    exclude: /path/to/file.txt

linters:
  disable-all: true
  enable:
    - goimports
    - golint
    - govet
    - misspell
    - errcheck
    - staticcheck
    - prealloc
    - ineffassign

エディタへの設定

settings.jsonに項目を追加する.

{
    "go.lintTool":"golangci-lint",
    "go.lintFlags": [
        "--config=${workspaceFolder}/.golangci.yaml",
        "--fast"
    ]
}

参考

15
16
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
16