6 votes
Accepted

Can I use emacs with company-mode and company-go to complete Go's standard library function names?

You need to tell company-mode what backend to use. In my init file I have the following code (add-hook 'go-mode-hook (lambda () (set (make-local-variable 'company-backends) '(company-go)...
Tephra's user avatar
  • 831
3 votes

Cannot set tab-width in Golang mode with Spacemacs

The docs tell you to configure the go-tab-width spacemacs layer variable. In .spacemacs, inside dotspacemacs/layers is a variable called dotspacemacs-configuration-layers. Add the go layer variables ...
EnigmaCurry's user avatar
2 votes

Cannot set tab-width in Golang mode with Spacemacs

setq-default sets the global value, whereas you want to set the value in your particular go-mode buffer. Basically, using setq-default within a mode-hook is never right. Try: (add-hook 'go-mode-...
Stefan's user avatar
  • 26.4k
2 votes
Accepted

How to match emacs column count to gofmt column count?

This sounds like an X–Y problem, where someone has a detailed question that we could find an answer for but that seems to be leading them in the wrong direction. Since you haven’t said what you’re ...
db48x's user avatar
  • 18.1k
2 votes
Accepted

Set flycheck-compile command

The basic mechanism you're looking for is to add a hook; if you aren't familiar, hooks are an emacs mechanism that causes a specific function to be called at a particular time. For instance, go-mode-...
Gastove's user avatar
  • 1,551
2 votes

How to configure emacs to show documentation alongside completions while using gocode?

If you use Icicles then you can use C-M-RET (or C-M-mouse-2) to see the full doc string (in *Help*) of any completion candidates. You can use the arrow keys C-M-down and C-M-up to cycle among ...
Drew's user avatar
  • 77.5k
2 votes
Accepted

Unable to set gofmt-args in Go mode

Based on the error, it looks like you tried passing an unquoted string to set gofmt-args. gofmt-args's type is a list of strings, so that is what you need to give it. You can set it like this: (setq ...
psanford's user avatar
  • 176
1 vote

Editing Go(lang) code freezes PC

OK, turns out the issue was not directly related to Emacs. What was causing the crash was golangci-lint. That application was crashing because it was a very old version, incompatible with my go ...
Andre's user avatar
  • 151
1 vote

emacs stalling when looking up definitions with lsp-mode and gopls

I encountered this problem too, and it did timeout each time as I saved file. I configured the lsp-format-buffer and lsp-organize-imports as the hook of before-save-hook. When I dived into the Emacs *...
Yuanbo Han's user avatar
1 vote

emacs stalling when looking up definitions with lsp-mode and gopls

You can lengthen the timeout using the lsp-response-timeout option: https://emacs-lsp.github.io/lsp-mode/page/settings/mode/#lsp-response-timeout Of course, what you really want to do is make gopls ...
db48x's user avatar
  • 18.1k
1 vote
Accepted

unexpected "Visit tags table (default TAGS)" prompt when looking up definitions with lsp-mode and gopls

As mentioned in the comments, a workaround for this issue is to start emacs on a folder (or on nothing) instead of on a single source file. This was discussed for VScode with gopls as backend here: ...
Ricky Robinson's user avatar
1 vote

Use golangci-lint with lsp-mode

It seems you want to chain golangci-lint after lsp, is it? The following snippet allows you to chain other linters after lsp. I have included the link where the original solution was posted for other ...
Swarnendu Biswas's user avatar
1 vote
Accepted

Why in compilation-mode do my go (golang) compile errors not include the column on goto-error?

The compilation mode documentation says the following: To parse messages from the compiler, Compilation mode uses the variable compilation-error-regexp-alist which lists various error message ...
psanford's user avatar
  • 176
1 vote

Adding speedbar support for a language major mode?

Looks like adding (speedbar-add-supported-extension ".go") Might be a big part of the solution.
Slowjoe's user avatar
  • 11
1 vote

How to make `company-go` suggest completions from my own code?

If you use flycheck, set (setq flycheck-go-build-install-deps t) This will install your dependencies automatically. More details in flycheck docs: https://www.flycheck.org/en/latest/languages.html#...
Andriy Senyshyn's user avatar
1 vote
Accepted

How to make `company-go` suggest completions from my own code?

Apologies, some digging around with gocode -s -debug revealed that it couldn't resolve the import paths "mydomain.tld/myname/myproject/core/" I then realised that I should be doing "go install ./......
irumbumoideen's user avatar
1 vote

Go Lang Struct Align Text

M-x gofmt does this. Here is the output applied to your examples. package main type person struct { firstname string lastname string age int address string } const ( ...
Dusty's user avatar
  • 53
1 vote
Accepted

Imenu is missing multi-line golang function signatures

Fixed it by changing the value of imenu-generic-expression to '(("type" "^[ \t]*type *\\([^ \t\n\r\f]*[ \t]*\\(struct\\|interface\\)\\)" 1) ("func" "^func *\\(.*\\)" 1))) Which has two advantages ...
Miles's user avatar
  • 121
1 vote

Extending Go function arguments show hotkey

You can have company-go insert the arguments for a function when you complete it, like so: Not quite a hotkey for the function arguments but not too far off. If that is not enough based on https://...
Sideshowcoder's user avatar
1 vote

How to configure emacs to show documentation alongside completions while using gocode?

If you use company-mode (which is preferred by most over autocomplete these days), try company-quickhelp.
Tianxiang Xiong's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible