Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Format removes imports of vendored packages in use #613

@sindrepm

Description

@sindrepm

I just upgraded to the latest version and discovered a bug. When I have imports like the following:

import (
   "github.com/xanzy/go-gitlab"
   "github.com/emicklei/go-restful"
)

Whenever I save the file, those import lines are removed even if they are referenced in the code. This has worked fine up until the last upgrade so not sure what has happened. From what I have found, it only applies to packages which contains a hyphen as shown above (e.g. "go-gitlab" and "go-restful").

I have been able to reference these packages just by the "gitlab" or "restful" names before, but now it seems that the goimports tool doesn't like that? If I alias the imports with "gitlab" or "restful" it works and the lines are not removed.

It is quite an annoying bug so hopefully this can be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions