Skip to content
This repository has been archived by the owner on Jun 14, 2018. It is now read-only.

gofmt errors not reported/displayed on editor #14

Open
dkt1412 opened this issue Apr 5, 2016 · 2 comments
Open

gofmt errors not reported/displayed on editor #14

dkt1412 opened this issue Apr 5, 2016 · 2 comments

Comments

@dkt1412
Copy link

dkt1412 commented Apr 5, 2016

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:

  • go-plus / 4.1.0
  • autocomplete-go / 1.0.5
  • builder-go / 1.0.0
  • go-config /1.1.4
  • go-get / 1.0.3
  • gofmt / 1.1.3
  • gometalinter-linter / 1.1.0
  • gorename / 1.0.1
  • navigator-godef / 1.0.2
@joefitzgerald
Copy link
Owner

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
Copy link
Author

dkt1412 commented Apr 5, 2016

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants