First of all, this plugin seems amazing!
I have just one small issue with go
One of the linters ignores the /vendor directory in the root path so always complain that it can't find any import because they live in /vendor rather than $GOPATH
There is a pull request open for fixing go build issues which may address the problem you are having: https://github.com/w0rp/ale/pull/270 Some more work is needed on it before it will work.
@DAddYE A pull request has just been merged which thoroughly includes and copies a whole host of files. Could you check if this has fixed your issues?
I believe the work from @DiscoViking and @joshuarubin has fixed this now.
Thanks guys! Works now!
Unfortunately, vendor/ is a specific case that does not yet fully work. I'm trying to figure it out right now, but things keep getting more and more complicated with this linter...
Lets say we have this dir structure in your $GOPATH:
foo/
โโโ bar/
โย ย โโโ bar.go
โโโ baz/
โย ย โโโ baz.go
โโโ foo.go
โโโ vendor/
โย ย โโโ qux/
โย ย โ โ qux.go
Lets say foo/bar/bar.go has this:
type Bar struct {
Qux qux.Qux
}
And foo/baz/baz.go has this:
type Baz struct {
Qux qux.Qux
}
And foo/foo.go has this:
var f bar.Bar
var b baz.Baz
f.Qux = b.Qux
If we lint foo/bar/bar.go then the copied directory structure looks like this:
foo/
โโโ bar/
โย ย โโโ bar.go
โโโ foo.go
This will fail to build with the current linter.
The reason for this is that the copied structure is in the primary $GOPATH. It didn't get the vendor directory, so it may not build at all, but lets say that qux was in the secondary $GOPATH.
What the compiler actually sees is roughly this:
// foo/bar/bar.go
type Bar struct {
Qux $GOPATH.qux.Qux
}
// foo/baz/baz.go
type Baz struct {
Qux $GOPATH.foo.vendor.qux.Qux
}
And the failure is in foo/foo.go when executing f.Qux = b.Qux which fails because they are not the same type.
I've been racking my brain about how to fix this issue. There is no issue unless there is a vendor directory. However, how to handle copying all the necessary files is not trivial.
I can symlink the vendor directory easily.
The problem is how to identify all the packages that depend on packages in that vendor directory. Once they are identified, they all have to be copied to the lint directory too.
I'm going to take a break. Let me know if you guys come up with something.
@joshuarubin probably is worth opening a new issue. I would suggest give an option to use go install $(go list ./... | grep -v /vendor/) which will cache things ... go build currently doesn't (_however it's planned sometime this year_)