Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / mvdan.cc / gofumpt@v0.0.0-20200802201014-ab5a8192947d / testdata / scripts / std-imports.txt
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/mvdan.cc/gofumpt@v0.0.0-20200802201014-ab5a8192947d/testdata/scripts/std-imports.txt b/.config/coc/extensions/coc-go-data/tools/pkg/mod/mvdan.cc/gofumpt@v0.0.0-20200802201014-ab5a8192947d/testdata/scripts/std-imports.txt
new file mode 100644 (file)
index 0000000..1d9e0f2
--- /dev/null
@@ -0,0 +1,140 @@
+[!gofumpt] skip 'don''t add or remove imports'
+
+gofumpt -w foo.go
+cmp foo.go foo.go.golden
+
+gofumpt -d foo.go.golden
+! stdout .
+
+-- 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/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"
+)
+-- 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/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 (
+       "io"
+
+       "example/foo"
+       "internal/bar"
+       "test/baz"
+)