Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Golang build command used wrong $GOPATH #2390

Closed
ViliusN opened this issue Nov 5, 2019 · 5 comments
Closed

Golang build command used wrong $GOPATH #2390

ViliusN opened this issue Nov 5, 2019 · 5 comments

Comments

@ViliusN
Copy link

ViliusN commented Nov 5, 2019

When I try to build (or test/run) golang code, I get errors like this:

Demo.go:10:8: cannot find package "aaa/bbb" in any of:
	/usr/lib/go/src/aaa/bbb (from $GOROOT)
	/home/name/go/src/aaa/bbb (from $GOPATH)

The problem is, that "/home/name/go" is the default $GOPATH, and I am using some other path. And, yes, my $GOPATH variable is set correctly:

[name@computer ~]$ echo $GOPATH
/home/name/some/path/go

So, it seems that Geany is not actually reading $GOPATH variable, but is just using the default path.

@frlan
Copy link
Member

frlan commented Nov 5, 2019

How is geany started? What does env executed via Geany's run function say?

@ViliusN
Copy link
Author

ViliusN commented Nov 5, 2019

When I start Geany from terminal, go build works fine, and env shows correct $GOPATH. But when I start it from DE menu (XFCE Whisker), I have that problem I've described (go build gives an error, and env does not show $GOPATH).

Is set my $GOPATH in .bashrc script.

@frlan
Copy link
Member

frlan commented Nov 5, 2019

Xfce is not parsing .bashrc on startup, therefor Geany does not know about it. Put your export statement into .profile e.g. -- maybe configuring Geany to execute things inside VTE might work -- but unsure about.

@ViliusN
Copy link
Author

ViliusN commented Nov 5, 2019

I moved my "export $GOPATH=.." to .xprofile, and now it works fine. Thanks.

(I'm using Linux for almost 2 decades now, and I still have no clue how all these start-up scripts are supposed to work.. And I'm proud of it :D)

@frlan
Copy link
Member

frlan commented Nov 5, 2019

Actually, even though the knowledge of such things wont make world a better place, being proud of it is not the right answer IMHO ;D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants