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

Comments

@dominikh
Copy link
Member

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

@dominikh, is this still an issue?

@dominikh
Copy link
Member Author

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

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

But re-open if needed later.

@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
Development

No branches or pull requests

3 participants