Skip to content

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

@willfaught

Description

@willfaught

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions