aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/daixiang0/gci/pkg/section/parser.go
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2025-01-22 16:07:17 +0100
committerTaras Madan <tarasmadan@google.com>2025-01-23 10:42:36 +0000
commit7b4377ad9d8a7205416df8d6217ef2b010f89481 (patch)
treee6fec4fd12ff807a16d847923f501075bf71d16c /vendor/github.com/daixiang0/gci/pkg/section/parser.go
parent475a4c203afb8b7d3af51c4fd32bb170ff32a45e (diff)
vendor: delete
Diffstat (limited to 'vendor/github.com/daixiang0/gci/pkg/section/parser.go')
-rw-r--r--vendor/github.com/daixiang0/gci/pkg/section/parser.go49
1 files changed, 0 insertions, 49 deletions
diff --git a/vendor/github.com/daixiang0/gci/pkg/section/parser.go b/vendor/github.com/daixiang0/gci/pkg/section/parser.go
deleted file mode 100644
index 62ed1582a..000000000
--- a/vendor/github.com/daixiang0/gci/pkg/section/parser.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package section
-
-import (
- "errors"
- "fmt"
- "strings"
-)
-
-func Parse(data []string) (SectionList, error) {
- if len(data) == 0 {
- return nil, nil
- }
-
- var list SectionList
- var errString string
- for _, d := range data {
- s := strings.ToLower(d)
- if len(s) == 0 {
- return nil, nil
- }
-
- if s == "default" {
- list = append(list, Default{})
- } else if s == "standard" {
- list = append(list, Standard{})
- } else if s == "newline" {
- list = append(list, NewLine{})
- } else if strings.HasPrefix(s, "prefix(") && len(d) > 8 {
- list = append(list, Custom{d[7 : len(d)-1]})
- } else if strings.HasPrefix(s, "commentline(") && len(d) > 13 {
- list = append(list, Custom{d[12 : len(d)-1]})
- } else if s == "dot" {
- list = append(list, Dot{})
- } else if s == "blank" {
- list = append(list, Blank{})
- } else if s == "alias" {
- list = append(list, Alias{})
- } else if s == "localmodule" {
- // pointer because we need to mutate the section at configuration time
- list = append(list, &LocalModule{})
- } else {
- errString += fmt.Sprintf(" %s", s)
- }
- }
- if errString != "" {
- return nil, errors.New(fmt.Sprintf("invalid params:%s", errString))
- }
- return list, nil
-}