问题
I've installed LiteIde and exported GOROOT
and GOPATH
in my .bashrc
. When I use LiteIDE, the auto-completion works just fine, but it can't build/run my code. When I look at 'Manage GOPATH', the System GOPATH box is empty, and I can't type into it either.
Looking up online, the solution seems to be - 'link' the GOPATH
and LiteIDE. How do I 'link' the two?
回答1:
Select the correct environment for you system from the drop-down:
For example, if you're on a Mac and used the package installer it would be "darwin64-local" on a 64 bit Mac.
Then click on the "Go" folder icon on the left of the drop-down.
Click "Add Directory..." and add a folder path that contains src
, pkg
, and bin
folders. Essentially what you set GOPATH
to.
Make sure you do not set GOROOT in .bashrc
at all. You don't need to set GOROOT, really.
回答2:
Follow the answer above, but then regarding the updated problems with the build path being incorrect:
If you "build" in Liteide then the executable gets put in the same file as your .go file.
But by clicking "install" in Liteide then the executable gets placed in the go workspace root bin folder as it should be.
You can still "run" the code from within Liteide if there is not the executable in the same folder as your .go file.
来源:https://stackoverflow.com/questions/18165881/how-to-link-gopath-to-liteide