Skip to content

Commit

Permalink
expvar: add available godoc link
Browse files Browse the repository at this point in the history
Change-Id: I2db83e3c97a154f8599b4fcbceeebf1c69ee61ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/534762
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
  • Loading branch information
cuishuang authored and gopherbot committed Oct 13, 2023
1 parent 0700bcf commit 74f4720
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/expvar/expvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type jsonVar interface {
appendJSON(b []byte) []byte
}

// Int is a 64-bit integer variable that satisfies the Var interface.
// Int is a 64-bit integer variable that satisfies the [Var] interface.
type Int struct {
i int64
}
Expand All @@ -73,7 +73,7 @@ func (v *Int) Set(value int64) {
atomic.StoreInt64(&v.i, value)
}

// Float is a 64-bit float variable that satisfies the Var interface.
// Float is a 64-bit float variable that satisfies the [Var] interface.
type Float struct {
f atomic.Uint64
}
Expand Down Expand Up @@ -108,14 +108,14 @@ func (v *Float) Set(value float64) {
v.f.Store(math.Float64bits(value))
}

// Map is a string-to-Var map variable that satisfies the Var interface.
// Map is a string-to-Var map variable that satisfies the [Var] interface.
type Map struct {
m sync.Map // map[string]Var
keysMu sync.RWMutex
keys []string // sorted
}

// KeyValue represents a single entry in a Map.
// KeyValue represents a single entry in a [Map].
type KeyValue struct {
Key string
Value Var
Expand Down Expand Up @@ -208,7 +208,7 @@ func (v *Map) Set(key string, av Var) {
v.m.Store(key, av)
}

// Add adds delta to the *Int value stored under the given map key.
// Add adds delta to the *[Int] value stored under the given map key.
func (v *Map) Add(key string, delta int64) {
i, ok := v.m.Load(key)
if !ok {
Expand All @@ -225,7 +225,7 @@ func (v *Map) Add(key string, delta int64) {
}
}

// AddFloat adds delta to the *Float value stored under the given map key.
// AddFloat adds delta to the *[Float] value stored under the given map key.
func (v *Map) AddFloat(key string, delta float64) {
i, ok := v.m.Load(key)
if !ok {
Expand Down Expand Up @@ -266,7 +266,7 @@ func (v *Map) Do(f func(KeyValue)) {
}
}

// String is a string variable, and satisfies the Var interface.
// String is a string variable, and satisfies the [Var] interface.
type String struct {
s atomic.Value // string
}
Expand All @@ -276,8 +276,8 @@ func (v *String) Value() string {
return p
}

// String implements the Var interface. To get the unquoted string
// use Value.
// String implements the [Var] interface. To get the unquoted string
// use [String.Value].
func (v *String) String() string {
return string(v.appendJSON(nil))
}
Expand All @@ -290,7 +290,7 @@ func (v *String) Set(value string) {
v.s.Store(value)
}

// Func implements Var by calling the function
// Func implements [Var] by calling the function
// and formatting the returned value using JSON.
type Func func() any

Expand Down

0 comments on commit 74f4720

Please sign in to comment.