1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

自分用 golang emacs 開発環境 1st Step にゃ

Last updated at Posted at 2018-12-08

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

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?