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: improve error message in initialization loop #16503

Closed
willfaught opened this issue Jul 26, 2016 · 8 comments
Closed

cmd/compile: improve error message in initialization loop #16503

willfaught opened this issue Jul 26, 2016 · 8 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@willfaught
Copy link
Contributor

willfaught commented Jul 26, 2016

Please answer these questions before submitting your issue. Thanks!

  • What version of Go are you using (go version)?

The current play.golang.org version.

  • What operating system and processor architecture are you using (go env)?

The current play.golang.org version.

  • What did you do?

See https://play.golang.org/p/ISPl1bA6OP:

package main

import (
    "fmt"
)

var x int = y

var y int = x

func main() {
    fmt.Println(x, y)
}
  • What did you expect to see?

This:

prog.go:7: initialization loop:
    prog.go:7 x refers to y
    prog.go:9 y refers to x
  • What did you see instead?

This:

prog.go:7: initialization loop:
    prog.go:7 x refers to
    prog.go:9 y refers to
    prog.go:7 x
@quentinmit quentinmit added this to the Go1.8 milestone Jul 26, 2016
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 26, 2016
@odeke-em
Copy link
Member

Could we update the title of this bug from

cmd/compile:

to something maybe like

cmd/compile: improve error message in initialization loop

because fixers can't easily search for it.

@davecheney davecheney changed the title cmd/compile: cmd/compile: improve error message in initialization loop Jul 30, 2016
@davecheney
Copy link
Contributor

Done. @adg @broady how about giving @odeke-em the commit bit so he can do this himself?

@bradfitz
Copy link
Contributor

@davecheney, @odeke-em, done.

@odeke-em
Copy link
Member

Wow, thanks @davecheney and @bradfitz!!

@griesemer
Copy link
Contributor

FWIW: Not sure making this more verbose helps much. If you read the messages together it's pretty clear, w/o repetition. But I defer to the sentiment of the majority here.

@rsc
Copy link
Contributor

rsc commented Oct 21, 2016

The current formatting is not a mistake.

@rsc rsc closed this as completed Oct 21, 2016
@willfaught
Copy link
Contributor Author

The issue isn't the formatting, it's the wording: it clearly doesn't make sense: "prog.go:7: x refers to prog.go:9: y refers to prog.go:7: x". If a cycle has two edges, it doesn't take three lines to describe it.

@griesemer
Copy link
Contributor

@willfaught It does with the current formatting which is less verbose. There's no need to change it.

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

8 participants