lang/go: relax warnings
+ Don't default to goimports unless it's available. + No warning if goimports is missing.
This commit is contained in:
parent
57adae5ec6
commit
38903d07e8
1 changed files with 7 additions and 7 deletions
|
@ -4,13 +4,8 @@
|
|||
:mode "\\.go$"
|
||||
:interpreter "go"
|
||||
:config
|
||||
(add-hook 'go-mode-hook #'flycheck-mode)
|
||||
|
||||
(setq gofmt-command "goimports"
|
||||
gofmt-show-errors nil)
|
||||
(if (not (executable-find "goimports"))
|
||||
(warn "go-mode: couldn't find goimports; no code formatting/fixed imports on save")
|
||||
(add-hook! go-mode (add-hook 'before-save-hook #'gofmt-before-save nil t)))
|
||||
(when (executable-find "goimports")
|
||||
(setq gofmt-command "goimports"))
|
||||
|
||||
(set! :repl 'go-mode #'gorepl-run)
|
||||
(set! :lookup 'go-mode
|
||||
|
@ -18,6 +13,11 @@
|
|||
:references #'go-guru-referrers
|
||||
:documentation #'godoc-at-point)
|
||||
|
||||
(setq gofmt-show-errors nil) ; Leave it to flycheck
|
||||
(add-hook 'go-mode-hook #'flycheck-mode)
|
||||
(add-hook! go-mode
|
||||
(add-hook 'before-save-hook #'gofmt-before-save nil t))
|
||||
|
||||
(def-menu! +go/refactor-menu
|
||||
"Refactoring commands for `go-mode' buffers."
|
||||
'(("Add import" :exec go-import-add :region nil)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue