style: add comments to the public methods and members in the root package.

This commit is contained in:
vsariola
2021-08-30 20:34:56 +03:00
parent 60e4518230
commit a9b90c4db8
12 changed files with 162 additions and 9 deletions

View File

@ -6,6 +6,7 @@ package sointu
// necessary amount when a new item is added, filling the unused slots with 1s.
type Pattern []byte
// Get returns the value at index; or 1 is the index is out of range
func (s Pattern) Get(index int) byte {
if index < 0 || index >= len(s) {
return 1
@ -13,6 +14,7 @@ func (s Pattern) Get(index int) byte {
return s[index]
}
// Set sets the value at index; appending 1s until the slice is long enough.
func (s *Pattern) Set(index int, value byte) {
for len(*s) <= index {
*s = append(*s, 1)