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

cmd/compile: error points to nonexistent file #36437

Closed
rsc opened this issue Jan 7, 2020 · 5 comments
Closed

cmd/compile: error points to nonexistent file #36437

rsc opened this issue Jan 7, 2020 · 5 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jan 7, 2020

The x.go:0: here does not make much sense given that x.go does not exist.
It seems like it should be omitted, no?

$ go tool compile x.go
x.go:0: open x.go: no such file or directory

/cc @griesemer

@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 7, 2020
@rsc rsc added this to the Go1.15 milestone Jan 7, 2020
@griesemer griesemer self-assigned this Jan 7, 2020
@griesemer
Copy link
Contributor

Agreed.

@tandr
Copy link

tandr commented Jan 7, 2020

Curious - how many scripts/tools that parse compiler output and rely on the line start being file:linenumber will need to be modified?
There is no way to get structured output from the compiler (say, for example --json, that would produce all errors and warnings in a nicely parseable structured format). So tools are relying on compiler output parsing.

@beoran
Copy link

beoran commented Jan 8, 2020

FWIW, Geany has no problems with either the current behavior or the proposed x.go: open x.go: no such file or directory message. There's no file to open anyway. So I guess most other editors will be ok if they have smart enough compiler output parsers.

@gopherbot
Copy link

Change https://golang.org/cl/229357 mentions this issue: cmd/compile: omit non-existent file in error column prefix

@gopherbot
Copy link

Change https://golang.org/cl/230941 mentions this issue: cmd/compile: omit file:pos for non-existent errors

gopherbot pushed a commit that referenced this issue May 8, 2020
Omits printing the file:line:column when trying to
open non-existent files

Given:
    go tool compile x.go

* Before:
    x.go:0: open x.go: no such file or directory

* After:
    open x.go: no such file or directory

Reverts the revert in CL 231043 by only fixing the case
of non-existent errors which is what the original bug
was about. The fix for "permission errors" will come later
on when I have bandwidth to investigate the differences
between running with root and why os.Open works for some
builders and not others.

Fixes #36437

Change-Id: I9c8a0981ad708b504bb43990a4105b42266fa41f
Reviewed-on: https://go-review.googlesource.com/c/go/+/230941
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
xujianhai666 pushed a commit to xujianhai666/go-1 that referenced this issue May 21, 2020
Omits printing the file:line:column when trying to open either
* non-existent files
* files without permission

Given:
    go tool compile x.go

For either of x.go not existing, or if no read permissions:

* Before:
    x.go:0: open x.go: no such file or directory
    x.go:0: open x.go: permission denied

* After:
    open x.go: no such file or directory
    open x.go: permission denied

While here, noticed an oddity with the Linux builders, that appear
to always be running under root, hence the test for permission errors
with 0222 -W-*-W-*-W- can't pass on linux-amd64 builders.
The filed bug is golang#38608.

Fixes golang#36437

Change-Id: I9645ef73177c286c99547e3a0f3719fa07b35cb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/229357
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
@golang golang locked and limited conversation to collaborators Apr 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants