Using Go on GNU Emacs 29 or later

The 29th version of GNU Emacs is probably going to be released sometime this year (2023). This version introduces awesome new features such as:

These features makes it possible to have a complete development environment for Go with built-in GNU Emacs packages. In order to have syntax highlight and other features1, use the following on your configuration file:

(use-package treesit
  :preface
  (dolist (mapping '((go-mode . go-ts-mode)))
    (add-to-list 'major-mode-remap-alist mapping))
  :init
  (add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode))
  (add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode)))

For the LSP client, you can write the following to automatically connect to gopls when you open a Go file:

(use-package eglot
  :hook ((go-ts-mode . eglot-ensure))

This should be enough to give you LSP support, syntax highlighting and error diagnostics. All of this already bundled on GNU Emacs!


Links to this article


Articles from blogs I follow around the net

The four tenets of SOA revisited

Twenty years after. In the January 2004 issue of MSDN Magazine you can find an article by Don Box titled A Guide to Developing and Running Connected Systems with Indigo. Buried within the (now dated) discussion of the technology…

via ploeh blog March 4, 2024

Building a demo of the Bleichenbacher RSA attack in Rust

Recently while reading Real-World Cryptography, I got nerd sniped1 by the mention of Bleichenbacher's attack on RSA. This is cool, how does it work? I had to understand, and to understand something, I usually have to build it. Well, friends, that is what…

via ntietz.com blog March 4, 2024

How to unbreak Dolphin on SteamOS after the QT6 update

A recent update to Dolphin made it switch to QT6. This makes it crash with this error or something like it: dolphin-emu: symbol lookup error: dolphin-emu: undefined symbol: _Zls6QDebugRK11QDockWidget, version Qt_6 This is fix…

via Xe Iaso's blog March 3, 2024

Generated by openring