Questions tagged [golang]

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Filter by
Sorted by
Tagged with
0 votes
0 answers
57 views

eglot + gopls (golang) , make 'find definition' work under /usr/local/src/go

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-...
eugene's user avatar
  • 489
0 votes
1 answer
271 views

How to set eglot for wasm and go-lang?

I'm just trying to learn Go Language, and WASM with Go-language. My emacs setup (eglot + gopls) works completely fine when I'm working on just go scripts. However, When I trying to learn wasm+go, ...
Garid's user avatar
  • 589
1 vote
1 answer
724 views

Can't get auto-imports working with Eglot

I'm trying out eglot with gopls and having trouble getting auto-imports working. My configuration looks like below; (which I gathered from github-issues of eglot 1) (add-hook 'go-mode-hook #'eglot-...
Muhammet Can's user avatar
0 votes
1 answer
594 views

How to find interface implementations with `gopls` and `lsp-mode`?

While running gopls and lsp-mode on a Golang project, is there a way to list all implementations of an interface's function? When invoked on a function name, xref-find-definition jumps inside the ...
anon2328's user avatar
0 votes
1 answer
347 views

Unable to setup dap for go

I am trying to setup the new dap plugin for Go in emacs, but I am unable to. This is documentation that i am following: https://emacs-lsp.github.io/dap-mode/page/configuration/#go This is my ...
Pharaoh's user avatar
  • 111
1 vote
2 answers
130 views

Editing Go(lang) code freezes PC

Everytime I open a golang file and start editing, (even a file with just the following in) package models import "github.com/gofrs/uuid" type Client struct { ID uuid.UUID `...
Andre's user avatar
  • 151
0 votes
3 answers
748 views

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

I'm using lsp-mode as lsp client and gopls as lsp backend in order to lookup function and variable definitions in go projects. On a given large repository (kubernetes) that I recently wiped and cloned ...
Ricky Robinson's user avatar
0 votes
1 answer
350 views

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

I'm using company-mode with lsp-mode as lsp client and gopls as lsp backend in order to lookup function and variable definitions in go projects. On some repositories, when I want to lookup a ...
Ricky Robinson's user avatar
0 votes
1 answer
152 views

How can I develop in Go with IDE capabilities for large projects

I am trying to migrate from GoLand to Emacs as my primary IDE for working with Go. I've gone through the standard advice online: company-go, go-mode, lsp, all that stuff. It was hell, it took forever, ...
Oscar Rosenwald's user avatar
0 votes
1 answer
186 views

Unable to set gofmt-args in Go mode

I am unable to set gofmt arguments to consume the following arguments -tabs=false -tabwidth=2 -w=true When I set the variable gofmt-args, I get the following error Invalid read syntax: "Trailing ...
hmehra's user avatar
  • 23
2 votes
1 answer
874 views

Use golangci-lint with lsp-mode

How can I set up golangci-lint as the linter with my config? I've tried using flycheck-golangci-lint but it doesn't seem to be working. I'm testing my config by opening a .go file with an ineffectual ...
jidicula's user avatar
  • 251
0 votes
1 answer
66 views

How to match emacs column count to gofmt column count?

I am writing Go code but the error messages do not agree with Emacs' column count. Is there an off-the-shelf solution for this? I'm wondering about a minor mode or even a few lines for my .emacs file....
Mehmet's user avatar
  • 103
2 votes
2 answers
3k views

How to use doom emacs as a golang ide quickly?

I installed the newest doom emacs on macOS. Also configed language packages as $ emacs ~/.doom.d/init.el :lang (go +lsp) :tools lsp $ ~/.emacs.d/bin/doom sync When I open a .go file, the code became ...
warmwinter's user avatar
1 vote
1 answer
376 views

the following functions might not be defined at runtime: lsp-format-buffer, lsp-organize-imports function ‘dap-go-setup’ is not known to be defined

I 've below emacs init file config setup I'm getting below error in the emacs startup. I don't know what might be the root cause of the issue the following functions might not be defined at runtime: ...
Rajkumar Natarajan's user avatar
0 votes
1 answer
78 views

Company installation error

trying to setup go auto completion (using spacemacs), facing an issue while installing company In end of data: company-tng.el:198:1:Warning: the function ‘eglot--snippet-expansion-fn’ is not known to ...
Vishnu V's user avatar
  • 101
0 votes
0 answers
1k views

LSP :: No LSP server for go-mode (check *lsp-log*)

I'm try to setup my golang IDE on doom-emacs. I've go installed $ go version go version go1.14.3 darwin/amd64 gopath is set - $ echo $GOPATH /Users/rajkumar.natarajan/go $PATH ...
Rajkumar Natarajan's user avatar
3 votes
0 answers
143 views

How to open url inside lsp-ui-doc popup childframe in browser

I am using spacemacs go layer with lsp as backend with gopls. How to open the link in the childframe of lsp-ui-doc in browser?
Enze Chi's user avatar
  • 1,450
0 votes
0 answers
145 views

Performance issues using go-eldoc

The Problem Performance issues when point is inside/on a symbol go-eldoc/gocode has info for. Based on my interaction with emacs I would guess that the problem has something to do with gocode being ...
SultanLegend's user avatar
1 vote
1 answer
320 views

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

When I compile a simple (incorrect) go program like this from emacs package main func main() int { } I get this result -*- mode: compilation; default-directory: "~/Go/" -*- Compilation started at ...
Nick Craig-Wood's user avatar
0 votes
1 answer
834 views

How to avoid showing gofmt fail error when saving go code every time in Emacs

Using Spacemacs and its go layer. Using Tramp in Emacs ssh to remote server to edit go file. After saving the file, it will check the syntax with gofmt . But every time it shows the error below: I ...
02040402's user avatar
  • 129
0 votes
1 answer
288 views

Why does projectile-compile-project call "go build ./..."?

I just started to use projectile. I use it with a go project. When I call projectile-compile-project, go build ./... runs, but after that there is no binary. The same happens when I call go build ./......
Markus Grunwald's user avatar
2 votes
1 answer
111 views

Adding speedbar support for a language major mode?

It appears to me that go-mode and speedbar are not working together - the .go files do not appear in the file list. https://github.com/dominikh/go-mode.el/issues/270 is a bug on go-mode which ...
Realraptor's user avatar
  • 1,253
0 votes
2 answers
147 views

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

My emacs go-lang setup is more or less the same as https://lupan.pl/dotemacs/. I get suggestions from company-go for standard library (like fmt for example), but I don't get any suggestions from my ...
irumbumoideen's user avatar
1 vote
1 answer
267 views

Go Lang Struct Align Text

I am using go programming I have structs like this: type person struct { firstname string lastname string age int address string } I want it to be aligned like this ...
Pharaoh's user avatar
  • 111
1 vote
1 answer
870 views

Set flycheck-compile command

How do I set flycheck-compile to run go-build on save? I can't find documentation on how to run flycheck-compile with go-build on save.
RNikoopour's user avatar
1 vote
2 answers
2k views

Cannot set tab-width in Golang mode with Spacemacs

I set the tab-width for Golang to 2 using the following: (add-hook 'go-mode-hook (lambda () (setq-default indent-tabs-mode 1) (setq-default tab-width 2))) And when ...
Chao Sun's user avatar
  • 111
2 votes
0 answers
328 views

Slow typing on go mode

need a little help here, my emacs is so slow if while writing go code, it look like it is stuttering. On my observation, it happens because I have "not that" a lot folders in my src directory, most ...
zer09's user avatar
  • 185
4 votes
2 answers
676 views

Context-aware auto completion for Go

Is there any context-aware auto-completion for Go e.g if I enter "fmt." after importing the library, auto-completion should pop up and suggest me the functions like "Println" etc.
Erhan Bagdemir's user avatar
1 vote
1 answer
254 views

Imenu is missing multi-line golang function signatures

When a golang function signature is split with a linebreak it does not appear in imenu nor helm-imenu. I would like to jump between functions using helm-imenu, but this issue is in my way. Not hard-...
Miles's user avatar
  • 121
1 vote
1 answer
4k views

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

Below is my emacs init file that relates to Go. I'm trying to use company mode to auto completes Go. ;;=================================================== ; Golang related configuration ;;=============...
Just a learner's user avatar
0 votes
1 answer
177 views

Extending Go function arguments show hotkey

how to add the ability to bind a hotkey to display the function's arguments? Is it even possible?
Spouk's user avatar
  • 101
1 vote
0 answers
1k views

How to add tab character while inside a rune (or string) in go-mode?

In go-mode, inside a rune hitting the tab key doesn't add the tab character. E.g.: var foobar = ` If I place the point at the start of this line and press tab it wouldn't add the tab character :( ` ...
Bleeding Fingers's user avatar
3 votes
2 answers
881 views

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

I have been using gocode with emacs and it gives completions of functions. Is there any way to get emacs to show the documentation of those functions in a pop up too. I am using auto-complete with go-...
enitihas's user avatar
  • 131
9 votes
0 answers
949 views

gud: highlight breakpoints with custom debugger

I use go-dlv to debug Go programs. This package is very simple and relies on standard gud functionality (https://github.com/benma/go-dlv.el/blob/master/go-dlv.el) One thing that I found missing is ...
kostya's user avatar
  • 503
4 votes
1 answer
2k views

Automatically add golang package names that are used but not imported to import statement

Is there a way or tool in Emacs, specifically by use of go-mode, to automatically add the lines of code to the import statement, while writing code that uses those packages? Let us assume those ...
sçuçu's user avatar
  • 285
5 votes
1 answer
457 views

Make ending curly brace of block go down an extra newline in Golang

Upon pressing enter inside a newly created block I would like the Emacs to move the ending curly brace an extra newline down, and then indent the cursor. Is this possible? Example Before pressing ...
jsfr's user avatar
  • 53
1 vote
1 answer
935 views

Extending autocomplete for Go to insert function arguments

Autocomplete for Go code (fantastically) suggests functions and helpfully shows the documentation for the function, e.g. arguments and return types. If I hit tab, the DialHTTP function is inserted. ...
Daniel Blezek's user avatar