GNU Emacs 27.1
Mac OS X 11.2.1
Config
(use-package lsp-mode
:hook (python-mode . lsp)
:hook (go-mode . lsp)
:commands lsp)
(defun lsp-go-install-save-hooks ()
(add-hook 'before-save-hook #'lsp-format-buffer t t)
(add-hook 'before-save-hook #'lsp-organize-imports t t))
(add-hook go-mode-hook #'lsp-go-install-save-hooks)
which gopls
/Users/matianhe/go/bin/gopls
lsp-log
Command "gopls" is present on the path.
Command "gopls" is present on the path.
Found the following clients for /Users/matianhe/gomuniao/main.go: (server-id gopls, priority 0)
The following clients were selected based on priority: (server-id gopls, priority 0)
2021/02/25 10:31:15 go env for /Users/matianhe/gomuniao
(root /Users/matianhe/gomuniao)
(go version go version go1.15.8 darwin/amd64)
(valid build configuration = true)
(build flags: [])
GOINSECURE=
GONOPROXY=
GOPRIVATE=
GOROOT=/usr/local/Cellar/go/1.15.8/libexec
GOFLAGS=
GONOSUMDB=
GOSUMDB=sum.golang.org
GO111MODULE=
GOPATH=/Users/matianhe/go
GOCACHE=/Users/matianhe/Library/Caches/go-build
GOMODCACHE=/Users/matianhe/go/pkg/mod
GOPROXY=https://proxy.golang.org,direct
GOMOD=/Users/matianhe/gomuniao/go.mod
2021/02/25 10:31:16 go/packages.Load
snapshot=0
directory=/Users/matianhe/gomuniao
query=[builtin matianhe.com/gomuniao/v1/...]
packages=7
Creating watch for /Users/matianhe/gomuniao
Creating watch for /Users/matianhe/gomuniao/controller
Creating watch for /Users/matianhe/gomuniao/database
Creating watch for /Users/matianhe/gomuniao/model
Creating watch for /Users/matianhe/gomuniao/router
Creating watch for /Users/matianhe/gomuniao/utils
没有补全功能, 保存也没有自动格式化.