Skip to content

x/tools/cmd/goimports: imports current package when moving a package #12653

@mstoykov

Description

@mstoykov

A common case (for me at least) is for code to be written in a given package and than to be moved to another package.

Coping the code (+ changing the package) works great, but if the code was depending on the package it was moved into, go will die with import cycle.

Removing the package and running goimports adds it again - this for me happens on saving the file.

It seems reasonable that importing the current package is not desirable and in my setup (vim + vim-go) the file looks OK in vim even though it's not.

I propose goimports to remove(not add) the current package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions