treewide: documentation on exported functions should start with their name
Change-Id: Iea3e929bed743d7edfbf5b54bbaa31796aeaaadd
Reviewed-on: https://review.monogon.dev/c/monogon/+/3027
Vouch-Run-CI: Tim Windelschmidt <tim@monogon.tech>
Tested-by: Jenkins CI
Reviewed-by: Serge Bazanski <serge@monogon.tech>
diff --git a/metropolis/node/core/curator/bootstrap.go b/metropolis/node/core/curator/bootstrap.go
index 39c1100..ac2a4de 100644
--- a/metropolis/node/core/curator/bootstrap.go
+++ b/metropolis/node/core/curator/bootstrap.go
@@ -24,9 +24,9 @@
// However, that seems to not be worth the effort for a tightly coupled single
// consumer like the bootstrap code.
-// BootstrapFinish saves the given Node and initial cluster owner pubkey into
-// etcd, without regard for any other cluster state and directly using a given
-// etcd client.
+// BootstrapNodeFinish saves the given Node and initial cluster owner pubkey
+// into etcd, without regard for any other cluster state and directly using
+// a given etcd client.
//
// This is ran by the cluster bootstrap workflow to finish bootstrapping a
// cluster - afterwards, this cluster will be ready to serve.
diff --git a/metropolis/node/core/curator/watcher/watch_node.go b/metropolis/node/core/curator/watcher/watch_node.go
index f71940e..45c51ab 100644
--- a/metropolis/node/core/curator/watcher/watch_node.go
+++ b/metropolis/node/core/curator/watcher/watch_node.go
@@ -74,8 +74,8 @@
return true
}
-// Returns underlying error for this Watcher, nil if no error is present. After
-// an error is returned, the Watcher cannot be used anymore.
+// Error returns underlying error for this Watcher, nil if no error is present.
+// After an error is returned, the Watcher cannot be used anymore.
func (w *Watcher) Error() error {
return w.err
}
diff --git a/metropolis/node/core/identity/certificates.go b/metropolis/node/core/identity/certificates.go
index a8f2e7b..fca55b7 100644
--- a/metropolis/node/core/identity/certificates.go
+++ b/metropolis/node/core/identity/certificates.go
@@ -44,7 +44,7 @@
}
}
-// CA makes a Metropolis-compatible CA certificate template.
+// CACertificate makes a Metropolis-compatible CA certificate template.
//
// cn is a human-readable string that can be used to distinguish Metropolis
// clusters, if needed. It is not machine-parsed, instead only signature
diff --git a/metropolis/node/core/network/dhcp4c/dhcpc.go b/metropolis/node/core/network/dhcp4c/dhcpc.go
index 4aeeb3d..5159cc5 100644
--- a/metropolis/node/core/network/dhcp4c/dhcpc.go
+++ b/metropolis/node/core/network/dhcp4c/dhcpc.go
@@ -94,11 +94,11 @@
// was successfully received.
Send(payload *dhcpv4.DHCPv4) error
// SetReceiveDeadline sets a deadline for Receive() calls after which they
- // return with DeadlineExceededErr
+ // return with ErrDeadlineExceeded
SetReceiveDeadline(time.Time) error
// Receive waits for a DHCP message to arrive and returns it. If the
// deadline expires without a message arriving it will return
- // DeadlineExceededErr. If the message is completely malformed it will an
+ // ErrDeadlineExceeded. If the message is completely malformed it will an
// instance of InvalidMessageError.
Receive() (*dhcpv4.DHCPv4, error)
// Close closes the given transport. Calls to any of the above methods will
@@ -465,7 +465,7 @@
return s.ctx.Err()
default:
}
- if errors.Is(err, transport.DeadlineExceededErr) {
+ if errors.Is(err, transport.ErrDeadlineExceeded) {
return nil
}
var e transport.InvalidMessageError
diff --git a/metropolis/node/core/network/dhcp4c/dhcpc_test.go b/metropolis/node/core/network/dhcp4c/dhcpc_test.go
index 97c1b2b..7914b31 100644
--- a/metropolis/node/core/network/dhcp4c/dhcpc_test.go
+++ b/metropolis/node/core/network/dhcp4c/dhcpc_test.go
@@ -87,7 +87,7 @@
mt.receiveIdx++
return packet, nil
}
- return nil, transport.DeadlineExceededErr
+ return nil, transport.ErrDeadlineExceeded
}
func (mt *mockTransport) SetReceiveDeadline(t time.Time) error {
diff --git a/metropolis/node/core/network/dhcp4c/transport/transport.go b/metropolis/node/core/network/dhcp4c/transport/transport.go
index c3e6e0b..deed14d 100644
--- a/metropolis/node/core/network/dhcp4c/transport/transport.go
+++ b/metropolis/node/core/network/dhcp4c/transport/transport.go
@@ -24,7 +24,7 @@
"net"
)
-var DeadlineExceededErr = errors.New("deadline exceeded")
+var ErrDeadlineExceeded = errors.New("deadline exceeded")
func NewInvalidMessageError(internalErr error) error {
return &InvalidMessageError{internalErr: internalErr}
@@ -45,7 +45,7 @@
func deadlineFromTimeout(err error) error {
var timeoutErr net.Error
if errors.As(err, &timeoutErr) && timeoutErr.Timeout() {
- return DeadlineExceededErr
+ return ErrDeadlineExceeded
}
return err
}
diff --git a/metropolis/node/kubernetes/reconciler/reconciler.go b/metropolis/node/kubernetes/reconciler/reconciler.go
index f2c3838..2d2bfda 100644
--- a/metropolis/node/kubernetes/reconciler/reconciler.go
+++ b/metropolis/node/kubernetes/reconciler/reconciler.go
@@ -37,7 +37,7 @@
"source.monogon.dev/metropolis/pkg/supervisor"
)
-// Sad workaround for all the pointer booleans in K8s specs
+// True is a sad workaround for all the pointer booleans in K8s specs
func True() *bool {
val := true
return &val
diff --git a/metropolis/pkg/bootparam/bootparam.go b/metropolis/pkg/bootparam/bootparam.go
index 3d6b7fa..240abf3 100644
--- a/metropolis/pkg/bootparam/bootparam.go
+++ b/metropolis/pkg/bootparam/bootparam.go
@@ -33,7 +33,7 @@
}
}
-// Trim spaces as defined by Linux from the left of the string.
+// TrimLeftSpace spaces as defined by Linux from the left of the string.
// This is only exported for tests, do not use this. Because of import loops
// as well as cgo restrictions this cannot be an internal function used by
// tests.
diff --git a/metropolis/pkg/fileargs/fileargs.go b/metropolis/pkg/fileargs/fileargs.go
index 88863da..7b14550 100644
--- a/metropolis/pkg/fileargs/fileargs.go
+++ b/metropolis/pkg/fileargs/fileargs.go
@@ -46,7 +46,7 @@
return NewWithSize(DefaultSize)
}
-// NewWthSize is the same as new, but with a custom size limit. Please be aware
+// NewWithSize is the same as new, but with a custom size limit. Please be aware
// that this data cannot be swapped out and using a size limit that's too high
// can deadlock your kernel.
func NewWithSize(size uint64) (*FileArgs, error) {
diff --git a/metropolis/pkg/kmod/modinfo.go b/metropolis/pkg/kmod/modinfo.go
index f75e761..5c01681 100644
--- a/metropolis/pkg/kmod/modinfo.go
+++ b/metropolis/pkg/kmod/modinfo.go
@@ -105,10 +105,10 @@
return i["firmware"]
}
-// License returns the licenses use of this module is governed by. For mainline
-// modules, the list of valid license strings is documented in the kernel's
-// Documentation/process/license-rules.rst file under the `MODULE_LICENSE`
-// section.
+// Licenses returns the licenses use of this module is governed by.
+// For mainline modules, the list of valid license strings is
+// documented in the kernel's Documentation/process/license-rules.rst file
+// under the `MODULE_LICENSE` section.
func (i ModuleInfo) Licenses() []string {
return i["license"]
}
diff --git a/metropolis/pkg/logtree/leveled_payload.go b/metropolis/pkg/logtree/leveled_payload.go
index c0852ae..e2b2ff1 100644
--- a/metropolis/pkg/logtree/leveled_payload.go
+++ b/metropolis/pkg/logtree/leveled_payload.go
@@ -97,8 +97,8 @@
return
}
-// Message returns the inner message lines of this entry, ie. what was passed to
-// the actual logging method, but split by newlines.
+// Messages returns the inner message lines of this entry, ie. what was passed
+// to the actual logging method, but split by newlines.
func (p *LeveledPayload) Messages() []string { return p.messages }
func (p *LeveledPayload) MessagesJoined() string { return strings.Join(p.messages, "\n") }
diff --git a/metropolis/pkg/logtree/logtree_entry.go b/metropolis/pkg/logtree/logtree_entry.go
index 72cc409..6bd8752 100644
--- a/metropolis/pkg/logtree/logtree_entry.go
+++ b/metropolis/pkg/logtree/logtree_entry.go
@@ -205,8 +205,8 @@
return "INVALID ", []string{"INVALID"}
}
-// Convert this LogEntry to proto. Returned value may be nil if given LogEntry is
-// invalid, eg. contains neither a Raw nor Leveled entry.
+// Proto converts this LogEntry to proto. Returned value may be nil if given
+// LogEntry is invalid, eg. contains neither a Raw nor Leveled entry.
func (l *LogEntry) Proto() *cpb.LogEntry {
p := &cpb.LogEntry{
Dn: string(l.DN),
@@ -228,8 +228,9 @@
return p
}
-// Parse a proto LogEntry back into internal structure. This can be used in log
-// proto API consumers to easily print received log entries.
+// LogEntryFromProto parses a proto LogEntry back into internal structure.
+// This can be used in log proto API consumers to easily print received log
+// entries.
func LogEntryFromProto(l *cpb.LogEntry) (*LogEntry, error) {
dn := DN(l.Dn)
if _, err := dn.Path(); err != nil {