Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/cmd/goimports: -srcdir rewrites paths in parser errors #14864

Closed
dominikh opened this issue Mar 18, 2016 · 3 comments
Closed

x/tools/cmd/goimports: -srcdir rewrites paths in parser errors #14864

dominikh opened this issue Mar 18, 2016 · 3 comments
Milestone

Comments

@dominikh
Copy link
Member

@dominikh dominikh commented Mar 18, 2016

Running goimports with the -srcdir flag on a file with invalid Go syntax will produce syntax errors with paths in the directory provided by -srcdir, not the actual file. This is arguably confusing, because now the error might refer to a file that doesn't exist.

$ echo "package" > /tmp/foo.go                 
$ goimports -srcdir /somewhere/else /tmp/foo.go
/somewhere/else/foo.go:1:9: expected 'IDENT', found 'EOF'

I would expect /tmp/foo.go:1:9 in the error output.

/cc @bradfitz

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jul 21, 2016

@dominikh, is this still an issue?

@dominikh
Copy link
Member Author

@dominikh dominikh commented Jul 21, 2016

The behaviour hasn't changed since my bug report. However, we handle it in go-mode now and I don't feel strongly about fixing it in goimports.

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jul 21, 2016

Okay, I'll close this then. It's a little gross to fix in goimports.

But re-open if needed later.

@bradfitz bradfitz closed this Jul 21, 2016
@golang golang locked and limited conversation to collaborators Jul 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.