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

x/tools/cmd/goimports: mishandles named imports used under original name #11259

Closed
josharian opened this issue Jun 17, 2015 · 2 comments
Closed

Comments

@josharian
Copy link
Contributor

http://play.golang.org/p/gmQEUKYxrG

package main

import (
    "fmt"
    t "time"
)

func main() {
    fmt.Println("Hello, playground")
    time.Sleep(time.Second)
}

Run through imports, results in:

package main

import "fmt"

func main() {
    fmt.Println("Hello, playground")
    time.Sleep(time.Second)
}

Note that the named time import has been removed but not reinserted without the name. The resulting code does not compile. Running through goimports again fixes things.

Low priority corner case.

@josharian josharian added this to the Unreleased milestone Jun 17, 2015
@hectorj
Copy link

hectorj commented Nov 23, 2015

Seems like a duplicate of #8149, no?

@bradfitz
Copy link
Contributor

Yeah, looks like it.

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