195 lines
2.5 KiB
Plaintext
195 lines
2.5 KiB
Plaintext
exec gofumpt -w foo.go
|
|
cmp foo.go foo.go.golden
|
|
|
|
exec gofumpt -d foo.go.golden
|
|
! stdout .
|
|
|
|
-- go.mod --
|
|
module nodomainmod/mod1
|
|
|
|
go 1.16
|
|
-- foo.go --
|
|
package p
|
|
|
|
import (
|
|
"io"
|
|
"io/ioutil" // if the user keeps them in the top group, obey that
|
|
_ "io/ioutil"
|
|
|
|
_ "image/png"
|
|
|
|
"bufio" // the above is for a side effect; this one has a comment
|
|
)
|
|
|
|
import (
|
|
"os"
|
|
|
|
"foo.local/one"
|
|
|
|
bytes_ "bytes"
|
|
|
|
"io"
|
|
)
|
|
|
|
import (
|
|
"foo.local/two"
|
|
|
|
"fmt"
|
|
)
|
|
|
|
// If they are in order, but with extra newlines, join them.
|
|
import (
|
|
"more"
|
|
|
|
"std"
|
|
)
|
|
|
|
// We need to split std vs non-std in this case too.
|
|
import (
|
|
"foo.local"
|
|
"foo.local/three"
|
|
math "math"
|
|
)
|
|
|
|
import (
|
|
"x"
|
|
// don't mess up this comment
|
|
"y"
|
|
// or many
|
|
// of them
|
|
"z"
|
|
)
|
|
|
|
// This used to crash gofumpt, as there's no space to insert an extra newline.
|
|
import (
|
|
"std"
|
|
"non.std/pkg"
|
|
)
|
|
|
|
// All of the extra imports below are known to not belong in std.
|
|
// For example/ and test/, see https://golang.org/issue/37641.
|
|
import (
|
|
"io"
|
|
|
|
"example/foo"
|
|
"internal/bar"
|
|
"test/baz"
|
|
)
|
|
|
|
import (
|
|
"io"
|
|
|
|
"nodomainmod"
|
|
"nodomainmod/mod1/pkg1"
|
|
"nodomainmod/mod2"
|
|
"nodomainmodextra"
|
|
)
|
|
|
|
import (
|
|
"io"
|
|
|
|
"nodomainother/mod.withdot/pkg1"
|
|
)
|
|
|
|
// TODO: fix issue 225.
|
|
import (
|
|
"path/filepath"
|
|
"time"
|
|
"github.com/tinkerbell/tink/pkg/apis/core/v1alpha1"
|
|
"k8s.io/apimachinery/pkg/types"
|
|
"sigs.k8s.io/yaml"
|
|
)
|
|
-- foo.go.golden --
|
|
package p
|
|
|
|
import (
|
|
"io"
|
|
"io/ioutil" // if the user keeps them in the top group, obey that
|
|
_ "io/ioutil"
|
|
|
|
_ "image/png"
|
|
|
|
"bufio" // the above is for a side effect; this one has a comment
|
|
)
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
|
|
"foo.local/one"
|
|
|
|
bytes_ "bytes"
|
|
)
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"foo.local/two"
|
|
)
|
|
|
|
// If they are in order, but with extra newlines, join them.
|
|
import (
|
|
"more"
|
|
"std"
|
|
)
|
|
|
|
// We need to split std vs non-std in this case too.
|
|
import (
|
|
math "math"
|
|
|
|
"foo.local"
|
|
"foo.local/three"
|
|
)
|
|
|
|
import (
|
|
"x"
|
|
// don't mess up this comment
|
|
"y"
|
|
// or many
|
|
// of them
|
|
"z"
|
|
)
|
|
|
|
// This used to crash gofumpt, as there's no space to insert an extra newline.
|
|
import (
|
|
"std"
|
|
|
|
"non.std/pkg"
|
|
)
|
|
|
|
// All of the extra imports below are known to not belong in std.
|
|
// For example/ and test/, see https://golang.org/issue/37641.
|
|
import (
|
|
"internal/bar"
|
|
"io"
|
|
|
|
"example/foo"
|
|
|
|
"test/baz"
|
|
)
|
|
|
|
import (
|
|
"io"
|
|
"nodomainmodextra"
|
|
|
|
"nodomainmod"
|
|
"nodomainmod/mod1/pkg1"
|
|
"nodomainmod/mod2"
|
|
)
|
|
|
|
import (
|
|
"io"
|
|
"nodomainother/mod.withdot/pkg1"
|
|
)
|
|
|
|
// TODO: fix issue 225.
|
|
import (
|
|
"path/filepath"
|
|
"time"
|
|
|
|
"github.com/tinkerbell/tink/pkg/apis/core/v1alpha1"
|
|
"k8s.io/apimachinery/pkg/types"
|
|
|
|
"sigs.k8s.io/yaml"
|
|
)
|