Skip to content

Commit 7faabc8

Browse files
committed
expvar: add Delete function
Adds a `Delete` function to the expvar package to remove a named exported variable. Calls `Map.Delete`. Closes golang#73814
1 parent 4193679 commit 7faabc8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/expvar/expvar.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ func Publish(name string, v Var) {
316316
slices.Sort(vars.keys)
317317
}
318318

319+
// Delete removes a named exported variable.
320+
func Delete(name string) {
321+
vars.Delete(name)
322+
}
323+
319324
// Get retrieves a named exported variable. It returns nil if the name has
320325
// not been registered.
321326
func Get(name string) Var {

0 commit comments

Comments
 (0)