golang / sublime-config

A library for Go environment configuration in Sublime Text
BSD 3-Clause "New" or "Revised" License
86 stars 24 forks source link

Cannot format golang file in sublime text #11

Open 7flash opened 8 months ago

7flash commented 8 months ago
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"
}
naveenpopclub commented 6 months ago

I am also facing same issue