mirror of
https://github.com/go-kratos/kratos.git
synced 2025-09-16 09:16:35 +02:00
golangci: check misspell (#3086)
* golangci: check misspell * fix lint * remove fifth wheel * fix lint * fix lint
This commit is contained in:
@@ -29,6 +29,7 @@ linters:
|
||||
- whitespace
|
||||
- wastedassign
|
||||
- unconvert
|
||||
- misspell
|
||||
|
||||
# don't enable:
|
||||
# - asciicheck
|
||||
@@ -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
|
||||
|
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
|
@@ -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,
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user