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
1 answer
8 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 `...
user avatar
  • 131
0 votes
2 answers
159 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 ...
user avatar
0 votes
1 answer
66 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 ...
user avatar
0 votes
1 answer
63 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, ...
user avatar
0 votes
0 answers
365 views

Autocomplete for Go in emacs with LSP + gopls

Following up on https://stackoverflow.com/questions/50668619/autocomplete-in-golang-in-emacs, which is now over 3 years old, but technology has evolved. I did a lot of reading on what's the latest ...
user avatar
  • 377
0 votes
1 answer
69 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 ...
user avatar
  • 23
1 vote
1 answer
392 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 ...
user avatar
  • 199
0 votes
1 answer
40 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....
user avatar
  • 103
1 vote
2 answers
2k 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 ...
user avatar
0 votes
1 answer
189 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: ...
user avatar
0 votes
1 answer
64 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 ...
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 ...
user avatar
3 votes
0 answers
92 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?
user avatar
  • 1,320
0 votes
0 answers
120 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 ...
user avatar
1 vote
1 answer
242 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 ...
user avatar
0 votes
1 answer
686 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 ...
user avatar
  • 119
0 votes
1 answer
239 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 ./......
user avatar
2 votes
1 answer
90 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 ...
user avatar
  • 1,163
0 votes
2 answers
130 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 ...
user avatar
1 vote
1 answer
184 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 ...
user avatar
  • 111
1 vote
1 answer
746 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.
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 ...
user avatar
  • 111
2 votes
0 answers
308 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 ...
user avatar
  • 185
4 votes
2 answers
609 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.
user avatar
1 vote
1 answer
223 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-...
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 ;;=============...
user avatar
0 votes
1 answer
165 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?
user avatar
  • 101
1 vote
0 answers
905 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 :( ` ...
user avatar
3 votes
2 answers
669 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-...
user avatar
  • 131
7 votes
0 answers
901 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 ...
user avatar
  • 423
3 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 ...
user avatar
  • 275
4 votes
1 answer
365 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 ...
user avatar
  • 43
1 vote
1 answer
794 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. ...
user avatar