From 0e068182b9c512ded724c368eecf3c805f3c409c Mon Sep 17 00:00:00 2001 From: Aryan Behmardi Date: Wed, 10 Dec 2025 21:34:36 +0000 Subject: [PATCH] fix: add package comments and enable revive check Signed-off-by: Aryan Behmardi --- .golangci.yml | 3 --- agent/agent_test.go | 2 ++ client/client.go | 2 ++ config/config.go | 2 ++ eventbridge/eventbridge.go | 2 ++ firecracker-control/client/client.go | 3 +++ firecracker-control/cmd/containerd/gomod_test.go | 2 ++ firecracker-control/common.go | 2 ++ internal/common.go | 2 ++ internal/debug/debug.go | 2 ++ internal/event/exchange.go | 2 ++ internal/integtest/config.go | 2 ++ internal/shim/shim.go | 2 ++ internal/vm/agent.go | 2 ++ runtime/cpuset/cpuset_builder.go | 2 ++ runtime/firecrackeroci/annotation.go | 2 ++ runtime/vm/mount.go | 2 ++ snapshotter/app/service.go | 2 ++ snapshotter/config/config.go | 2 ++ snapshotter/demux/cache/cache.go | 2 ++ snapshotter/demux/internal/failing_snapshotter.go | 3 +++ snapshotter/demux/metrics/discovery/service_discovery.go | 2 ++ snapshotter/demux/metrics/proxy.go | 2 ++ snapshotter/demux/proxy/address/http_resolver.go | 2 ++ snapshotter/demux/proxy/snapshotter.go | 2 ++ snapshotter/demux/snapshotter.go | 2 ++ snapshotter/internal/http_address_resolver.go | 2 ++ snapshotter/internal/integtest/stargz/fs/config/config.go | 2 ++ snapshotter/internal/integtest/stargz/fs/source/source.go | 2 ++ snapshotter/internal/mount/collection.go | 2 ++ volume/cmd/volume-init/main.go | 2 ++ 31 files changed, 62 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a8b88ab06..dd9f3b191 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -37,9 +37,6 @@ issues: - linters: - govet text: "copylocks" - - linters: - - revive - text: package-comments - linters: - staticcheck text: "Do not rely on the global seed" diff --git a/agent/agent_test.go b/agent/agent_test.go index f79f7ac8f..227440d6b 100644 --- a/agent/agent_test.go +++ b/agent/agent_test.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// agent_test contains tests for helper functions in the agent binary, +// including validation of TaskExecID behavior. package main import ( diff --git a/client/client.go b/client/client.go index 5afe4b985..723135b7f 100644 --- a/client/client.go +++ b/client/client.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package client contains helpers for working with containers managed by +// firecracker-containerd, such as computing rootfs paths inside a microVM. package client import "github.com/firecracker-microvm/firecracker-containerd/internal/bundle" diff --git a/config/config.go b/config/config.go index 0332e2bda..8cb43ba2f 100644 --- a/config/config.go +++ b/config/config.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package config defines configuration structures and helpers used by +// firecracker-containerd, including loading and validating config files. package config import ( diff --git a/eventbridge/eventbridge.go b/eventbridge/eventbridge.go index e3acd56fa..142253e0d 100644 --- a/eventbridge/eventbridge.go +++ b/eventbridge/eventbridge.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package eventbridge implements an event forwarding bridge that translates +// and relays containerd events to firecracker-containerd components. package eventbridge import ( diff --git a/firecracker-control/client/client.go b/firecracker-control/client/client.go index c28e87231..47b2c54a4 100644 --- a/firecracker-control/client/client.go +++ b/firecracker-control/client/client.go @@ -11,6 +11,9 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package client implements a Go client for interacting with the +// firecracker-control service, providing access to VM and lifecycle +// management APIs. package client import ( diff --git a/firecracker-control/cmd/containerd/gomod_test.go b/firecracker-control/cmd/containerd/gomod_test.go index cce51a86d..2fcbd1525 100644 --- a/firecracker-control/cmd/containerd/gomod_test.go +++ b/firecracker-control/cmd/containerd/gomod_test.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// gomod_test keeps the firecracker-control containerd command and its +// dependencies visible to Go's module tooling so they are not pruned. package main import "github.com/containerd/containerd/cmd/ctr/app" diff --git a/firecracker-control/common.go b/firecracker-control/common.go index 84ee76c5f..286836422 100644 --- a/firecracker-control/common.go +++ b/firecracker-control/common.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package service defines common constants shared by the firecracker-control +// service implementation, such as plugin identifiers. package service const ( diff --git a/internal/common.go b/internal/common.go index 9e7a78b48..e22da32b7 100644 --- a/internal/common.go +++ b/internal/common.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package internal contains shared helpers and internal utilities used +// across firecracker-containerd components. package internal import ( diff --git a/internal/debug/debug.go b/internal/debug/debug.go index 2f22871ce..215bc1307 100644 --- a/internal/debug/debug.go +++ b/internal/debug/debug.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package debug provides helpers for configuring firecracker-containerd +// logging and managing debug log levels across components. package debug import ( diff --git a/internal/event/exchange.go b/internal/event/exchange.go index 248253fe2..2da372e63 100644 --- a/internal/event/exchange.go +++ b/internal/event/exchange.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package event provides internal event exchange utilities, supporting +// publish/subscribe patterns for firecracker-containerd components. package event import ( diff --git a/internal/integtest/config.go b/internal/integtest/config.go index 1316226eb..1be9f4fe5 100644 --- a/internal/integtest/config.go +++ b/internal/integtest/config.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package integtest provides shared configuration and utilities for +// integration tests across firecracker-containerd. package integtest import ( diff --git a/internal/shim/shim.go b/internal/shim/shim.go index 0f863fd96..ff442ef0a 100644 --- a/internal/shim/shim.go +++ b/internal/shim/shim.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package shim provides helpers for working with the containerd shim, +// including construction of Firecracker control socket addresses. package shim import ( diff --git a/internal/vm/agent.go b/internal/vm/agent.go index 8c9ab8b03..a05ecfe8f 100644 --- a/internal/vm/agent.go +++ b/internal/vm/agent.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package vm provides helpers for managing Firecracker VMs, including +// agent-related IO handling utilities. package vm import ( diff --git a/runtime/cpuset/cpuset_builder.go b/runtime/cpuset/cpuset_builder.go index 23f1421f9..fa8a9a8d6 100644 --- a/runtime/cpuset/cpuset_builder.go +++ b/runtime/cpuset/cpuset_builder.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package cpuset provides helpers for constructing and managing cpusets +// used by Firecracker VMs and container workloads. package cpuset import ( diff --git a/runtime/firecrackeroci/annotation.go b/runtime/firecrackeroci/annotation.go index 7356c6f71..1b678956c 100644 --- a/runtime/firecrackeroci/annotation.go +++ b/runtime/firecrackeroci/annotation.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package firecrackeroci defines OCI annotations and related helpers used by +// the Firecracker runtime integration. package firecrackeroci import ( diff --git a/runtime/vm/mount.go b/runtime/vm/mount.go index 12ac48c49..3c0124ce8 100644 --- a/runtime/vm/mount.go +++ b/runtime/vm/mount.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package vm contains Firecracker VM runtime helpers, including utilities +// for preparing and managing container filesystem mounts inside VMs. package vm import ( diff --git a/snapshotter/app/service.go b/snapshotter/app/service.go index c76f58275..481645fdd 100644 --- a/snapshotter/app/service.go +++ b/snapshotter/app/service.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package app implements the application layer for the snapshotter, +// including service initialization and GRPC wiring. package app import ( diff --git a/snapshotter/config/config.go b/snapshotter/config/config.go index 42fe84f90..9fd618eda 100644 --- a/snapshotter/config/config.go +++ b/snapshotter/config/config.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package config defines configuration structures and helpers for the +// demux snapshotter, including loading configuration from TOML files. package config import ( diff --git a/snapshotter/demux/cache/cache.go b/snapshotter/demux/cache/cache.go index 04d397711..968c0edbc 100644 --- a/snapshotter/demux/cache/cache.go +++ b/snapshotter/demux/cache/cache.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package cache implements a cache of remote snapshotters used by the +// demux snapshotter for routing requests and service discovery. package cache import ( diff --git a/snapshotter/demux/internal/failing_snapshotter.go b/snapshotter/demux/internal/failing_snapshotter.go index d74af7d17..0a2678399 100644 --- a/snapshotter/demux/internal/failing_snapshotter.go +++ b/snapshotter/demux/internal/failing_snapshotter.go @@ -11,6 +11,9 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package internal contains internal test and helper implementations for +// the demux snapshotter, including a snapshotter that intentionally fails +// for error-path validation. package internal import ( diff --git a/snapshotter/demux/metrics/discovery/service_discovery.go b/snapshotter/demux/metrics/discovery/service_discovery.go index a2871a80d..b61daabc0 100644 --- a/snapshotter/demux/metrics/discovery/service_discovery.go +++ b/snapshotter/demux/metrics/discovery/service_discovery.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package discovery provides metrics and helpers for discovering remote +// snapshotter services used by the demux snapshotter. package discovery import ( diff --git a/snapshotter/demux/metrics/proxy.go b/snapshotter/demux/metrics/proxy.go index 8e9979b64..849379641 100644 --- a/snapshotter/demux/metrics/proxy.go +++ b/snapshotter/demux/metrics/proxy.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package metrics exposes Prometheus metrics for the demux snapshotter's +// proxy operations, providing visibility into request handling and failures. package metrics import ( diff --git a/snapshotter/demux/proxy/address/http_resolver.go b/snapshotter/demux/proxy/address/http_resolver.go index 2043b3535..8c226fa1d 100644 --- a/snapshotter/demux/proxy/address/http_resolver.go +++ b/snapshotter/demux/proxy/address/http_resolver.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package address defines resolvers for locating proxy network addresses +// used by the demux snapshotter's HTTP services. package address import ( diff --git a/snapshotter/demux/proxy/snapshotter.go b/snapshotter/demux/proxy/snapshotter.go index ce4ba8c23..504840f75 100644 --- a/snapshotter/demux/proxy/snapshotter.go +++ b/snapshotter/demux/proxy/snapshotter.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package proxy implements the proxy snapshotter used by the demux +// snapshotter to route requests to remote snapshotter backends. package proxy import ( diff --git a/snapshotter/demux/snapshotter.go b/snapshotter/demux/snapshotter.go index 76f7a69c9..f56d263c2 100644 --- a/snapshotter/demux/snapshotter.go +++ b/snapshotter/demux/snapshotter.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package demux implements the demux snapshotter, which routes snapshotter +// operations to remote backends based on image configuration. package demux import ( diff --git a/snapshotter/internal/http_address_resolver.go b/snapshotter/internal/http_address_resolver.go index 0688fd3f1..93b217f98 100644 --- a/snapshotter/internal/http_address_resolver.go +++ b/snapshotter/internal/http_address_resolver.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// http-address-resolver runs a small HTTP service that resolves snapshotter +// namespaces to proxy addresses for the demux snapshotter. package main import ( diff --git a/snapshotter/internal/integtest/stargz/fs/config/config.go b/snapshotter/internal/integtest/stargz/fs/config/config.go index e8a06713b..908c28421 100644 --- a/snapshotter/internal/integtest/stargz/fs/config/config.go +++ b/snapshotter/internal/integtest/stargz/fs/config/config.go @@ -38,6 +38,8 @@ license that can be found in the NOTICE.md file. */ +// Package config defines labels used to configure the Stargz remote +// snapshotter behavior in integration tests. package config const ( diff --git a/snapshotter/internal/integtest/stargz/fs/source/source.go b/snapshotter/internal/integtest/stargz/fs/source/source.go index dfb8fe8fb..259edae03 100644 --- a/snapshotter/internal/integtest/stargz/fs/source/source.go +++ b/snapshotter/internal/integtest/stargz/fs/source/source.go @@ -32,6 +32,8 @@ limitations under the License. */ +// Package source builds source information for stargz-based remote +// snapshots in integration tests by annotating image descriptors. package source import ( diff --git a/snapshotter/internal/mount/collection.go b/snapshotter/internal/mount/collection.go index f0ecffb1d..4ad8d530a 100644 --- a/snapshotter/internal/mount/collection.go +++ b/snapshotter/internal/mount/collection.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// Package mount provides helpers for working with collections of +// containerd mounts. package mount import "github.com/containerd/containerd/mount" diff --git a/volume/cmd/volume-init/main.go b/volume/cmd/volume-init/main.go index 8da5431f2..8c3b7c19a 100644 --- a/volume/cmd/volume-init/main.go +++ b/volume/cmd/volume-init/main.go @@ -11,6 +11,8 @@ // express or implied. See the License for the specific language governing // permissions and limitations under the License. +// volume-init reads volume mapping configuration from stdin and copies +// the requested directories into the guest volume image. package main import (