[英]Godef not being found in a go-mode emacs session
我通過以下方式安裝了 godef
go get github.com/rogpeppe/godef
我安裝了 emacs go-mode,並在我的 .bashrc 中導出了以下內容:
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
godef 的意義在於
godef -h # appears to work.
如:
$ godef -h
usage: godef [flags] [expr]
-A print all type and members information
-a print public type and member information
-acme
use current acme window
-debug
debug mode
-f string
Go source filename
-i read file from stdin
-json
output location in JSON format (-t flag is ignored)
-o int
file offset of identifier in stdin (default -1)
-t print type information
當我在 emacs 會話中的文件中運行Cc Cd
時,它應該調用godef-describe
函數
https://github.com/dominikh/go-mode.el
我預計:
Integration with godef
godef-describe (C-c C-d) to describe expressions
godef-jump (C-c C-j) and godef-jump-other-window (C-x 4 C-c C-j) to jump to declarations
This requires you to install godef via go get github.com/rogpeppe/godef.
酷,一切就緒。 但是當我嘗試在 go 文件中使用 Cc Cd 時,我得到:
Could not run godef binary
我可以在命令行上運行它,並且它的定義正確。 發生了什么?
我發現:
M-x godoc
// then
godoc: OSReadDir // for example
生產
godoc: /bin/bash: go: command not found
這向我表明即使 godef 和 godoc 是在普通 shell 中找到的,但 emacs 中可能存在一些路徑問題? 我該如何檢查或修復?
又是這個:
https://askubuntu.com/questions/1045712/emacs-launched-from-favorites-doesnt-read-bashrc
如果您從 Ubuntu 啟動器啟動 emacs,它不會加載 .bashrc。
你必須打開一個終端,然后打電話
$ emacs
彈出的 emacs 將從你的 shell 繼承你的 .bashrc。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.