From 1cb97fdcfccba68afb2caf6a53297d70d85e56a5 Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Thu, 10 Apr 2025 08:47:55 +0300 Subject: [PATCH] refactor: fix typos in comments and struct names (#1304) --- cli/main.go | 2 +- lint/filefilter.go | 2 +- rule/optimize_operands_order.go | 6 +++--- testdata/go1.24/struct_tag.go | 2 +- testdata/struct_tag.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cli/main.go b/cli/main.go index 98832eb..ab5b31d 100644 --- a/cli/main.go +++ b/cli/main.go @@ -38,7 +38,7 @@ func fail(err string) { // RunRevive runs the CLI for revive. func RunRevive(extraRules ...revivelib.ExtraRule) { - // move parsing flags outside of init() otherwise tests dont works properly + // move parsing flags outside of init() otherwise tests don't works properly // more info: https://github.com/golang/go/issues/46869#issuecomment-865695953 initConfig() diff --git a/lint/filefilter.go b/lint/filefilter.go index fb2c9bb..0e81fed 100644 --- a/lint/filefilter.go +++ b/lint/filefilter.go @@ -117,7 +117,7 @@ func (ff *FileFilter) prepareRegexp() error { return nil } - // it's whole file mask, just escape dots and normilze separators + // it's whole file mask, just escape dots and normalize separators fillRx := src fillRx = strings.ReplaceAll(fillRx, "\\", "/") fillRx = strings.ReplaceAll(fillRx, ".", `\.`) diff --git a/rule/optimize_operands_order.go b/rule/optimize_operands_order.go index c9297d2..6b3143c 100644 --- a/rule/optimize_operands_order.go +++ b/rule/optimize_operands_order.go @@ -18,7 +18,7 @@ func (*OptimizeOperandsOrderRule) Apply(file *lint.File, _ lint.Arguments) []lin onFailure := func(failure lint.Failure) { failures = append(failures, failure) } - w := lintOptimizeOperandsOrderlExpr{ + w := lintOptimizeOperandsOrderExpr{ onFailure: onFailure, } ast.Walk(w, file.AST) @@ -30,13 +30,13 @@ func (*OptimizeOperandsOrderRule) Name() string { return "optimize-operands-order" } -type lintOptimizeOperandsOrderlExpr struct { +type lintOptimizeOperandsOrderExpr struct { onFailure func(failure lint.Failure) } // Visit checks boolean AND and OR expressions to determine // if swapping their operands may result in an execution speedup. -func (w lintOptimizeOperandsOrderlExpr) Visit(node ast.Node) ast.Visitor { +func (w lintOptimizeOperandsOrderExpr) Visit(node ast.Node) ast.Visitor { binExpr, ok := node.(*ast.BinaryExpr) if !ok { return w diff --git a/testdata/go1.24/struct_tag.go b/testdata/go1.24/struct_tag.go index 91dadc7..30e7063 100644 --- a/testdata/go1.24/struct_tag.go +++ b/testdata/go1.24/struct_tag.go @@ -1,7 +1,7 @@ package fixtures type decodeAndValidateRequest struct { - // BEAWRE : the flag of URLParam should match the const string URLParam + // BEWARE : the flag of URLParam should match the const string URLParam URLParam string `json:"-" path:"url_param" validate:"numeric"` Text string `json:"text" validate:"max=10"` DefaultInt int `json:"defaultInt" default:"10.0"` // MATCH /type mismatch between field type and default value type in default tag/ diff --git a/testdata/struct_tag.go b/testdata/struct_tag.go index d039619..c8174db 100644 --- a/testdata/struct_tag.go +++ b/testdata/struct_tag.go @@ -3,7 +3,7 @@ package fixtures import "time" type decodeAndValidateRequest struct { - // BEAWRE : the flag of URLParam should match the const string URLParam + // BEWARE : the flag of URLParam should match the const string URLParam URLParam string `json:"-" path:"url_param" validate:"numeric"` Text string `json:"text" validate:"max=10"` DefaultInt int `json:"defaultInt" default:"10.0"` // MATCH /type mismatch between field type and default value type in default tag/