Search code examples
windowsgosublimetext2sublimetext3

How to setup Gosublime in sublime text 3 in Windows?


The main problem here is .. that I have installed the package control and also the gosublime plugin but it is not working. Also it is not working in the command prompt when I type go. It gives info proving that the go is installed correctly in path I am actually trying to use a separator to set paths for go and java simultaneously which I might be doing wrong.

ENVIRONMENT VARIABLE

Now in sublime text 3 i am receiving an error as

MarGo: Missing required environment variables: GOPATH | > See the Quirks section of USAGE.md for info

I went through this but it didnt help me

Sublime Text: "MarGo: Missing required environment variables: GOPATH"


Solution

  • You have to set the GOPATH environment variable to something like d:\myprojects\go. That's where your code and libraries will be stored.

    Your code should be located in a folder like d:\myprojects\go\src\github.com\pandey\coolproject.

    Relevant section from the docs:

    [...]

    Test your installation

    Check that Go is installed correctly by setting up a workspace and building a simple program, as follows.

    Create a directory to contain your workspace, $HOME/work for example, and set the GOPATH environment variable to point to that location.

    $ export GOPATH=$HOME/work You should put the above command in your shell startup script ($HOME/.profile for example) or, if you use Windows, follow the instructions above to set the GOPATH environment variable on your system.

    Next, make the directories src/github.com/user/hello inside your workspace (if you use GitHub, substitute your user name for user), and inside the hello directory create a file named hello.go with the following contents:

    [...]

    (https://golang.org/doc/install#testing)

    See the Go docs for more details, especially on how to do it on windows: https://golang.org/doc/install