diff --git a/blocked_example.go b/blocked_example.go.example similarity index 100% rename from blocked_example.go rename to blocked_example.go.example diff --git a/go.mod b/go.mod index 0d187ea..0f0e92e 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,8 @@ go 1.14 require ( github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b - github.com/gofrs/uuid v3.2.0+incompatible github.com/mitchellh/go-homedir v1.1.0 github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d - github.com/uudashr/go-module v0.0.0-20191127030352-43b3105f0527 golang.org/x/mod v0.2.0 gopkg.in/yaml.v2 v2.2.8 ) diff --git a/go.sum b/go.sum index ffe020b..0f4bf32 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,9 @@ github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4/FHQWkvVRmgijNXRfzkIDHh23ggEo= github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= -github.com/gofrs/uuid v1.2.0 h1:coDhrjgyJaglxSjxuJdqQSSdUpG3w6p1OwN2od6frBU= -github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= -github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= -github.com/uudashr/go-module v0.0.0-20191127030352-43b3105f0527 h1:BU2YUY8v4xPRsACiegykZD28sXtgMojf3tYO/z8/F64= -github.com/uudashr/go-module v0.0.0-20191127030352-43b3105f0527/go.mod h1:P6Nk1sQWL6jcdBIxnLVlqCsOl0arao7gg7sPoM6gx4A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= @@ -23,6 +18,7 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/gomodguard.go b/gomodguard.go index d14ae3d..5a32216 100644 --- a/gomodguard.go +++ b/gomodguard.go @@ -51,13 +51,13 @@ func (r *Recommendations) String() string { return msg } -// HasRecommendations returns true if the blocked package has +// HasRecommendations returns true if the blocked package has // recommended modules. func (r *Recommendations) HasRecommendations(pkg string) bool { return len(r.Recommendations) > 0 } -// BlockedModule is a blocked module name and +// BlockedModule is a blocked module name and // optionally a list of recommended modules // and a reason message. type BlockedModule map[string]Recommendations @@ -79,7 +79,7 @@ func (b BlockedModules) Get() []string { return modules } -// RecommendedModules will return a list of recommended modules for the +// RecommendedModules will return a list of recommended modules for the // package provided. If there is no recommendation nil will be returned. func (b BlockedModules) RecommendedModules(pkg string) *Recommendations { for i := range b { @@ -121,14 +121,14 @@ func (b BlockedModules) IsBlockedModule(module string) bool { return false } -// Allowed is a list of modules and module +// Allowed is a list of modules and module // domains that are allowed to be used. type Allowed struct { Modules []string `yaml:"modules"` Domains []string `yaml:"domains"` } -// IsAllowedModule returns true if the given module +// IsAllowedModule returns true if the given module // name is in the allowed modules list. func (a *Allowed) IsAllowedModule(module string) bool { allowedModules := a.Modules @@ -154,7 +154,7 @@ func (a *Allowed) IsAllowedModuleDomain(module string) bool { return false } -// Blocked is a list of modules that are +// Blocked is a list of modules that are // blocked and not to be used. type Blocked struct { Modules BlockedModules `yaml:"modules"` @@ -174,7 +174,7 @@ type Result struct { Reason string } -// String returns the filename, line +// String returns the filename, line // number and reason of a Result. func (r *Result) String() string { return fmt.Sprintf("%s:%d: %s", r.FileName, r.LineNumber, r.Reason) @@ -223,7 +223,7 @@ func NewProcessor(config Configuration, logger *log.Logger) (*Processor, error) return p, nil } -// ProcessFiles takes a string slice with file names (full paths) +// ProcessFiles takes a string slice with file names (full paths) // and lints them. func (p *Processor) ProcessFiles(filenames []string) []Result { pluralModuleMsg := "s" @@ -286,7 +286,7 @@ func (p *Processor) process(filename string, data []byte) { } } -// addError adds an error for the file and line number for the current token.Pos +// addError adds an error for the file and line number for the current token.Pos // with the given reason. func (p *Processor) addError(fileset *token.FileSet, pos token.Pos, reason string) { position := fileset.Position(pos)