MCPcopy
hub / github.com/caddyserver/caddy / Delete

Method Delete

caddyconfig/caddyfile/dispenser.go:455–461  ·  view source on GitHub ↗

Delete deletes the current token and returns the updated slice of tokens. The cursor is not advanced to the next token. Because deletion modifies the underlying slice, this method should only be called if you have access to the original slice of tokens and/or are using the slice of tokens outside th

()

Source from the content-addressed store, hash-verified

453// array will become apparent (or worse, hide from you like they
454// did me for 3 and a half freaking hours late one night).
455func (d *Dispenser) Delete() []Token {
456 if d.cursor >= 0 && d.cursor <= len(d.tokens)-1 {
457 d.tokens = append(d.tokens[:d.cursor], d.tokens[d.cursor+1:]...)
458 d.cursor--
459 }
460 return d.tokens
461}
462
463// DeleteN is the same as Delete, but can delete many tokens at once.
464// If there aren't N tokens available to delete, none are deleted.

Callers 3

consolidateConnPoliciesFunction · 0.45
ExtractMatcherSetMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected