I am using lsp-mode with Gopls as my coding environment. But I have one file with

// +build tagthis

at beginning of the file. Then my emacs lsp-mode cannot work well in this file. How can I change custom of go build flag for letting lsp-mode works well in this file?

I have make

   lsp-go-build-flags (vector "tagthis")

in my configuration. But it doesn't work.

1 Answer 1


I figure out the solution. Just change lsp-go-env with

   lsp-go-env '((GOFLAGS . "-tags=tagthis"))

make it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.