github.com/daixiang0/gci@v0.13.0/pkg/section/standard.go (about)

     1  package section
     2  
     3  import (
     4  	"github.com/daixiang0/gci/pkg/parse"
     5  	"github.com/daixiang0/gci/pkg/specificity"
     6  )
     7  
     8  const StandardType = "standard"
     9  
    10  type Standard struct{}
    11  
    12  func (s Standard) MatchSpecificity(spec *parse.GciImports) specificity.MatchSpecificity {
    13  	if isStandard(spec.Path) {
    14  		return specificity.StandardMatch{}
    15  	}
    16  	return specificity.MisMatch{}
    17  }
    18  
    19  func (s Standard) String() string {
    20  	return StandardType
    21  }
    22  
    23  func (s Standard) Type() string {
    24  	return StandardType
    25  }
    26  
    27  func isStandard(pkg string) bool {
    28  	_, ok := standardPackages[pkg]
    29  	return ok
    30  }