Eglot + gopls works fine.

I have the following in my init.el, and it works for installed packages (mod files)

(require 'project)

(defun project-find-go-module (dir)
  (when-let ((root (locate-dominating-file dir "go.mod")))
    (cons 'go-module root)))

(cl-defmethod project-root ((project (head go-module)))
  (cdr project))

(add-hook 'project-find-functions #'project-find-go-module)

But when I end up visiting a file under /usr/local/go/src/ none of find-definition, find-references works.

Is there a way to make them work when you are outside of your project?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.