joefitzgerald / gofmt

Atom Package For Running gofmt / goimports / goreturns
Other
4 stars 4 forks source link

gofmt errors not reported/displayed on editor #14

Open dkt1412 opened 8 years ago

dkt1412 commented 8 years ago

Gofmt seems to correctly catch any errors I introduce to my go code, but those errors don't seem to propagate to Atom's message panel. I know that gofmt is returning the errors because the errors show up in the Console tab of the Dev Tools.

For example, if I have the following code:

foo := []string{
   "a",
   "b"
}

On save, gofmt reports to the Console an error like this:

gofmt: (stderr) :134:6: missing ',' before newline in composite literal

However, I wouldn't see anything happen (not even formatting) without Dev Tools and the Atom status bar would report "No Issue" as well.

I am on Atom v1.5.4 and have the following packages installed:

joefitzgerald commented 8 years ago

builder-go should be picking that up. In general, format errors are build errors, so they would be duplicative if I also sent them to linter for display. The question is: why aren't you seeing them show up as a result of builder-go. If you create an errant file (disabling format on save for a moment) and then run go install . in the terminal, do you see the errors?

dkt1412 commented 8 years ago

Ah, that makes sense. Unfortunately (and I apologize for not making this clear earlier), my go code actually needs to get built with my company's internal libraries, and thus, we don't actually run go build/install to build our code. So, even if I run go install ., it won't even compile. I was mostly just looking for auto-formatting using gofmt/goimports.

So, the next curious thing for me is that I've now noticed that these build errors I expect to get would actually get displayed on files in one directory but not files in another sibling directory. For example, if I add the errant lines as above to files in dir A, I actually do see an error on the editor like this: gometalinter / warning / missing ',' before newline in composite literal (golint). If I copy the same errant file to dir B, I get "No Issues" displayed instead. Do you have any ideas why this would be the case? I've also ran golint <path to file> on dir A and dir B, and they both return the same error missing ',' before newline in composite literal.

I'm guessing this may be coming from the gometalinter, so I'm happy to move this thread to that repo if you'd like.