MCPcopy Create free account
hub / github.com/alecthomas/devtodo2 / Delete

Method Delete

todo.go:228–241  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

226}
227
228func (t *taskNodeImpl) Delete() {
229 parent := t.Parent().(*taskNodeImpl)
230 if parent == nil {
231 panic("can not delete root node")
232 }
233 for i := 0; i < parent.Len(); i++ {
234 if parent.At(i).Equal(t) {
235 parent.tasks = append(parent.tasks[:i], parent.tasks[i+1:]...)
236 t.parent = nil
237 return
238 }
239 }
240 panic("couldn't find t in parent in order to delete")
241}
242
243type taskImpl struct {
244 *taskNodeImpl

Callers

nothing calls this directly

Calls 4

ParentMethod · 0.95
LenMethod · 0.65
EqualMethod · 0.65
AtMethod · 0.65

Tested by

no test coverage detected