From 38903d07e87ca2f1a3a1966c1c9abd2bfe50bcba Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 14 Feb 2018 05:52:07 -0500 Subject: [PATCH] lang/go: relax warnings + Don't default to goimports unless it's available. + No warning if goimports is missing. --- modules/lang/go/config.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/lang/go/config.el b/modules/lang/go/config.el index ec21d708f..b20c76afa 100644 --- a/modules/lang/go/config.el +++ b/modules/lang/go/config.el @@ -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)