sublime-config icon indicating copy to clipboard operation
sublime-config copied to clipboard

Cannot format golang file in sublime text

Open 7flash opened this issue 5 months ago • 1 comments

Traceback (most recent call last):
File "/Users/gur/Library/Application Support/Sublime Text/Installed Packages/Gofmt.sublime-package/gofmt.py", line 257, in run_formatter
formatter = Formatter(view)
File "/Users/gur/Library/Application Support/Sublime Text/Installed Packages/Gofmt.sublime-package/gofmt.py", line 166, in __init__
self.cmds = [Command(cmd, self.view, self.window) for cmd in cmds]
File "/Users/gur/Library/Application Support/Sublime Text/Installed Packages/Gofmt.sublime-package/gofmt.py", line 166, in <listcomp>
self.cmds = [Command(cmd, self.view, self.window) for cmd in cmds]
File "/Users/gur/Library/Application Support/Sublime Text/Installed Packages/Gofmt.sublime-package/gofmt.py", line 77, in __init__
self.window)
File "/Users/gur/Library/Application Support/Sublime Text/Lib/python33/golangconfig.py", line 227, in subprocess_info
raise exception
golangconfig.EnvVarError: The following environment variable is currently unset: GOPATH

I have added in my ~/.zshrc

export GOPATH=/usr/local/go
export PATH=$PATH:$GOPATH/bin

And added in Golang.sublime-settings

{
    "root": "/usr/local/go/bin"
}

7flash avatar Feb 01 '24 13:02 7flash