Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zeim839 committed May 14, 2024
1 parent 4d8e1b9 commit 2113ccc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Counter interface {
// GetOrRegisterCounter returns an existing Counter or constructs and registers
// a new StandardCounter.
func GetOrRegisterCounter(name string, r Registry) Counter {
if nil == r {
if r == nil {
r = DefaultRegistry
}
return r.GetOrRegister(name, NewCounter).(Counter)
Expand All @@ -40,7 +40,7 @@ func NewCounter() Counter {

// CounterSnapshot is a read-only copy of another Counter.
type CounterSnapshot struct {
count int64
count int64
}

// Clear panics.
Expand Down Expand Up @@ -85,7 +85,7 @@ func (NilCounter) Snapshot() Counter { return NilCounter{} }
// StandardCounter is the standard implementation of a Counter and uses the
// sync/atomic package to manage a single int64 value.
type StandardCounter struct {
count atomic.Int64
count atomic.Int64
}

// Clear sets the counter to zero.
Expand All @@ -111,6 +111,6 @@ func (c *StandardCounter) Inc(i int64) {
// Snapshot returns a read-only copy of the counter.
func (c *StandardCounter) Snapshot() Counter {
return CounterSnapshot{
count: c.Count(),
count: c.Count(),
}
}
10 changes: 5 additions & 5 deletions gauge.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func NewRegisteredFunctionalGauge(name string, r Registry, f func() int64) Gauge

// GaugeSnapshot is a read-only copy of another Gauge.
type GaugeSnapshot struct {
value int64
value int64
}

// Snapshot returns the snapshot.
Expand Down Expand Up @@ -85,13 +85,13 @@ func (NilGauge) Value() int64 { return 0 }
// StandardGauge is the standard implementation of a Gauge and uses the
// sync/atomic package to manage a single int64 value.
type StandardGauge struct {
value atomic.Int64
value atomic.Int64
}

// Snapshot returns a read-only copy of the gauge.
func (g *StandardGauge) Snapshot() Gauge {
return GaugeSnapshot{
value: g.Value(),
value: g.Value(),
}
}

Expand All @@ -107,7 +107,7 @@ func (g *StandardGauge) Value() int64 {

// FunctionalGauge returns value from given function
type FunctionalGauge struct {
value func() int64
value func() int64
}

// Value returns the gauge's current value.
Expand All @@ -118,7 +118,7 @@ func (g FunctionalGauge) Value() int64 {
// Snapshot returns the snapshot.
func (g FunctionalGauge) Snapshot() Gauge {
return &GaugeSnapshot{
value: g.Value(),
value: g.Value(),
}
}

Expand Down

0 comments on commit 2113ccc

Please sign in to comment.