Questions tagged [golang]

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

Go, also called golang, is an open source programming language initially developed at Google. It is statically-typed language, has syntax loosely derived from C, but learning however from C's mistakes. Concurrent communication is handled by Hoare-style message passing. Go has automatic memory management, type safety, some dynamic-typing capabilities, additional built-in types such as variable-length arrays and key-value maps, and a large standard library.

37 questions
9
votes
0 answers

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 highlighting of breakpoints. Is there any easy way…
kostya
  • 503
  • 4
  • 6
4
votes
2 answers

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.
4
votes
1 answer

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 Enter for i := range x {} After pressing…
jsfr
  • 43
  • 2
3
votes
0 answers

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
  • 1,410
  • 12
  • 28
3
votes
2 answers

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-mode.
enitihas
  • 131
  • 1
3
votes
1 answer

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 packages is got by go get or in some other way at a…
sçuçu
  • 275
  • 1
  • 10
2
votes
1 answer

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 assignment that trips golangci-lint when run from…
jidicula
  • 251
  • 4
  • 12
2
votes
2 answers

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 highlight. But after save the file, the code…
warmwinter
  • 21
  • 1
  • 3
2
votes
1 answer

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 suggests that it isn't just me seeing this problem. What…
Realraptor
  • 1,253
  • 6
  • 17
2
votes
0 answers

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 of them is just source of the installed packages…
zer09
  • 185
  • 2
  • 7
1
vote
1 answer

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. My question: is it possible to insert a "template"…
1
vote
1 answer

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-ensure) (defun own/eglot-organize-imports () …
Muhammet Can
  • 111
  • 3
1
vote
2 answers

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 `db:"id"` Name string `db:"name"` } ...…
Andre
  • 151
  • 4
1
vote
1 answer

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: lsp-format-buffer, lsp-organize-imports the…
1
vote
1 answer

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 Mon Aug 12 22:37:46 go run assert.go #…
1
2 3