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

duplicate directory in syntax check result

Open egonelbre opened this issue 7 years ago • 0 comments

I'm seeing this for the syntax error checks:

F:\Go\src\otsim.ee\otsim\F:\Go\src\otsim.ee\otsim\main_mobile.go:20:2: expected statement, found '.'
F:\Go\src\otsim.ee\otsim\F:\Go\src\otsim.ee\otsim\main_mobile.go:22:3: expected ';', found 'EOF'
F:\Go\src\otsim.ee\otsim\F:\Go\src\otsim.ee\otsim\main_mobile.go:22:3: expected '}', found 'EOF'

The reason is that, when you do

F:\Go\src\otsim.ee\otsim> cat main_mobile.go | goimports -srcdir=%CD%

F:\Go\src\otsim.ee\otsim\<standard input>:20:2: expected statement, found '.'
F:\Go\src\otsim.ee\otsim\<standard input>:22:4: expected '}', found 'EOF'

When <standard input> get's replaced with the file name there is a duplicate name.

There are two fixes to gotools_format.py:28:

# version 1
elif golangconfig.setting_value("format_backend")[0] in ["goimports", "both"] :
      command = "goimports"
      args = ["-e", "-srcdir=%s" % self.view.file_name()]

# version 2
elif golangconfig.setting_value("format_backend")[0] in ["goimports", "both"] :
      command = "goimports"
      args = ["-e"]

egonelbre avatar Apr 30 '17 12:04 egonelbre