section

package
v0.13.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2024 License: BSD-3-Clause Imports: 8 Imported by: 5

Documentation

Index

Constants

View Source
const AliasType = "alias"
View Source
const BlankType = "blank"
View Source
const CustomSeparator = ","

CustomSeparator allows you to group multiple custom prefix together in the same section gci diff -s standard -s default -s prefix(github.com/company,gitlab.com/company,companysuffix)

View Source
const CustomType = "custom"
View Source
const DefaultType = "default"
View Source
const DotType = "dot"
View Source
const LocalModuleType = "localmodule"
View Source
const StandardType = "standard"

Variables

View Source
var (
	MissingImportStatementError   = FileParsingError{errors.New("no import statement present in File")}
	ImportStatementNotClosedError = FileParsingError{errors.New("import statement not closed")}
)
View Source
var MissingParameterClosingBracketsError = fmt.Errorf("section parameter is missing closing %q", utils.RightParenthesis)
View Source
var MoreThanOneOpeningQuotesError = fmt.Errorf("found more than one %q parameter start sequences", utils.RightParenthesis)
View Source
var SectionTypeDoesNotAcceptParametersError = errors.New("section type does not accept a parameter")
View Source
var SectionTypeDoesNotAcceptPrefixError = errors.New("section may not contain a Prefix")
View Source
var SectionTypeDoesNotAcceptSuffixError = errors.New("section may not contain a Suffix")

Functions

This section is empty.

Types

type Alias added in v0.12.0

type Alias struct{}

func (Alias) MatchSpecificity added in v0.12.0

func (b Alias) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Alias) String added in v0.12.0

func (b Alias) String() string

func (Alias) Type added in v0.12.0

func (b Alias) Type() string

type Blank added in v0.4.4

type Blank struct{}

func (Blank) MatchSpecificity added in v0.4.4

func (b Blank) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Blank) String added in v0.4.4

func (b Blank) String() string

func (Blank) Type added in v0.6.1

func (b Blank) Type() string

type CommentLine

type CommentLine struct {
	Comment string
}

func (CommentLine) MatchSpecificity

func (c CommentLine) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (CommentLine) String

func (c CommentLine) String() string

func (CommentLine) Type added in v0.6.1

func (c CommentLine) Type() string

type Custom

type Custom struct {
	Prefix string
}

func (Custom) MatchSpecificity

func (c Custom) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Custom) String

func (c Custom) String() string

func (Custom) Type added in v0.6.1

func (c Custom) Type() string

type Default

type Default struct{}

func (Default) MatchSpecificity

func (d Default) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Default) String

func (d Default) String() string

func (Default) Type added in v0.6.1

func (d Default) Type() string

type Dot added in v0.4.4

type Dot struct{}

func (Dot) MatchSpecificity added in v0.4.4

func (d Dot) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Dot) String added in v0.4.4

func (d Dot) String() string

func (Dot) Type added in v0.6.1

func (d Dot) Type() string

type EqualSpecificityMatchError

type EqualSpecificityMatchError struct {
	Imports            *parse.GciImports
	SectionA, SectionB Section
}

func (EqualSpecificityMatchError) Error

func (EqualSpecificityMatchError) Is

type FileParsingError

type FileParsingError struct {
	// contains filtered or unexported fields
}

func (FileParsingError) Is

func (f FileParsingError) Is(err error) bool

func (FileParsingError) Unwrap

func (f FileParsingError) Unwrap() error

type InvalidAliasSplitError

type InvalidAliasSplitError struct {
	// contains filtered or unexported fields
}

func (InvalidAliasSplitError) Error

func (i InvalidAliasSplitError) Error() string

func (InvalidAliasSplitError) Is

func (i InvalidAliasSplitError) Is(err error) bool

type InvalidImportSplitError

type InvalidImportSplitError struct {
	// contains filtered or unexported fields
}

func (InvalidImportSplitError) Error

func (i InvalidImportSplitError) Error() string

func (InvalidImportSplitError) Is

type LocalModule added in v0.13.0

type LocalModule struct {
	Path string
}

func (*LocalModule) Configure added in v0.13.0

func (m *LocalModule) Configure(path string) error

Configure configures the module section by finding the module for the current path

func (*LocalModule) MatchSpecificity added in v0.13.0

func (m *LocalModule) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (*LocalModule) String added in v0.13.0

func (m *LocalModule) String() string

func (*LocalModule) Type added in v0.13.0

func (m *LocalModule) Type() string

type NewLine

type NewLine struct{}

func (NewLine) MatchSpecificity

func (n NewLine) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (NewLine) String

func (n NewLine) String() string

func (NewLine) Type added in v0.6.1

func (n NewLine) Type() string

type NoMatchingSectionForImportError

type NoMatchingSectionForImportError struct {
	Imports *parse.GciImports
}

func (NoMatchingSectionForImportError) Error

func (NoMatchingSectionForImportError) Is

type Section

type Section interface {
	// MatchSpecificity returns how well an Import matches to this Section
	MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

	// String Implements the stringer interface
	String() string

	// return section type
	Type() string
}

Section defines a part of the formatted output.

type SectionList

type SectionList []Section

func DefaultSectionSeparators

func DefaultSectionSeparators() SectionList

func DefaultSections

func DefaultSections() SectionList

func Parse

func Parse(data []string) (SectionList, error)

func (SectionList) String

func (list SectionList) String() []string

type SectionParsingError

type SectionParsingError struct {
	// contains filtered or unexported fields
}

func (SectionParsingError) Is

func (s SectionParsingError) Is(err error) bool

func (SectionParsingError) Unwrap

func (s SectionParsingError) Unwrap() error

func (SectionParsingError) Wrap

func (s SectionParsingError) Wrap(sectionStr string) error

type Standard

type Standard struct{}

func (Standard) MatchSpecificity

func (s Standard) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity

func (Standard) String

func (s Standard) String() string

func (Standard) Type added in v0.6.1

func (s Standard) Type() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL