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

godoc parse error, but code compiles #530

Closed
petar opened this issue Jan 14, 2010 · 5 comments
Closed

godoc parse error, but code compiles #530

petar opened this issue Jan 14, 2010 · 5 comments

Comments

@petar
Copy link
Contributor

petar commented Jan 14, 2010

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?

I run godoc over my own source repository.

What is the expected output? What do you see instead?

I've noticed that godoc chokes when parsing this valid Go syntax:

type S struct { x,y int }

...

s = &S {
 x:5,
 y:6,   // this comma here throws it off
}


What is your $GOOS?  $GOARCH?

darwin,amd64

Which revision are you using?  (hg identify)

ffbf0900a20e+ tip

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

rsc commented Jan 14, 2010

Comment 1:

I think you have an old godoc lying around.
I'm not sure what you mean by chokes, but I added this
as a new file go/src/pkg/utf8/x.go:
package utf8
var T = &S{
    x: 5,
    y: 6,
}
and then when I run godoc utf8 T:
PACKAGE
package utf8
import "utf8"
VARIABLES
var T = &S{
    x: 5,
    y: 6,
}

Owner changed to r...@golang.org.

Status changed to WaitingForReply.

@petar
Copy link
Contributor Author

petar commented Jan 17, 2010

Comment 2:

A slightly trickier syntax reproduces the bug:
type S struct {
        x, y int
        c <-chan int
}
func main() {
        s := &S{
                x: 5,
                y: 7,
                c: (<-chan int)(make(chan int)),
        }
}

@rsc
Copy link
Contributor

rsc commented Jan 17, 2010

Comment 3:

Reproduced.
; cat x.go
package main
type S struct {
       x, y int
       c <-chan int
}
func main() {
       s := &S{
               x: 5,
               y: 7,
               c: (<-chan int)(make(chan int)),
       }
}
; gofmt x.go
x.go:12:22: expected expression
;
-> gri

Labels changed: added packagebug.

Owner changed to g...@golang.org.

Status changed to Accepted.

@griesemer
Copy link
Contributor

Comment 4:

Status changed to Started.

@griesemer
Copy link
Contributor

Comment 5:

This issue was closed by revision 6d8829e.

Status changed to Fixed.

Merged into issue #-.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
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

4 participants