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: poor error for constant using missing import #26818

dsymonds opened this issue Aug 5, 2018 · 1 comment

cmd/compile: poor error for constant using missing import #26818

dsymonds opened this issue Aug 5, 2018 · 1 comment


Copy link

@dsymonds dsymonds commented Aug 5, 2018

Please answer these questions before submitting your issue. Thanks!

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


Does this issue reproduce with the latest release?

I haven't checked, but the playground says it is running Go 1.10.3.

What did you do?

package main

import (

func main() {
	const delay = 5 * time.Second

What did you expect to see?

One error, pointing out that I didn't import "time".

What did you see instead?

Two errors, one of which is misleading:

prog.go:8:8: const initializer 5 * time.Second is not a constant
prog.go:8:20: undefined: time

The first error is outright wrong if the "time" package was imported, yet it was printed, and worse, it came first. The only useful error there is the second message.

@FiloSottile FiloSottile added this to the Go1.12 milestone Aug 6, 2018
Copy link

@odeke-em odeke-em commented Oct 18, 2018

Thank you for reporting this @dsymonds!

I'll kindly /cc @griesemer too

@odeke-em odeke-em self-assigned this Oct 18, 2018
@griesemer griesemer modified the milestones: Go1.12, Go1.13 Dec 11, 2018
@josharian josharian modified the milestones: Go1.13, Go1.14 Jun 3, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.