build(deps): bump github.com/polyfloyd/go-errorlint from 1.4.8 to 1.5.1 (#4690)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									0260ec853a
								
							
						
					
					
						commit
						24bcca2ebd
					
				| @ -326,6 +326,16 @@ linters-settings: | ||||
|     # Check for plain error comparisons. | ||||
|     # Default: true | ||||
|     comparison: false | ||||
|     # Allowed errors. | ||||
|     # Default: [] | ||||
|     allowed-errors: | ||||
|       - err: "io.EOF" | ||||
|         fun: "example.com/pkg.Read" | ||||
|     # Allowed error "wildcards". | ||||
|     # Default: [] | ||||
|     allowed-errors-wildcard: | ||||
|       - err: "example.com/pkg.ErrMagic" | ||||
|         fun: "example.com/pkg.Magic" | ||||
| 
 | ||||
|   exhaustive: | ||||
|     # Program elements to check for exhaustiveness. | ||||
|  | ||||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							| @ -84,7 +84,7 @@ require ( | ||||
| 	github.com/nishanths/predeclared v0.2.2 | ||||
| 	github.com/nunnatsa/ginkgolinter v0.16.2 | ||||
| 	github.com/pelletier/go-toml/v2 v2.2.2 | ||||
| 	github.com/polyfloyd/go-errorlint v1.4.8 | ||||
| 	github.com/polyfloyd/go-errorlint v1.5.1 | ||||
| 	github.com/quasilyte/go-ruleguard/dsl v0.3.22 | ||||
| 	github.com/ryancurrah/gomodguard v1.3.2 | ||||
| 	github.com/ryanrolds/sqlclosecheck v0.5.1 | ||||
|  | ||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
										generated
									
									
									
								
							| @ -424,8 +424,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= | ||||
| github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||||
| github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||||
| github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||||
| github.com/polyfloyd/go-errorlint v1.4.8 h1:jiEjKDH33ouFktyez7sckv6pHWif9B7SuS8cutDXFHw= | ||||
| github.com/polyfloyd/go-errorlint v1.4.8/go.mod h1:NNCxFcFjZcw3xNjVdCchERkEM6Oz7wta2XJVxRftwO4= | ||||
| github.com/polyfloyd/go-errorlint v1.5.1 h1:5gHxDjLyyWij7fhfrjYNNlHsUNQeyx0LFQKUelO3RBo= | ||||
| github.com/polyfloyd/go-errorlint v1.5.1/go.mod h1:sH1QC1pxxi0fFecsVIzBmxtrgd9IF/SkJpA6wqyKAJs= | ||||
| github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= | ||||
| github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= | ||||
| github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= | ||||
|  | ||||
| @ -803,6 +803,36 @@ | ||||
|               "description": "Check for plain error comparisons", | ||||
|               "type": "boolean", | ||||
|               "default": true | ||||
|             }, | ||||
|             "allowed-errors": { | ||||
|               "type": "array", | ||||
|               "items": { | ||||
|                 "type": "object", | ||||
|                 "additionalProperties": false, | ||||
|                 "properties": { | ||||
|                   "err": { | ||||
|                     "type": "string" | ||||
|                   }, | ||||
|                   "fun": { | ||||
|                     "type": "string" | ||||
|                   } | ||||
|                 } | ||||
|               } | ||||
|             }, | ||||
|             "allowed-errors-wildcard": { | ||||
|               "type": "array", | ||||
|               "items": { | ||||
|                 "type": "object", | ||||
|                 "additionalProperties": false, | ||||
|                 "properties": { | ||||
|                   "err": { | ||||
|                     "type": "string" | ||||
|                   }, | ||||
|                   "fun": { | ||||
|                     "type": "string" | ||||
|                   } | ||||
|                 } | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|  | ||||
| @ -384,10 +384,17 @@ type ErrChkJSONSettings struct { | ||||
| } | ||||
| 
 | ||||
| type ErrorLintSettings struct { | ||||
| 	Errorf      bool `mapstructure:"errorf"` | ||||
| 	ErrorfMulti bool `mapstructure:"errorf-multi"` | ||||
| 	Asserts     bool `mapstructure:"asserts"` | ||||
| 	Comparison  bool `mapstructure:"comparison"` | ||||
| 	Errorf                bool                 `mapstructure:"errorf"` | ||||
| 	ErrorfMulti           bool                 `mapstructure:"errorf-multi"` | ||||
| 	Asserts               bool                 `mapstructure:"asserts"` | ||||
| 	Comparison            bool                 `mapstructure:"comparison"` | ||||
| 	AllowedErrors         []ErrorLintAllowPair `mapstructure:"allowed-errors"` | ||||
| 	AllowedErrorsWildcard []ErrorLintAllowPair `mapstructure:"allowed-errors-wildcard"` | ||||
| } | ||||
| 
 | ||||
| type ErrorLintAllowPair struct { | ||||
| 	Err string `mapstructure:"err"` | ||||
| 	Fun string `mapstructure:"fun"` | ||||
| } | ||||
| 
 | ||||
| type ExhaustiveSettings struct { | ||||
|  | ||||
| @ -9,7 +9,21 @@ import ( | ||||
| ) | ||||
| 
 | ||||
| func New(cfg *config.ErrorLintSettings) *goanalysis.Linter { | ||||
| 	a := errorlint.NewAnalyzer() | ||||
| 	var opts []errorlint.Option | ||||
| 
 | ||||
| 	if cfg != nil { | ||||
| 		ae := toAllowPairs(cfg.AllowedErrors) | ||||
| 		if len(ae) > 0 { | ||||
| 			opts = append(opts, errorlint.WithAllowedErrors(ae)) | ||||
| 		} | ||||
| 
 | ||||
| 		aew := toAllowPairs(cfg.AllowedErrorsWildcard) | ||||
| 		if len(aew) > 0 { | ||||
| 			opts = append(opts, errorlint.WithAllowedWildcard(aew)) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	a := errorlint.NewAnalyzer(opts...) | ||||
| 
 | ||||
| 	cfgMap := map[string]map[string]any{} | ||||
| 
 | ||||
| @ -30,3 +44,11 @@ func New(cfg *config.ErrorLintSettings) *goanalysis.Linter { | ||||
| 		cfgMap, | ||||
| 	).WithLoadMode(goanalysis.LoadModeTypesInfo) | ||||
| } | ||||
| 
 | ||||
| func toAllowPairs(data []config.ErrorLintAllowPair) []errorlint.AllowPair { | ||||
| 	var pairs []errorlint.AllowPair | ||||
| 	for _, allowedError := range data { | ||||
| 		pairs = append(pairs, errorlint.AllowPair(allowedError)) | ||||
| 	} | ||||
| 	return pairs | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	![49699333+dependabot[bot]@users.noreply.github.com](/assets/img/avatar_default.png) dependabot[bot]
						dependabot[bot]