aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/daixiang0
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2023-12-05 15:10:03 +0100
committerTaras Madan <tarasmadan@google.com>2023-12-06 11:31:44 +0000
commit2ab72b4feef2c97f22f90cfbf9e45a6cfcd08bda (patch)
treea6d19b94b6399fcc00a6cfa430885cd349dd1533 /vendor/github.com/daixiang0
parente08e8f492d31d672cc245944c185f8aadf2ee695 (diff)
vendor: updates
Diffstat (limited to 'vendor/github.com/daixiang0')
-rw-r--r--vendor/github.com/daixiang0/gci/pkg/config/config.go12
-rw-r--r--vendor/github.com/daixiang0/gci/pkg/gci/gci.go12
-rw-r--r--vendor/github.com/daixiang0/gci/pkg/gci/testdata.go1245
-rw-r--r--vendor/github.com/daixiang0/gci/pkg/section/prefix.go1
-rw-r--r--vendor/github.com/daixiang0/gci/pkg/utils/constants.go5
5 files changed, 1265 insertions, 10 deletions
diff --git a/vendor/github.com/daixiang0/gci/pkg/config/config.go b/vendor/github.com/daixiang0/gci/pkg/config/config.go
index 120e787e9..98513c056 100644
--- a/vendor/github.com/daixiang0/gci/pkg/config/config.go
+++ b/vendor/github.com/daixiang0/gci/pkg/config/config.go
@@ -1,7 +1,6 @@
package config
import (
- "io/ioutil"
"sort"
"strings"
@@ -73,19 +72,18 @@ func (g YamlConfig) Parse() (*Config, error) {
return &Config{g.Cfg, sections, sectionSeparators}, nil
}
-func InitializeGciConfigFromYAML(filePath string) (*Config, error) {
+func ParseConfig(in string) (*Config, error) {
config := YamlConfig{}
- yamlData, err := ioutil.ReadFile(filePath)
- if err != nil {
- return nil, err
- }
- err = yaml.Unmarshal(yamlData, &config)
+
+ err := yaml.Unmarshal([]byte(in), &config)
if err != nil {
return nil, err
}
+
gciCfg, err := config.Parse()
if err != nil {
return nil, err
}
+
return gciCfg, nil
}
diff --git a/vendor/github.com/daixiang0/gci/pkg/gci/gci.go b/vendor/github.com/daixiang0/gci/pkg/gci/gci.go
index e84a16676..163e95a86 100644
--- a/vendor/github.com/daixiang0/gci/pkg/gci/gci.go
+++ b/vendor/github.com/daixiang0/gci/pkg/gci/gci.go
@@ -127,11 +127,17 @@ func LoadFormatGoFile(file io.FileObj, cfg config.Config) (src, dist []byte, err
return nil, nil, err
}
+ return LoadFormat(src, file.Path(), cfg)
+}
+
+func LoadFormat(in []byte, path string, cfg config.Config) (src, dist []byte, err error) {
+ src = in
+
if cfg.SkipGenerated && parse.IsGeneratedFileByComment(string(src)) {
return src, src, nil
}
- imports, headEnd, tailStart, cStart, cEnd, err := parse.ParseFile(src, file.Path())
+ imports, headEnd, tailStart, cStart, cEnd, err := parse.ParseFile(src, path)
if err != nil {
if errors.Is(err, parse.NoImportError{}) {
return src, src, nil
@@ -201,6 +207,10 @@ func LoadFormatGoFile(file io.FileObj, cfg config.Config) (src, dist []byte, err
for _, s := range slices {
i += copy(dist[i:], s)
}
+
+ // remove ^M(\r\n) from Win to Unix
+ dist = bytes.ReplaceAll(dist, []byte{utils.WinLinebreak}, []byte{utils.Linebreak})
+
log.L().Debug(fmt.Sprintf("raw:\n%s", dist))
dist, err = goFormat.Source(dist)
if err != nil {
diff --git a/vendor/github.com/daixiang0/gci/pkg/gci/testdata.go b/vendor/github.com/daixiang0/gci/pkg/gci/testdata.go
new file mode 100644
index 000000000..a48ce356c
--- /dev/null
+++ b/vendor/github.com/daixiang0/gci/pkg/gci/testdata.go
@@ -0,0 +1,1245 @@
+package gci
+
+type Cases struct {
+ name, config, in, out string
+}
+
+var commonConfig = `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0)
+`
+
+var testCases = []Cases{
+ {
+ "already-good",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "blank-format",
+
+ commonConfig,
+
+ `package main
+import (
+ "fmt"
+
+ // comment
+ g "github.com/golang" // comment
+
+ "github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ // comment
+ g "github.com/golang" // comment
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "cgo-block",
+
+ commonConfig,
+
+ `package main
+
+import (
+ /*
+ #include "types.h"
+ */
+ "C"
+)
+`,
+ `package main
+
+import (
+ /*
+ #include "types.h"
+ */
+ "C"
+)
+`,
+ },
+ {
+ "cgo-block-after-import",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "fmt"
+
+ "github.com/daixiang0/gci"
+ g "github.com/golang"
+)
+
+// #cgo CFLAGS: -DPNG_DEBUG=1
+// #cgo amd64 386 CFLAGS: -DX86=1
+// #cgo LDFLAGS: -lpng
+// #include <png.h>
+import "C"
+`,
+ `package main
+
+// #cgo CFLAGS: -DPNG_DEBUG=1
+// #cgo amd64 386 CFLAGS: -DX86=1
+// #cgo LDFLAGS: -lpng
+// #include <png.h>
+import "C"
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "cgo-block-before-import",
+
+ commonConfig,
+
+ `package main
+
+// #cgo CFLAGS: -DPNG_DEBUG=1
+// #cgo amd64 386 CFLAGS: -DX86=1
+// #cgo LDFLAGS: -lpng
+// #include <png.h>
+import "C"
+
+import (
+ "fmt"
+
+ "github.com/daixiang0/gci"
+
+ g "github.com/golang"
+)
+`,
+ `package main
+
+// #cgo CFLAGS: -DPNG_DEBUG=1
+// #cgo amd64 386 CFLAGS: -DX86=1
+// #cgo LDFLAGS: -lpng
+// #include <png.h>
+import "C"
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "cgo-block-mixed",
+
+ commonConfig,
+
+ `package main
+
+import (
+ /* #include "types.h"
+ */"C"
+)
+`,
+ `package main
+
+import (
+ /* #include "types.h"
+ */"C"
+)
+`,
+ },
+ {
+ "cgo-block-mixed-with-content",
+
+ commonConfig,
+
+ `package main
+
+import (
+ /* #include "types.h"
+ #include "other.h" */"C"
+)
+`,
+ `package main
+
+import (
+ /* #include "types.h"
+ #include "other.h" */"C"
+)
+`,
+ },
+ {
+ "cgo-block-prefix",
+
+ commonConfig,
+
+ `package main
+
+import (
+ /* #include "types.h" */ "C"
+)
+`,
+ `package main
+
+import (
+ /* #include "types.h" */ "C"
+)
+`,
+ },
+ {
+ "cgo-block-single-line",
+
+ commonConfig,
+
+ `package main
+
+import (
+ /* #include "types.h" */
+ "C"
+)
+`,
+ `package main
+
+import (
+ /* #include "types.h" */
+ "C"
+)
+`,
+ },
+ {
+ "cgo-line",
+
+ commonConfig,
+
+ `package main
+
+import (
+ // #include "types.h"
+ "C"
+)
+`,
+ `package main
+
+import (
+ // #include "types.h"
+ "C"
+)
+`,
+ },
+ {
+ "cgo-multiline",
+
+ commonConfig,
+
+ `package main
+
+import (
+ // #include "types.h"
+ // #include "other.h"
+ "C"
+)
+`,
+ `package main
+
+import (
+ // #include "types.h"
+ // #include "other.h"
+ "C"
+)
+`,
+ },
+ {
+ "cgo-single",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "fmt"
+
+ "github.com/daixiang0/gci"
+)
+
+import "C"
+
+import "github.com/golang"
+
+import (
+ "github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+import "C"
+
+import (
+ "fmt"
+
+ "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "comment",
+
+ commonConfig,
+
+ `package main
+import (
+ //Do not forget to run Gci
+ "fmt"
+)
+`,
+ `package main
+import (
+ //Do not forget to run Gci
+ "fmt"
+)
+`,
+ },
+ {
+ "comment-before-import",
+
+ commonConfig,
+
+ `package main
+
+// comment
+import (
+ "fmt"
+ "os"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+// comment
+import (
+ "fmt"
+ "os"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "comment-in-the-tail",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+
+type test int
+
+// test
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+
+type test int
+
+// test
+`,
+ },
+ {
+ "comment-top",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "os" // https://pkg.go.dev/os
+ // https://pkg.go.dev/fmt
+ "fmt"
+)
+`,
+ `package main
+
+import (
+ // https://pkg.go.dev/fmt
+ "fmt"
+ "os" // https://pkg.go.dev/os
+)
+`,
+ },
+ {
+ "comment-whithout-whitespace",
+
+ commonConfig,
+
+ `package proc
+
+import (
+ "context"// no separating whitespace here //nolint:confusion
+)
+`,
+ `package proc
+
+import (
+ "context"// no separating whitespace here //nolint:confusion
+)
+`,
+ },
+ {
+ "comment-with-slashslash",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "fmt" // https://pkg.go.dev/fmt
+)
+`,
+ `package main
+
+import (
+ "fmt" // https://pkg.go.dev/fmt
+)
+`,
+ },
+ {
+ "custom-order",
+
+ `customOrder: true
+sections:
+ - Prefix(github.com/daixiang0)
+ - Default
+ - Standard
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/a"
+)
+`,
+ `package main
+
+import (
+ "github.com/daixiang0/a"
+
+ g "github.com/golang"
+
+ "fmt"
+)
+`,
+ },
+ {
+ "default-order",
+
+ `sections:
+ - Standard
+ - Prefix(github.com/daixiang0)
+ - Default
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/a"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/a"
+)
+`,
+ },
+ {
+ "dot-and-blank",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0)
+ - Blank
+ - Dot
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+ . "github.com/golang/dot"
+ _ "github.com/golang/blank"
+
+ "github.com/daixiang0/a"
+ "github.com/daixiang0/gci"
+ "github.com/daixiang0/gci/subtest"
+ . "github.com/daixiang0/gci/dot"
+ _ "github.com/daixiang0/gci/blank"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/a"
+ "github.com/daixiang0/gci"
+ "github.com/daixiang0/gci/subtest"
+
+ _ "github.com/daixiang0/gci/blank"
+ _ "github.com/golang/blank"
+
+ . "github.com/daixiang0/gci/dot"
+ . "github.com/golang/dot"
+)
+`,
+ },
+ {
+ "duplicate-imports",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ a "github.com/daixiang0/gci"
+ "github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+ a "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "grouped-multiple-custom",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0,gitlab.com/daixiang0,daixiang0)
+`,
+ `package main
+
+import (
+ "daixiang0/lib1"
+ "fmt"
+ "github.com/daixiang0/gci"
+ "gitlab.com/daixiang0/gci"
+ g "github.com/golang"
+ "github.com/daixiang0/gci/subtest"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "daixiang0/lib1"
+ "github.com/daixiang0/gci"
+ "github.com/daixiang0/gci/subtest"
+ "gitlab.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "leading-comment",
+
+ commonConfig,
+
+ `package main
+
+import (
+ // foo
+ "fmt"
+)
+`,
+ `package main
+
+import (
+ // foo
+ "fmt"
+)
+`,
+ },
+ {
+ "linebreak",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0)
+`,
+ `package main
+
+import (
+ g "github.com/golang"
+
+ "fmt"
+
+ "github.com/daixiang0/gci"
+
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "linebreak-no-custom",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0)
+`,
+ `package main
+
+import (
+ g "github.com/golang"
+
+ "fmt"
+
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+)
+`,
+ },
+ {
+ "mismatch-section",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0)
+ - Prefix(github.com/daixiang0/gci)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "multiple-custom",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0)
+ - Prefix(github.com/daixiang0/gci)
+ - Prefix(github.com/daixiang0/gci/subtest)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/a"
+ "github.com/daixiang0/gci"
+ "github.com/daixiang0/gci/subtest"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/a"
+
+ "github.com/daixiang0/gci"
+
+ "github.com/daixiang0/gci/subtest"
+)
+`,
+ },
+ {
+ "multiple-imports",
+
+ commonConfig,
+
+ `package main
+
+import "fmt"
+
+import "context"
+
+import (
+ "os"
+
+ "github.com/daixiang0/test"
+)
+
+import "math"
+
+
+// main
+func main() {
+}
+`,
+ `package main
+
+import (
+ "context"
+ "fmt"
+ "math"
+ "os"
+
+ "github.com/daixiang0/test"
+)
+
+// main
+func main() {
+}
+`,
+ },
+ {
+ "multiple-line-comment",
+
+ commonConfig,
+
+ `package proc
+
+import (
+ "context" // in-line comment
+ "fmt"
+ "os"
+
+ //nolint:depguard // A multi-line comment explaining why in
+ // this one case it's OK to use os/exec even though depguard
+ // is configured to force us to use dlib/exec instead.
+ "os/exec"
+
+ "golang.org/x/sys/unix"
+ "github.com/local/dlib/dexec"
+)
+`,
+ `package proc
+
+import (
+ "context" // in-line comment
+ "fmt"
+ "os"
+ //nolint:depguard // A multi-line comment explaining why in
+ // this one case it's OK to use os/exec even though depguard
+ // is configured to force us to use dlib/exec instead.
+ "os/exec"
+
+ "github.com/local/dlib/dexec"
+ "golang.org/x/sys/unix"
+)
+`,
+ },
+ {
+ "nochar-after-import",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "fmt"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+)
+`,
+ },
+ {
+ "no-format",
+
+ commonConfig,
+
+ `package main
+
+import(
+"fmt"
+
+g "github.com/golang"
+
+"github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "nolint",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "fmt"
+
+ "github.com/forbidden/pkg" //nolint:depguard
+
+ _ "github.com/daixiang0/gci" //nolint:depguard
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ "github.com/forbidden/pkg" //nolint:depguard
+
+ _ "github.com/daixiang0/gci" //nolint:depguard
+)
+`,
+ },
+ {
+ "number-in-alias",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "fmt"
+
+ go_V1 "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ go_V1 "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "one-import",
+
+ commonConfig,
+
+ `package main
+import (
+ "fmt"
+)
+
+func main() {
+}
+`,
+ `package main
+import (
+ "fmt"
+)
+
+func main() {
+}
+`,
+ },
+ {
+ "one-import-one-line",
+
+ commonConfig,
+
+ `package main
+
+import "fmt"
+
+func main() {
+}
+`,
+ `package main
+
+import "fmt"
+
+func main() {
+}
+`,
+ },
+ {
+ "one-line-import-after-import",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0)
+`,
+ `package main
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/daixiang0/test"
+)
+
+import "context"
+`,
+ `package main
+
+import (
+ "context"
+ "fmt"
+ "os"
+
+ "github.com/daixiang0/test"
+)
+`,
+ },
+ {
+ "same-prefix-custom",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0/gci)
+ - Prefix(github.com/daixiang0/gci/subtest)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+ "github.com/daixiang0/gci/subtest"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+
+ "github.com/daixiang0/gci/subtest"
+)
+`,
+ },
+ {
+ "simple-case",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "golang.org/x/tools"
+
+ "fmt"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ "golang.org/x/tools"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "whitespace-test",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "fmt"
+ "github.com/golang" // golang
+ alias "github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ "github.com/golang" // golang
+
+ alias "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "with-above-comment-and-alias",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "fmt"
+ // golang
+ _ "github.com/golang"
+ "github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ // golang
+ _ "github.com/golang"
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "with-comment-and-alias",
+
+ commonConfig,
+
+ `package main
+
+import (
+ "fmt"
+ _ "github.com/golang" // golang
+ "github.com/daixiang0/gci"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ _ "github.com/golang" // golang
+
+ "github.com/daixiang0/gci"
+)
+`,
+ },
+ {
+ "same-prefix-custom",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0/gci)
+ - Prefix(github.com/daixiang0/gci/subtest)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+ "github.com/daixiang0/gci/subtest"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+
+ "github.com/daixiang0/gci/subtest"
+)
+`,
+ },
+ {
+ "same-prefix-custom",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix(github.com/daixiang0/gci)
+ - Prefix(github.com/daixiang0/gci/subtest)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+ "github.com/daixiang0/gci/subtest"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+
+ "github.com/daixiang0/gci/subtest"
+)
+`,
+ },
+ {
+ "blank-in-config",
+
+ `sections:
+ - Standard
+ - Default
+ - Prefix( github.com/daixiang0/gci, github.com/daixiang0/gci/subtest )
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+ "github.com/daixiang0/gci/subtest"
+)
+`,
+ `package main
+
+import (
+ "fmt"
+
+ g "github.com/golang"
+
+ "github.com/daixiang0/gci"
+ "github.com/daixiang0/gci/subtest"
+)
+`,
+ },
+}
diff --git a/vendor/github.com/daixiang0/gci/pkg/section/prefix.go b/vendor/github.com/daixiang0/gci/pkg/section/prefix.go
index a274347cd..30bdd8f4e 100644
--- a/vendor/github.com/daixiang0/gci/pkg/section/prefix.go
+++ b/vendor/github.com/daixiang0/gci/pkg/section/prefix.go
@@ -20,6 +20,7 @@ const CustomType = "custom"
func (c Custom) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity {
for _, prefix := range strings.Split(c.Prefix, CustomSeparator) {
+ prefix = strings.TrimSpace(prefix)
if strings.HasPrefix(spec.Path, prefix) {
return specificity.Match{Length: len(prefix)}
}
diff --git a/vendor/github.com/daixiang0/gci/pkg/utils/constants.go b/vendor/github.com/daixiang0/gci/pkg/utils/constants.go
index 0e7cce757..2fafbc32c 100644
--- a/vendor/github.com/daixiang0/gci/pkg/utils/constants.go
+++ b/vendor/github.com/daixiang0/gci/pkg/utils/constants.go
@@ -1,8 +1,9 @@
package utils
const (
- Indent = '\t'
- Linebreak = '\n'
+ Indent = '\t'
+ Linebreak = '\n'
+ WinLinebreak = '\r'
Colon = ":"