1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-20 15:07:03 +00:00

docs: Add missing docstrings, adjust wording to match standard style

This patch adds a missing docstrings for exported identifiers, and
adjust some of the existing ones to match the standard style.

In some cases, the identifiers were un-exported after noticing they had
no external users.

Besides improving documentation, it also reduces the linter noise
significantly.
This commit is contained in:
Alberto Bertogli
2018-03-04 15:54:34 +00:00
parent 40ae9b5f69
commit f3b01cb493
21 changed files with 154 additions and 46 deletions

View File

@@ -1,16 +1,19 @@
// Package set implement sets for various types. Well, only string for now :)
package set
// String set.
type String struct {
m map[string]struct{}
}
// NewString returns a new string set, with the given values in it.
func NewString(values ...string) *String {
s := &String{}
s.Add(values...)
return s
}
// Add values to the string set.
func (s *String) Add(values ...string) {
if s.m == nil {
s.m = map[string]struct{}{}
@@ -21,6 +24,7 @@ func (s *String) Add(values ...string) {
}
}
// Has checks if the set has the given value.
func (s *String) Has(value string) bool {
// We explicitly allow s to be nil *in this function* to simplify callers'
// code. Note that Add will not tolerate it, and will panic.