MCPcopy Create free account
hub / github.com/ardanlabs/gotraining / Push

Method Push

topics/go/algorithms/data/stack/stack.go:34–36  ·  view source on GitHub ↗

Push adds data into the top of the stack.

(data *Data)

Source from the content-addressed store, hash-verified

32
33// Push adds data into the top of the stack.
34func (s *Stack) Push(data *Data) {
35 s.data = append(s.data, data)
36}
37
38// Pop removes data from the top of the stack.
39func (s *Stack) Pop() (*Data, error) {

Callers 3

TestPushFunction · 0.95
TestPopFunction · 0.95
TestPeekFunction · 0.80

Calls

no outgoing calls

Tested by 3

TestPushFunction · 0.76
TestPopFunction · 0.76
TestPeekFunction · 0.64