gotests icon indicating copy to clipboard operation
gotests copied to clipboard

Do not overwrite "import groups" in the generate output

Open clamoriniere opened this issue 8 years ago • 1 comments

Currently if we when gotests generates tests on an existing test file, it rewrite completely the imports with a default ordering.

example:

package client

import (
   "fmt"
   "errors"

   "k8s.io/pkg/api"
)

// code here...

gotests output:

package client

import (
    "k8s.io/pkg/api"
    "fmt"
    "errors"
)

// code here...

it will be nice if "gotests" works like "goimport" and so the "import groups" are not remove.

clamoriniere avatar Nov 28 '16 19:11 clamoriniere

This is a known issue with gotests, but something that should be fixable. gotests uses golang.org/x/tools/imports under the hood just like goimports, so it's not clear to me why the import groups are removed.

cweill avatar Nov 29 '16 16:11 cweill