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
1answer
12 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 ...
0
votes
0answers
33 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 ...
0
votes
1answer
24 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....
0
votes
0answers
8 views

go module with subdirectory of git project is showing compilation errors in emacs using lsp-mode

I've my emacs setup for golang development. My golang config is github If I have go mod in the same directory as git root directory then it is working fine in emacs. example project here But If I've ...
0
votes
0answers
110 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 ...
0
votes
0answers
30 views

How to get variable type definition in lsp for using in Lisp code?

I want a helper command for refactoring code in Go language. I have not found ready for use function for this task in go-mode and lsp. It should declare variable from the word under the point and ...
0
votes
1answer
105 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: ...
0
votes
0answers
22 views

Help required wrt. lsp-mode with gopls on Windows natively without WSL

I am currently running Emacs 27.1 on Windows 10. I am using lsp-mode with gopls with Go installed natively (without WSL). I am running into issues setting it up. Specifically, I am running into: https:...
0
votes
1answer
40 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 ...
0
votes
0answers
468 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 ...
2
votes
0answers
64 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?
0
votes
0answers
97 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 ...
1
vote
1answer
158 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 ...
0
votes
1answer
490 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 ...
0
votes
1answer
179 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 ./......
2
votes
1answer
66 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 ...
0
votes
2answers
120 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 ...
1
vote
1answer
155 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 ...
1
vote
1answer
655 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.
1
vote
2answers
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 ...
2
votes
0answers
289 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 ...
4
votes
2answers
585 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.
1
vote
1answer
206 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-...
1
vote
1answer
3k 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 ;;=============...
0
votes
1answer
160 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?
1
vote
0answers
841 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 :( ` ...
3
votes
2answers
548 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-...
6
votes
0answers
868 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 ...
3
votes
1answer
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 ...
3
votes
1answer
287 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 ...
1
vote
1answer
708 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. ...