parent
366890b1c3
commit
b9ca6f9e1e
@ -1,44 +1,6 @@
|
||||
;; this is an intermediary golang config. my goals are to:
|
||||
;; - have gofmt run on save
|
||||
;; - have good syntax highlighting
|
||||
;; - compile, test, run gocode through emacs:
|
||||
|
||||
(use-package go-eldoc
|
||||
:ensure)
|
||||
|
||||
(use-package gotest
|
||||
:ensure)
|
||||
|
||||
(use-package company-go
|
||||
:ensure)
|
||||
|
||||
(use-package go-guru
|
||||
:ensure)
|
||||
|
||||
(use-package go-mode
|
||||
:init
|
||||
(use-package eglot
|
||||
:ensure t
|
||||
:config
|
||||
(add-hook 'before-save-hook #'gofmt-before-save)
|
||||
|
||||
;; stolen from luipan.pl/dotemacs/
|
||||
(defun jlj-go-mode-hook ()
|
||||
(go-eldoc-setup)
|
||||
(set (make-local-variable 'company-backends) '(company-go))
|
||||
(company-mode)
|
||||
;; Customize compile command to run go build
|
||||
|
||||
(let ((goimports (executable-find "goimports")))
|
||||
(when goimports
|
||||
(setq gofmt-command goimports)))
|
||||
|
||||
(smartparens-mode 1)
|
||||
(flycheck-mode 1)
|
||||
(setq imenu-generic-expression
|
||||
'(("type" "^type *\\([^ \t\n\r\f]*\\)" 1)
|
||||
("func" "^func *\\(.*\\) {" 1))))
|
||||
|
||||
(setq compile-command "echo Building... && go build -v && go test -v && go vet")
|
||||
(add-hook 'go-mode-hook 'jlj-go-mode-hook))
|
||||
|
||||
(with-eval-after-load "go-mode" (define-key go-mode-map (kbd "C-c C-c") 'compile))
|
||||
(add-hook 'go-mode-hook 'eglot-ensure)
|
||||
(local-set-key "\C-x\C-m" 'compile)
|
||||
(setq compile-command "go test -v && go vet && golint"))
|
||||
|
Loading…
Reference in new issue