Skip to content

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

@josharian

Description

@josharian

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions