systemd,vimrc: add,use gopls daemon

This commit is contained in:
surtur 2022-08-16 14:03:51 +02:00
parent 3db9f3b83d
commit 6f75f4e339
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 34 additions and 1 deletions

@ -0,0 +1,31 @@
[Unit]
Description = Go language server.
[Service]
ExecStartPre=bash -c "rm -v -f /tmp/.gopls-daemon.sock || true"
ExecStart=%h/utils/go/bin/gopls -listen="unix;/tmp/.gopls-daemon.sock"
ExecStopPost=bash -c "rm -v -f /tmp/.gopls-daemon.sock || true"
; -remote.listen.timeout
Restart=on-failure
RestartSec=1m
SystemCallFilter=~@reboot @obsolete
ProtectProc=invisible
ProcSubset=pid
ProtectHome=true
RestrictNamespaces=true
NoNewPrivileges=yes
ProtectSystem=strict
DevicePolicy=closed
LockPersonality=true
MemoryDenyWriteExecute=true
RestrictAddressFamilies=AF_UNIX
RestrictRealtime=true
RestrictSUIDSGID=true
SystemCallArchitectures=native
[Install]
WantedBy=default.target

@ -498,6 +498,8 @@ let g:go_fmt_command='gopls'
let g:go_fmt_autosave = 1 let g:go_fmt_autosave = 1
" go install mvdan.cc/gofumpt@latest " go install mvdan.cc/gofumpt@latest
let g:go_gopls_gofumpt=1 let g:go_gopls_gofumpt=1
" let lsp handle connecting to gopls
let g:go_gopls_enabled = 0
augroup vimgo augroup vimgo
au! au!
@ -681,7 +683,7 @@ if executable('gopls')
autocmd! autocmd!
autocmd User lsp_setup call lsp#register_server({ autocmd User lsp_setup call lsp#register_server({
\ 'name': 'gopls', \ 'name': 'gopls',
\ 'cmd': ['gopls'], \ 'cmd': ['gopls', '-remote=unix;/tmp/.gopls-daemon.sock'],
\ 'allowlist': ['go', 'gomod', 'gosum','gotexttmpl','gohtmltmpl'], \ 'allowlist': ['go', 'gomod', 'gosum','gotexttmpl','gohtmltmpl'],
\ 'gofumpt': 'true', \ 'gofumpt': 'true',
\ }) \ })