From b6b8970810917aec02df16a5dc6f60275a1cc7bd Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Sun, 20 Oct 2024 12:30:23 +0200 Subject: [PATCH] Add comments to generic functions --- atom.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/atom.go b/atom.go index 6049bcb..bb7dd31 100644 --- a/atom.go +++ b/atom.go @@ -16,6 +16,7 @@ type Countable interface { *xml.Attr | *Person | *Category | *Link | *ExtensionElement | *Entry } +// addToSlice adds a Countable to to a *[]Countable func addToSlice[C Countable](slice *[]C, countable C) { if *slice == nil { *slice = make([]C, 0) @@ -23,6 +24,8 @@ func addToSlice[C Countable](slice *[]C, countable C) { *slice = append(*slice, countable) } +// deleteFromSlice deletes the Countable with the index from the *[]Countable. +// It return an error. func deleteFromSlice[C Countable](slice *[]C, id int) error { length := len(*slice) if id > length {