当运行时,LiteIDE将GOROOT设置为GOPATH。

huangapple go评论69阅读模式
英文:

liteide setting GOROOT to GOPATH when run

问题

在开发会话中,这种愚蠢的行为突然发生了,现在看起来是永久的。我不知道发生了什么事情:

[dtrombley@sleet bin]$ echo $GOROOT
/usr/lib/golang
[dtrombley@sleet bin]$ echo $GOPATH
/home/dtrombley/go/
[dtrombley@sleet bin]$ ./liteide

liteide构建错误:

../../github.com/Sirupsen/logrus/writer.go:4:2: 无法找到包 "bufio",在以下任何位置都找不到:
/home/dtrombley/go/src/bufio (来自 $GOROOT)
/home/dtrombley/go/src/bufio (来自 $GOPATH)

什么?为什么它在使用GOPATH而不是GOROOT?这以前是可以工作的,而且在liteide运行期间神秘地从一个构建到下一个(几秒钟后)就变成了错误...

有人见过这种情况吗?我能在liteide中检查/设置GOROOT的方法吗?

[编辑] 更奇怪的是:我以为GOPATH末尾的斜杠可能会引起混淆,所以我将其删除。现在:

[dtrombley@sleet bin]$ echo $GOROOT
/usr/lib/golang
[dtrombley@sleet bin]$ echo $GOPATH
/home/dtrombley/go
[dtrombley@sleet bin]$ ./liteide
...

警告:设置为GOROOT的GOPATH(/home/dtrombley/go)没有效果
../../github.com/Sirupsen/logrus/writer.go:4:2: 无法找到包 "bufio",在以下任何位置都找不到:
/home/dtrombley/go/src/bufio (来自 $GOROOT)
($GOPATH未设置)

痛苦。

英文:

In the middle of a development session, this stupid behavior started and now it looks permanent. I have no idea what happened:

[dtrombley@sleet bin]$ echo $GOROOT
/usr/lib/golang
[dtrombley@sleet bin]$ echo $GOPATH
/home/dtrombley/go/
[dtrombley@sleet bin]$ ./liteide

liteide build error:

 ../../github.com/Sirupsen/logrus/writer.go:4:2: cannot find package "bufio" in any of:
/home/dtrombley/go/src/bufio (from $GOROOT)
/home/dtrombley/go/src/bufio (from $GOPATH)

What? Why is it using GOPATH in place of GOROOT? This used to work, and mysteriously switched to broken while liteide was running, from one build to the next, literally a few seconds later...

Has anyone seen this? Is there some way I can inspect/set the GOROOT within liteide?

[Edit] Further weirdness: I thought the / at the end of GOPATH might be confusing it, so I removed that. Now:

 [dtrombley@sleet bin]$ echo $GOROOT
 /usr/lib/golang
 [dtrombley@sleet bin]$ echo $GOPATH
 /home/dtrombley/go
 [dtrombley@sleet bin]$ ./liteide

...

warning: GOPATH set to GOROOT (/home/dtrombley/go) has no effect
../../github.com/Sirupsen/logrus/writer.go:4:2: cannot find package "bufio" in any of:
/home/dtrombley/go/src/bufio (from $GOROOT)
($GOPATH not set)

Misery.

答案1

得分: 2

你可以在/usr/share/liteide/liteenv/linux*.env中检查是否设置了GOROOT(这可能是一个问题,如此处所述)。
你还可以检查是否在其他地方设置了GOROOT,如此处所述

最后,检查是否使用最新的liteide(x27.2.1)仍然存在该问题。


OP BadZen评论中确认

> 在会话中间它切换了,因为我可能误点击并将目标从linux64切换到了linux32 - linux32.env中有有问题的GOROOT条目(GOROOT=$HOME/go)。

英文:

You can check if GOROOT is set at all in /usr/share/liteide/liteenv/linux*.env (which can be an issue as reported in here)
You can also check if GOROOT is set in other place as well.

Finally check if the issue persists with the latest liteide (x27.2.1).


The OP BadZen confirms in the comments:

> It switched in the middle of the session because I must have stray clicked and switched my target from linux64 to linux32 - the linux32.env had the buggy GOROOT entry (GOROOT=$HOME/go).

huangapple
  • 本文由 发表于 2015年5月8日 14:28:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/30117155.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定