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/go: make error message more readable #3075

Closed
dlintw opened this issue Feb 20, 2012 · 9 comments
Closed

cmd/go: make error message more readable #3075

dlintw opened this issue Feb 20, 2012 · 9 comments
Milestone

Comments

@dlintw
Copy link

dlintw commented Feb 20, 2012

I'm trying to use the tip version Go to test Go version 1 functions.
In vim,
when I make, it will display error message then jump to the error line.

for this old code

package main
import (
  "http"
)

It will show an unfriendly editor/IDE error message like

http: /home/dlin/prj/golang/gowiki/wiki.go:4:2: package could not be found locally      
                 

The problem is: there are extra "http: " before the line number show, that let
vim can't jump to correct position.

Other messages work well. for example,

/home/dlin/prj/golang/gowiki/wiki.go:18: undefined: os.Error


What steps will reproduce the problem?

1. go build wiki.go

What is the expected output?

/home/dlin/prj/golang/gowiki/wiki.go:4:2: package 'http' could not be found locally   

What do you see instead?

http: /home/dlin/prj/golang/gowiki/wiki.go:4:2: package could not be found locally      
                 

Which compiler are you using (5g, 6g, 8g, gccgo)?

go

Which operating system are you using?

Archlinux x86_64

Which revision are you using?  (hg identify)

217f1b9183cd

Please provide any additional information below.
@dsymonds
Copy link
Contributor

Comment 1:

It's worth pointing out that this is not just for vim, but for any editor that supports
the standard "quickfix" error format.
Unfortunately, it looks like this error is coming via the net/http package (why?), which
is the source of the "http: " prefix. It might be quite tricky to cleanly remove that
prefix except by using some late-stage hacking.

Labels changed: added priority-go1, removed priority-triage.

Owner changed to @rsc.

@dsymonds
Copy link
Contributor

Comment 3:

Summary change is fine as long as "readable" is in the "machine-readable" sense.

@rsc
Copy link
Contributor

rsc commented Feb 22, 2012

Comment 4:

It is in the human-readable sense.  The error makes no sense to humans either right now.
 The leading http: is because it is complaining about import "http", but no one can
tell.  If I make it human-readable, the dumb machines will understand it too.

Status changed to Accepted.

@dsymonds
Copy link
Contributor

Comment 5:

Okay, that's a different angle on the same bug, then. The original report was about the
error not being machine readable because of the leading "http: ".
For me, at least, the current error gives me an accurate line number, and I can go see
what's on that line and match it up with "package could not be found locally", so in
that sense it's perfectly human-readable. I can't, however, push the error through vim
and let it take me to the right line automatically, hence it is not machine-readable.
I guess both birds will be killed with the same stone, whether the stone is thrown by a
human or a machine.

@rsc
Copy link
Contributor

rsc commented Feb 22, 2012

Comment 6:

You are focusing on quite possibly the least important problem with
this error.  They will all be fixed.

@dsymonds
Copy link
Contributor

Comment 7:

The reporter of this issue complained this error mucked up vim's
quickfix; for him, machine-readability was the *only* problem with it.
The same applies to me.

@rsc
Copy link
Contributor

rsc commented Feb 22, 2012

Comment 8:

I said I would fix it.

@robpike
Copy link
Contributor

robpike commented Feb 27, 2012

Comment 9:

You learn something every day.  Quickfix invented the syntax of error messages on Unix.
I had no idea.

@rsc
Copy link
Contributor

rsc commented Mar 2, 2012

Comment 10:

I am not sure why this is still open.  Fixed by the big bug busting CL.

Status changed to Fixed.

@rsc rsc added this to the Go1 milestone Apr 10, 2015
@rsc rsc removed the priority-go1 label Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
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

5 participants