自分用 golang emacs 開発環境 1st Step にゃ
prep Install golangci-lint
$ cd ~/go
# go mod がないと install 出来ない
$ curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.20.0
# version その時その時で
# wite your golangci-lint configuration
$ touch ~/go/golangci-lint.yaml
eg (see .golangci.example.yml)
# This file contains all available configuration options
# with their default values.
# options for analysis running
run:
# default concurrency is a available CPU number
concurrency: 2
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 1m
linters:
enable:
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
- gocyclo
- gosimple
disable-all: true
presets:
- bugs
- unused
fast: false
install emacs packages
M-x package-install flycheck
M-x package-install fly-golangci-lint
init.el
;;; package install で生成されたもの
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
(quote
(go-mode flycheck-golangci-lint flycheck)))
'(tool-bar-mode nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;;; 公式サイトからコピペ
(eval-after-load 'flycheck
'(add-hook 'flycheck-mode-hook #'flycheck-golangci-lint-setup))
(setq flycheck-golangci-lint-config "~/go/golangci-lint.yaml") ;; lint の設定ファイル
(add-hook 'go-mode-hook 'flycheck-mode) ;; go-modeでflycheckを利用するように
Links
Author And Source
この問題について(自分用 golang emacs 開発環境 1st Step にゃ), 我々は、より多くの情報をここで見つけました https://qiita.com/YooWaan/items/11f52282c239480a2278著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .