Skip to content

Commit

Permalink
golangci: check misspell (#3086)
Browse files Browse the repository at this point in the history
* golangci: check misspell

* fix lint

* remove fifth wheel

* fix lint

* fix lint
  • Loading branch information
demoManito authored Nov 21, 2023
1 parent 69a5f8c commit 9adece0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ linters:
- whitespace
- wastedassign
- unconvert
- misspell

# don't enable:
# - asciicheck
Expand Down Expand Up @@ -66,3 +67,5 @@ linters-settings:
min-complexity: 50
goimports:
local-prefixes: github.com/go-kratos # Put imports beginning with prefix after 3rd-party packages
misspell: # Finds commonly misspelled English words in comments
locale: US
18 changes: 9 additions & 9 deletions contrib/metrics/prometheus/gauge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import (
"github.com/prometheus/client_golang/prometheus"
)

func TestGuage(t *testing.T) {
expect := `# HELP test_request_test_guage_metric test
# TYPE test_request_test_guage_metric gauge
test_request_test_guage_metric{code="test",kind="test",operation="test",reason="test"} %d
func TestGauge(t *testing.T) {
expect := `# HELP test_request_test_gauge_metric test
# TYPE test_request_test_gauge_metric gauge
test_request_test_gauge_metric{code="test",kind="test",operation="test",reason="test"} %d
`

guageVec := prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "test",
Name: "test_guage_metric",
Name: "test_gauge_metric",
Subsystem: "request",
Help: "test",
}, []string{"kind", "operation", "code", "reason"})

guage := NewGauge(guageVec)
guage.With("test", "test", "test", "test").Set(1)
gauge := NewGauge(guageVec)
gauge.With("test", "test", "test", "test").Set(1)

reg := prometheus.NewRegistry()
reg.MustRegister(guageVec)
Expand All @@ -35,7 +35,7 @@ test_request_test_guage_metric{code="test",kind="test",operation="test",reason="
t.Fatal("metrics error")
}

guage.With("test", "test", "test", "test").Add(1)
gauge.With("test", "test", "test", "test").Add(1)
result, err = gatherLatest(reg)
if err != nil {
t.Fatal(err)
Expand All @@ -44,7 +44,7 @@ test_request_test_guage_metric{code="test",kind="test",operation="test",reason="
t.Fatal("metrics error")
}

guage.With("test", "test", "test", "test").Sub(1)
gauge.With("test", "test", "test", "test").Sub(1)
result, err = gatherLatest(reg)
if err != nil {
t.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion contrib/registry/consul/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func TestRegistry_Watch(t *testing.T) {
},
},
{
name: "ctx has been cancelled",
name: "ctx has been canceled",
args: args{
ctx: canceledCtx,
cancel: cancel,
Expand Down
2 changes: 1 addition & 1 deletion contrib/registry/discovery/impl_discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (w *watcher) Next() ([]*registry.ServiceInstance, error) {
case <-event:
// change event come
case <-w.cancelCtx.Done():
return nil, fmt.Errorf("watch context cancelled: %v", w.cancelCtx.Err())
return nil, fmt.Errorf("watch context canceled: %v", w.cancelCtx.Err())
}

ctx, cancel := context.WithTimeout(context.TODO(), 15*time.Second)
Expand Down

0 comments on commit 9adece0

Please sign in to comment.