My開発メモ

EmacsにGo開発環境をインストールする(Ubuntu 22.04)

M-x list-package でインストール。

go-mode

go-modeをインストールしたあとのドキュメント

Copyright 2013 The go-mode Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.

Author: The go-mode Authors
Version: 1.6.0
Keywords: languages go
Package-Requires: ((emacs “26.1”))
URL: https://github.com/dominikh/go-mode.el

This file is not part of GNU Emacs.

$ vi ~/.emacs.d/init.el
(autoload 'go-mode "go-mode" nil t)

gocodeというのが使われなくなったということで、 gocode やめます(そして Language Server へ)
以下を参考にしてインストールしてみる。

(参考) [2021年版] Emacs に Go の開発環境を整える

おこなったこと

$ go install golang.org/x/tools/gopls@latest             # Language Server
$ go install -v github.com/uudashr/gopkgs/cmd/gopkgs@latest     # goパッケージ

The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause
it to be interpreted differently than if it were the main module.

名前付きパッケージを提供するモジュールの go.mod ファイルには、1 つまたは
さらに置換ディレクティブを追加します。 原因となるディレクティブを含めてはいけません。
メインモジュールの場合とは異なるように解釈されます。

$ go install golang.org/x/tools/cmdgoimports@latest

カテゴリー: Emacs, memo, Ubuntu

タグ: Go, Go lang, go-mode, Go言語

カウント: 148