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

gopath is set, but still show "MarGo: Missing required environment variables: GOPATH" #520

Closed
warmwine opened this issue Apr 1, 2014 · 6 comments

Comments

@warmwine
Copy link

warmwine commented Apr 1, 2014

GoSublime Sanity Check

| install state: done
| sublime.version: 3059
| sublime.channel: stable
| about.ann: a14.02.25-1
| about.version: r13.12.26-3
| version: r13.12.26-3
| platform: osx-x64
| ~bin: ~/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/osx-x64/bin
| margo.exe: ~bin/gosublime.margo_r13.12.26-3_go1.2.1.exe (ok)
| go.exe: /usr/local/go/bin/go (ok)
| go.version: go1.2.1
| GOROOT: /usr/local/go
| GOPATH: /usr/local/go
| GOBIN: (not set) (should usually be (not set))
| set.shell: []
| env.shell: /bin/zsh
| shell.cmd: ['/bin/zsh', '-l', '-c', '${CMD}']
| error log: ** 2014-04-01 17:49:58.773175 **:
| > MarGo: Missing required environment variables: GOPATH
| > See the Quirks section of USAGE.md for info
| > --------------------------------

sanity shows me this.
obviousely, gopath has been set.

but gofmt and gocode still doesnt work. why?

@DisposaBoy
Copy link
Owner

GOPATH should not be set to GOROOT

@DisposaBoy
Copy link
Owner

re-open if this is still an issue

@hydrox
Copy link

hydrox commented Jun 22, 2014

Might just be me doing stuff wrong, but i get that error too

GoSublime Sanity Check

| install state: done
| sublime.version: 3059
| sublime.channel: stable
| about.ann: a14.02.25-1
| about.version: r13.12.26-3
| version: r13.12.26-3
| platform: linux-x64
| ~bin: ~/.config/sublime-text-3/Packages/User/GoSublime/linux-x64/bin
| margo.exe: ~bin/gosublime.margo_r13.12.26-3_go1.2.exe (ok)
| go.exe: ~/go/bin/go (ok)
| go.version: go1.2
| GOROOT: ~/go
| GOPATH: ~/git/go
| GOBIN: (not set) (should usually be (not set))
| set.shell: []
| env.shell: /bin/zsh
| shell.cmd: ['/bin/zsh', '-l', '-c', '${CMD}']
| error log: ** 2014-06-22 16:31:51.330914 **:
| > MarGo: Missing required environment variables: GOPATH
| > See the Quirks section of USAGE.md for info
| > --------------------------------

@ghost
Copy link

ghost commented Feb 6, 2015

I have the same error on windows.
My GOPATH and GOROOT is set in the environment + sublime settings.
It seems like sublime doesn't see the environment variables.
And the started shell also doesn't see them.

I tried setting the shell like this:

"shell": ["set GOPATH=c:\\users\\inando\\go", "$CMD"]

But that didn't help

GoSublime Sanity Check

|   install state: done
| sublime.version: 3065
| sublime.channel: stable
|       about.ann: a14.02.25-1
|   about.version: r14.12.06-1
|         version: r14.12.06-1
|        platform: windows-x64
|            ~bin: ~\AppData\Roaming\Sublime Text 3\Packages\User\GoSublime\windows-x64\bin
|       margo.exe: ~bin\gosublime.margo_r14.12.06-1_go1.4.1.exe (ok)
|          go.exe: c:\tools\go\bin\go.exe (ok)
|      go.version: go1.4.1
|          GOROOT: c:\tools\go
|          GOPATH: c:\users\inando\go
|           GOBIN: (not set) (should usually be `(not set)`)
|       set.shell: []
|       env.shell: 
|       shell.cmd: ['C:\\Windows\\system32\\cmd.exe', '/C', '${CMD}']
|       error log: ** 2014-11-12 15:06:44.153738 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2014-12-11 16:28:03.310802 **:
|                > MarGo: MarGo build failed
|                > cmd: `['', 'build', '-v', '-x', '-o', 'gosublime.margo_r14.12.06-1_go?.exe', 'gosubli.me/margo']`
|                > stdout: ``
|                > stderr: ``
|                > exception: `Cannot find command `go``
|                > --------------------------------
|                > 
|                > ** 2015-01-12 08:54:55.697966 **:
|                > MarGo: MarGo build failed
|                > cmd: `['', 'build', '-v', '-x', '-o', 'gosublime.margo_r14.12.06-1_go?.exe', 'gosubli.me/margo']`
|                > stdout: ``
|                > stderr: ``
|                > exception: `Cannot find command `go``
|                > --------------------------------
|                > 
|                > ** 2015-01-30 08:47:19.043384 **:
|                > MarGo: MarGo build failed
|                > cmd: `['', 'build', '-v', '-x', '-o', 'gosublime.margo_r14.12.06-1_go?.exe', 'gosubli.me/margo']`
|                > stdout: ``
|                > stderr: ``
|                > exception: `Cannot find command `go``
|                > --------------------------------

@dufferzafar
Copy link

I am having the exact same error!

GoSublime Sanity Check

|   install state: done
| sublime.version: 3065
| sublime.channel: stable
|       about.ann: a14.02.25-1
|   about.version: r14.12.06-1
|         version: r14.12.06-1
|        platform: linux-x64
|            ~bin: ~/.config/sublime-text-3/Packages/User/GoSublime/linux-x64/bin
|       margo.exe: ~bin/gosublime.margo_r14.12.06-1_go1.2.1.exe (ok)
|          go.exe: /usr/bin/go (ok)
|      go.version: go1.2.1
|          GOROOT: /usr/lib/go
|          GOPATH: ~/.go
|           GOBIN: (not set) (should usually be `(not set)`)
|       set.shell: []
|       env.shell: /bin/bash
|       shell.cmd: ['/bin/bash', '-l', '-c', '${CMD}']
|       error log: ** 2014-12-22 11:22:56.118648 **:
|                > MarGo: MarGo build failed
|                > cmd: `['', 'build', '-v', '-x', '-o', 'gosublime.margo_r14.12.06-1_go?.exe', 'gosubli.me/margo']`
|                > stdout: ``
|                > stderr: ``
|                > exception: `Cannot find command `go``
|                > --------------------------------
|                > 
|                > ** 2014-12-22 11:22:56.140576 **:
|                > MarGo: Missing required environment variables: GOROOT GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2014-12-22 11:24:15.257656 **:
|                > MarGo: MarGo build failed
|                > cmd: `['', 'build', '-v', '-x', '-o', 'gosublime.margo_r14.12.06-1_go?.exe', 'gosubli.me/margo']`
|                > stdout: ``
|                > stderr: ``
|                > exception: `Cannot find command `go``
|                > --------------------------------
|                > 
|                > ** 2014-12-22 11:24:15.266585 **:
|                > MarGo: Missing required environment variables: GOROOT GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-04 15:29:43.919908 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-04 15:57:13.754798 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-11 18:52:36.217379 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-11 19:22:41.239382 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-12 21:04:56.213233 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-12 23:45:22.089024 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-13 00:13:26.349981 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-13 00:27:44.971559 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-13 11:37:49.137365 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-13 22:00:54.692971 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-18 14:22:57.733281 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-18 15:11:12.169196 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------
|                > 
|                > ** 2015-05-19 20:39:09.922344 **:
|                > MarGo: Missing required environment variables: GOPATH
|                > See the `Quirks` section of USAGE.md for info
|                > --------------------------------

@bsed
Copy link

bsed commented Nov 14, 2015

{
    // The maximum amount of memory(MiB) that MarGo is allowed to use
    "margo_oom": 1000,

    // you may set specific environment variables here
    // e.g "env": { "PATH": "$HOME/go/bin:$PATH" }
    // in values, $PATH and ${PATH} are replaced with
    // the corresponding environment(PATH) variable, if it exists.
    "shell": ["/usr/bin/zsh"],
    "env": {
        // "GOPATH": "$GS_GOPATH;$GOPATH",
        "GOPATH": "$HOME/gocode", 
        "PATH": "$PATH:$GOROOT/bin:$GOPATH/bin",
        "GOROOT": "$HOME/go",
        //"GOBIN": "$HOME/go/bin"
        },


    // if set, whenever possible `GOPATH` will be set to `GS_GOPATH`.
    // please see `Usage & Tips` `ctrl+dot,ctrl+2`
    // section `Per-project  settings & Project-based GOPATH` for details about `GS_GOPATH`
    "use_gs_gopath": false,

    // Your shell. e.g. on Linux and OS X, if your shell bash:
    // you may set it to ["/bin/bash", "--login", "-c", "$CMD"]
    // it's useful to pass the --login argument in order for it run your ~/.bashrc etc.
    // otherwise environment variables may not be seen by Sublime Text and therefore GoSublime
    //
    // If set, commands are passed to it instead of the Python default which for *nix is usually
    // /bin/sh which in most cases is not what you want
    //
    // the special entry "$CMD" is replaced by the actual command


    // whether or not pkg files should be automatically saved when necessary (e.g. when running 9o `replay` or `go test` commands)
    "autosave": true,

    // Whether or not gscomplete(gocode) is enabled
    "gscomplete_enabled": true,

    // Whether or not gsfmt is enabled
    "fmt_enabled": true,

    // whether or not to indent with tabs (alignment is always done using spaces)
    "fmt_tab_indent": true,

    // the assumed width of the tab character (or number of spaces to indent with)
    "fmt_tab_width": 8,

    // by default fmt'ing is done by margo using `fmt_tab_intent` and `fmt_tab_width` (above)
    // you may use a command of your choosing by setting `fmt_cmd`
    // e.g. ["goimports"]
    // the command will be passed, to its stdin, the contents of the file
    // it must output the new file contents
    "fmt_cmd": [],

    // Whether or not gslint is enabled
    "gslint_enabled": true,

    // filter the kinds of lint checks that are done. supported kinds:
    //
    // gs.syntax - parser/syntax errors - it makes no sense to filter this as it will simply
    //             manifest itself in other checks (which will likely not be done if there are syntax errors)
    // gs.flag.parse - check for possibly missing calls to flag.Parse()
    // gs.types - do a typecheck using the go/types package(like the old gotype)
    //            disabled by default until it's ready(copied from tip)
    "lint_filter": [
        "gs.flag.parse",
        "gs.types"
    ],

    // Whether or not comp lint is enabled (this might conflict with gslint)
    "comp_lint_enabled": true,

    // The list of commands that comp-lint will run (in the order specified)
    // each entry contains a map of:
    //    cmd: a list containing the command and its args
    //    shell: whether or not use the $shell to run this command
    //        if you don't need $shell features then don't set this.
    //    global: whether or not commands like go install should affect the system globally
    //        by default the environment variable GOBIN is set to ($TEMPDIR/GoSublime/bin
    //        which in the installation of commands via comp-lint going there instead of into
    //        one of your GOPATHs.
    //        setting this to true, you can e.g automate the actual installation of your commands
    // additionally, for `shell` and `global` if the value is not `true` then it's assumed to be false
    "comp_lint_commands": [
        // run `golint` on all files in the package
        // "shell":true is required in order to run the command through your shell (to expand `*.go`)
        // also see: the documentation for the `shell` setting in the default settings file ctrl+dot,ctrl+4
        {"cmd": ["golint *.go"], "shell": true},

        // run go vet on the package
        {"cmd": ["go", "vet"]},

        // run `go install` on the package. GOBIN is set,
        // so `main` packages shouldn't result in the installation of a binary
        {"cmd": ["go", "install"]}
    ],

    // how long to wait after the last keystroke before the gslint_cmd command is run (in milliseconds)
    "gslint_timeout": 100,

    // Not Implemented
    // Whether or not gslint is enabled
    "lint_enabled": true,

    // Not Implemented
    // list of linters to run
    // note: before the linters are run, the builtin gs.syntax linter is run
    //       * its purpose is to do a basic syntax check on the active file.
    //       * by design, it cannot be disabled
    //       * if there is a syntax error, no user-defined linters will be run
    //
    // each linter is an object of the form:
    //
    // {
    //  "ctx": "", // the context in which this linter runs, e.g. "live"
    //             // default: "live", builtin contexts:
    //             //      live: the linters are being called while you're editing the file
    //             //      save: the linters are being called after saving.
    //             //            this can be used to e.g. rebuild or install the pkg
    //
    //  "pat": "", // a regexp pattern that will define the following named variables:
    //             // fn: the filename
    //             // line: the line number (starting from 1)
    //             // column: the column number (starting from 1)
    //             //         (this can be considered optional because the error message is still useful without it)
    //             // message: the error message
    //             //
    //             // the default pat will be defined[1] such that it matches `main.go:1:2 error` resulting in:
    //             //     fn: main.go
    //             //     line: 1
    //             //     column: 2
    //             //     message: error
    //             //
    //             //  The following regexp is a copy of the one used in MarGo (it might be out-of-sync)
    //             //      `(?P<fn>\S+\.go):(?P<line>\d+)?(?:[:](?P<column>\d+))?[:]*(?P<message>.+)`
    //             //
    //             // it will also allow `line` and `column` to be missing. this should be sufficient
    //             // for the output of the go tools (go vet, compilers, etc.)
    //
    //  "env": "", // an object mapping keys to string values that will be added to the default env
    //             // you could, e.g. set {"GOBIN": "/tmp"} in order to avoid installing potentially
    //             // broken commands into your GOPATH*/bin
    //
    //  "kind": "", // a string that identifies the linter, e.g. `go.vet'
    //              // this is useful to be able to identify what kind of error you're seeing,
    //              // but is otherwise optional
    //
    //  "cmd": [], // the command to run, e.g. ["go", "vet"]
    // }
    //
    // the minimal linter is thus: {"cmd": ["go", "vet"]}
    //
    // builtin linters:
    //    {"cmd": ["gs.flag.parse"]}: try to report calls to e.g. flag.Int(),flag.String()
    //                                for which there is no call to flag.Parse()
    //
    //    {"cmd": ["gs.types"]}: this is essentially `gotype`, it will do a full typecheck of the pkg
    //                           similar to the compilers. it's faster than doing a full `go build`
    //                           however, it can lead to false-positive errors, especially on cgo
    //                           and other non-pure-go pkgs
    "linters": [],

    // whether or not to include snippets in the auto-completion list
    "autocomplete_snippets": true,

    // whether or not to include Test*, Benchmark* and Example* functions in the auto-completion list
    "autocomplete_tests": false,

    // whether or not builtin types and functions should be shown in the auto-completion list
    "autocomplete_builtins": false,

    // whether or not to show an expanded(closure) version of func types in the auto-completion list
    // e.g. `type Fun func(i int)`
    // will result in two entries `Fun` and `Fun {}`
    // expanding to `Fun` and `func(i) {...}` respectively
    "autocomplete_closures": false,

    // you may set this to a regexp which will be used to filter entries in the auto-completion list
    // e.g. "autocomplete_filter_name": "^autogenerated_" will prevent any type or function
    // whose name begins with "autogenerated_" from appearing in the auto-completion list
    "autocomplete_filter_name": "",

    // whether or not autocomplete should suggest possible imports when autocomplete fails to
    // find a match.
    // note: this feature only comes into effect when autocomplete was triggered after a dot, e.g. `fmt.|`
    "autocomplete_suggest_imports": false,

    // whether or not to show function call tip in the status bar
    // the same can be achieved ctrl+dot,ctrl+space using an output panel
    "calltips": true,

    // whether or not to use named imports when the basename of the import path doesn't match the pkg name
    // e.g. gosubli.me/go-foo would be imported as:
    //     import (
    //         foo "gosubli.me/go-foo"
    //     )
    "use_named_imports": false,

    // whether or not MarGo may automatically run `go install` for packages that are missing
    // when you `import`, or `autocomplete` them
    "autoinst": true,

    // commands to run on (post) save - list of objects of the form {"cmd": "...", "args": {...}}
    // Any TextCommand may be run. Supported GS commands include:
    //     gs_comp_lint - compile the pkg and report any errors
    "on_save": [
        // run comp-lint when you save,
        // naturally, you can also bind this command `gs_comp_lint`
        // to a key binding if you want
        {"cmd": "gs_comp_lint"}
    ],

    // as an alternative to Sublime Text's snippet system you may add snippets to GoSublime's
    // code-completion by adding them to your user settings in the same format as bellow.
    //
    // "snippets": [
    //     {
    //         "match": {"global": true}, // these snippets will only be presented in the global scope
    //         "snippets": [
    //             {"text": "init", "title": "func init()", "value": "func init() {\n\t$1\n}"}
    //         ]
    //     },
    //     {
    //         "match": {"local": true}, // these snippets will only be present in a function scope
    //         "snippets": [
    //             {"text": "print", "title": "print(...)", "value": "print($1)"},
    //             {"text": "println", "title": "println(...)", "value": "println($1)"}
    //         ]
    //     }
    // ]
    //
    // you maybe add field markers ($1, $2, etc) to the `value` string to dictate where the cursor is place
    // once a completion is expanded and where it's placed once you press tab afterwards.
    // duplicate markers e.g f("...", $1, $1) will result in multiple cursors, one for each duplication.
    "snippets": [],

    "default_snippets": [
        {
            "match": {"global": false, "pkgname": ""},
            "snippets": [
                {"text": "package ${default_pkgname}", "title": "", "value": "package ${default_pkgname}\n\n$1\n"}
            ]
        },
        {
            "match": {"global": true, "pkgname": "^main$"},
            "snippets": [
                {"text": "func main", "title": "func main {...}", "value": "func main() {\n\t$0\n}\n"}
            ]
        },
        {
            "match": {"global": true, "pkgname": "."},
            "snippets": [
                {"text": "import", "title": "import (...)", "value": "import (\n\t\"$1\"\n)"},
                {"text": "func", "title": "func {...}", "value": "func ${1:name}($2)$3 {\n\t$0\n}"},
                {"text": "var", "title": "var (...)", "value": "var (\n\t$1\n)"},
                {"text": "const", "title": "const (...)", "value": "const (\n\t$1\n)"},
                {"text": "init", "title": "func init()", "value": "func init() {\n\t$1\n}"},
                {
                    "text": "func http handler",
                    "title": "func(rw, req)",
                    "value": "func ${1:name}(rw http.ResponseWriter, req *http.Request) {\n\t$0\n}"
                }
            ]
        },
        {
            "match": {"global": true, "pkgname": ".", "has_types": true},
            "snippets": [
                {
                    "text": "func (*${typename})",
                    "title": "func (...) {...}",
                    "value": "func (${1:${typename_abbr}} ${2:*}${typename}) ${3:name}($4)$5 {\n\t$0\n}"
                }
            ]
        },
        {
            "match": {"local": true},
            "snippets": [
                {"text": "func", "title": "func{...}()", "value": "func($1) {\n\t$0\n}($2)"},
                {"text": "var", "title": "var [name] [type]", "value": "var ${1:name} ${2:type}"}
            ]
        }
    ],

    // whether or not 9o should ask Sublime Text to show(scroll to) the end of a command's output
    // by default it will attempt to show the beginning
    "9o_show_end": false,

    // if set, 9o will run in single-instance mode instead of per-pkg
    // the name can be any string, so you can e.g. set it per-project and maintain project-specific
    // command history
    "9o_instance": "",

    // if set 9o will use the specified color scheme.
    // the path must relative to `Packages` e.g. `Packages/My/9o Specific.tmTheme`
    // `""` essentially means no color_scheme (like the Sublime Text console)
    // `"default"` leaves it as-is, i.e. matching the color_scheme that's being used for your other views
    "9o_color_scheme": "default",

    // a mapping of names to string commands e.g. `{"ci": "git ci $_args"}`
    // the environment variable `$_args` will be the raw, un-parsed argument passed to the command such that,
    // in the command `ci a.go    b.go`, `$_args` will be `a.go    b.go`
    // and the alias above expands to `git ci a.go    b.go`
    //
    // aliases are resolved recursively so they can be re-used, however recursive aliases are not supported.
    // e.g. if you define an alias `"gs-git": "git --git-dir=... $_args"`,
    // it will be used in the alias `"gs-ci": "gs-git commit $_args"`
    // but an alias `"git": "git $_args"` will fail because it resolves to itself.
    // you can, however create the alias `"git": "$HOME/git/bin/git"` which allows you to add commands
    // to 9o without them needing to appear in your $PATH
    //
    // examples
    // {
    //      "git": "/usr/bin/git $_args", // call git directly, otherwise it's run through your `shell`
    //      "ci": "git commit $_args",
    //      "ci.": "ci $_fn", // $_fn points to the abs path of the current file
    //      "gro": "sh grep $_args 2>/dev/null", // call grep through your shell and discard stderr
    // }
    //
    "9o_aliases": {},

    // what 9o command to run when (super or )ctrl+dot,ctrl+b us pressed
    // e.g. ["go", "build"]
    // the 9o command ^1 recalls the last command you ran manually
    // see 9o help(ctrl+9 "help") for more details about what commands are supported
    "build_command": ["^1"],

    "auto_complete_triggers": [ {"selector": "source.go", "characters": "."} ],

    // exclude files with the listed prefixes from the file browsing palette (ctrl+dot,ctrl+m)
    "fn_exclude_prefixes": [".", "_"],

    // Automatically set the syntax file for the specificed file extensions to `GoSublime: HTML`
    // `GoSublime: HTML` files are html files with the template delimiters `{{` and `}}` tailored to
    // Go templates (text/template, html/template)
    // (`.gohtml` files are automatically set by the syntax definition)
    "gohtml_extensions": [".html.go"]
}

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

5 participants