[英]Why would 'go build file.go' work fine at my local terminal, but give me an error over SSH?
When I run 'go build file.go' (or 'go install') at my local terminal (Konsole on ubuntu), my code builds correctly without any warnings. 当我在本地终端(ubuntu上的Konsole)上运行“ go build file.go”(或“ go install”)时,我的代码可以正确构建,而不会发出任何警告。 However, when I SSH (from another linux box or using PuTTY from Windows) into the exact same machine, I get the warning messages:
但是,当我通过SSH(从另一个Linux机器或从Windows使用PuTTY)进入完全相同的计算机时,我收到警告消息:
warning: GOPATH set to GOROOT (/home/[username]/go) has no effect go build runtime: linux/amd64 must be bootstrapped using make.bash
警告:GOPATH设置为GOROOT(/ home / [用户名] / go)不会影响构建运行时:linux / amd64必须使用make.bash引导
In terminal: 在终端:
'go version' reports go1.3.3 linux/amd64 'go version'报告go1.3.3 linux / amd64
'which go' reports /usr/local/go/bin/go “去哪儿”报告/ usr / local / go / bin / go
Over SSH: 通过SSH:
'go version' reports go1.2.1 linux/amd64 'go version'报告go1.2.1 linux / amd64
'which go' reports /home/[username]/go/bin/go “去哪儿”报告/ home / [用户名] / go / bin / go
Clearly your environment is different between your local (presumably GUI desktop) Ubuntu logon and your ssh logon. 显然,本地(可能是GUI桌面)Ubuntu登录和ssh登录之间的环境有所不同。
This isn't unexpected. 这并不意外。
SUGGESTION: 建议:
1) Type "env" from your local Konsole GUI terminal. 1)从本地Konsole GUI终端键入“ env”。 Make note of the environment variables that are particularly important to you: PATH, GOPATH, GOROOT, etc.
记下对您特别重要的环境变量:PATH,GOPATH,GOROOT等。
2) Edit your $HOME/.profile
file (aka ~/.profile
). 2)编辑
$HOME/.profile
文件(又名~/.profile
)。
Explicitly set those variables. 明确设置这些变量。
3) Try ssh again - see if there's any difference. 3)再试一次ssh-看看是否有任何区别。
See also: 也可以看看:
https://unix.stackexchange.com/questions/101168/set-environment-variable-automatically-upon-ssh-login-no-root-access https://unix.stackexchange.com/questions/101168/set-environment-variable-automatically-upon-ssh-login-no-root-access
You might also consider enabling remote VNC: 您可能还考虑启用远程VNC:
https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12 https://www.digitalocean.com/community/tutorials/how-to-setup-vnc-for-ubuntu-12
https://askubuntu.com/questions/304017/how-to-set-up-remote-desktop-sharing-through-ssh https://askubuntu.com/questions/304017/how-to-set-up-remote-desktop-sharing-through-ssh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.