Commits (2)
......@@ -84,12 +84,38 @@
;;; Go Stuff
; What GOPATH was on startup.
(defvar dotemacs-original-gopath (getenv "GOPATH"))
; Reads the ".gopath" dir in the current dir and finds the absolute path.
(defun dotemacs-dotgopath-resolve (projdir)
(let ((dgp-path (expand-file-name ".gopath" projdir)))
(if (file-exists-p dgp-path)
(insert-file-contents-literally dgp-path)
(goto-char (point-min))
(expand-file-name (string-trim (thing-at-point 'line))
(use-package go-mode
:ensure t
:hook ((before-save . gofmt-before-save))
:hook ((before-save . gofmt-before-save)
(go-mode . company-lsp)
. (lambda ()
(let ((newgopath (dotemacs-dotgopath-resolve
(lsp--workspace-root lsp--cur-workspace))))
(when (not (null newgopath))
(message "Temporarily setting GOPATH to %s" newgopath)
(setenv "GOPATH" newgopath)))))
. (lambda () (setenv "GOPATH" dotemacs-original-gopath))))
(define-key go-mode-map (kbd "TAB") #'company-indent-or-complete-common))
;;; C stuff
(use-package cc-mode
:ensure t
......@@ -114,7 +140,6 @@
:ensure t)
; Column numbers!
(setq column-number-mode t)