constabulary/gb

Compiler errors emit paths which are not relative to project root

Closed this issue · 1 comments

Using :make or similar from vim is problematic, because the full path of the source file and line number are not what are emitted by gb when there is an error. For example

scott@savoy:~/code/experiments/go/gb> mkdir -p src/example
scott@savoy:~/code/experiments/go/gb> cat > src/example/main.go 
package main

import "fmt"

func main() {
    fmt.Println("vim-go")

    !! Error, oops
}
scott@savoy:~/code/experiments/go/gb> gb build
# example
main.go:8: syntax error: unexpected semicolon or newline, expecting := or = or comma
FATAL: command "build" failed: exit status 2
scott@savoy:~/code/experiments/go/gb> 

This is quite problematic, it prevents editors from parsing the output of the compiler.

Thanks for raising this issue.

The underlying problem is we execute the compiler in the working directory of the source being compiled. Part of this is legacy, the Go compiler does this then fixes up the output later, another part is a fear that very long paths would lead to HUGE argument lists and that would run afoul of various OS limitations.

We've had a few goes at trying to address this, including #97, #377.

This issue is most likely a duplicate of #406 so I'll close it and follow the discussion on 406.