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: bad "cannot declare name" error after dot import #22076

mdempsky opened this issue Sep 28, 2017 · 2 comments


None yet
2 participants
Copy link

commented Sep 28, 2017

This package is valid, but cmd/compile rejects it with "cannot declare name bytes.Buffer":

package p

import . "bytes"

var _ Buffer // used import "bytes"

func f() {
        Buffer := 0
        _ = Buffer

This comment has been minimized.

Copy link
Member Author

commented Sep 28, 2017

This is similar to #22072, but likely easier to fix.

The root problem is when we have an assignment like x := y we're noding the left-hand side (x) like it's a general Go expression (using exprList), but then later we apply colasdefn to re-declare identifiers as appropriate.

Instead noder should probably apply colasdefn's logic directly to the package syntax AST.


This comment has been minimized.

Copy link

commented Sep 28, 2017

Change mentions this issue: cmd/compile: allow := to shadow dot-imported names

@gopherbot gopherbot closed this in f22ef70 Oct 5, 2017

@golang golang locked and limited conversation to collaborators Oct 5, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.