From bfb071c0b29952a99a32ef97b41fe934331c3c91 Mon Sep 17 00:00:00 2001 From: Christopher Allen Lane Date: Wed, 13 Dec 2023 09:10:20 -0500 Subject: [PATCH] chore(lint): various changes to appease revive - Add `package` comments - Rename `opts` to `_` where unused --- cmd/cheat/cmd_conf.go | 2 +- cmd/cheat/cmd_directories.go | 2 +- cmd/cheat/cmd_tags.go | 2 +- cmd/cheat/main.go | 1 + internal/cheatpath/cheatpath.go | 2 ++ internal/config/config.go | 3 ++- internal/display/faint.go | 5 ++++- internal/installer/prompt.go | 2 ++ internal/mock/path.go | 1 + internal/repo/clone.go | 1 + internal/sheet/sheet.go | 2 ++ internal/sheets/consolidate.go | 2 ++ 12 files changed, 20 insertions(+), 5 deletions(-) diff --git a/cmd/cheat/cmd_conf.go b/cmd/cheat/cmd_conf.go index 65c1694..0dc3709 100644 --- a/cmd/cheat/cmd_conf.go +++ b/cmd/cheat/cmd_conf.go @@ -6,6 +6,6 @@ import ( "github.com/cheat/cheat/internal/config" ) -func cmdConf(opts map[string]interface{}, conf config.Config) { +func cmdConf(_ map[string]interface{}, conf config.Config) { fmt.Println(conf.Path) } diff --git a/cmd/cheat/cmd_directories.go b/cmd/cheat/cmd_directories.go index de8b353..f55efc6 100644 --- a/cmd/cheat/cmd_directories.go +++ b/cmd/cheat/cmd_directories.go @@ -10,7 +10,7 @@ import ( ) // cmdDirectories lists the configured cheatpaths. -func cmdDirectories(opts map[string]interface{}, conf config.Config) { +func cmdDirectories(_ map[string]interface{}, conf config.Config) { // initialize a tabwriter to produce cleanly columnized output var out bytes.Buffer diff --git a/cmd/cheat/cmd_tags.go b/cmd/cheat/cmd_tags.go index 8709c3e..73b8822 100644 --- a/cmd/cheat/cmd_tags.go +++ b/cmd/cheat/cmd_tags.go @@ -10,7 +10,7 @@ import ( ) // cmdTags lists all tags in use. -func cmdTags(opts map[string]interface{}, conf config.Config) { +func cmdTags(_ map[string]interface{}, conf config.Config) { // load the cheatsheets cheatsheets, err := sheets.Load(conf.Cheatpaths) diff --git a/cmd/cheat/main.go b/cmd/cheat/main.go index af1cdbc..ee177c6 100755 --- a/cmd/cheat/main.go +++ b/cmd/cheat/main.go @@ -1,3 +1,4 @@ +// Package main serves as the executable entrypoint. package main //go:generate go run ../../build/embed.go diff --git a/internal/cheatpath/cheatpath.go b/internal/cheatpath/cheatpath.go index 9b70a42..5158198 100644 --- a/internal/cheatpath/cheatpath.go +++ b/internal/cheatpath/cheatpath.go @@ -1,3 +1,5 @@ +// Package cheatpath implements functions pertaining to cheatsheet file path +// management. package cheatpath // Cheatpath encapsulates cheatsheet path information diff --git a/internal/config/config.go b/internal/config/config.go index b0f4be9..d37ca8a 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -1,3 +1,4 @@ +// Package config implements functions pertaining to configuration management. package config import ( @@ -24,7 +25,7 @@ type Config struct { } // New returns a new Config struct -func New(opts map[string]interface{}, confPath string, resolve bool) (Config, error) { +func New(_ map[string]interface{}, confPath string, resolve bool) (Config, error) { // read the config file buf, err := os.ReadFile(confPath) diff --git a/internal/display/faint.go b/internal/display/faint.go index 45a7343..052d90d 100644 --- a/internal/display/faint.go +++ b/internal/display/faint.go @@ -1,3 +1,5 @@ +// Package display implement functions pertaining to writing formatted +// cheatsheet content to stdout, or alternatively the system pager. package display import ( @@ -6,7 +8,8 @@ import ( "github.com/cheat/cheat/internal/config" ) -// Faint returns an faint string +// Faint returns a faintly-colored string that's used to de-prioritize text +// written to stdout func Faint(str string, conf config.Config) string { // make `str` faint only if colorization has been requested if conf.Colorize { diff --git a/internal/installer/prompt.go b/internal/installer/prompt.go index 3f2d90e..3807dde 100644 --- a/internal/installer/prompt.go +++ b/internal/installer/prompt.go @@ -1,3 +1,5 @@ +// Package installer implements functions that provide a first-time +// installation wizard. package installer import ( diff --git a/internal/mock/path.go b/internal/mock/path.go index d38ce5a..559a6cc 100644 --- a/internal/mock/path.go +++ b/internal/mock/path.go @@ -1,3 +1,4 @@ +// Package mock implements mock functions used in unit-tests. package mock import ( diff --git a/internal/repo/clone.go b/internal/repo/clone.go index 32c6113..81181c1 100644 --- a/internal/repo/clone.go +++ b/internal/repo/clone.go @@ -1,3 +1,4 @@ +// Package repo implements functions pertaining to the management of git repos. package repo import ( diff --git a/internal/sheet/sheet.go b/internal/sheet/sheet.go index afaf515..af4f290 100644 --- a/internal/sheet/sheet.go +++ b/internal/sheet/sheet.go @@ -1,3 +1,5 @@ +// Package sheet implements functions pertaining to parsing, searching, and +// displaying cheatsheets. package sheet import ( diff --git a/internal/sheets/consolidate.go b/internal/sheets/consolidate.go index 693b0fa..0f2d5e8 100644 --- a/internal/sheets/consolidate.go +++ b/internal/sheets/consolidate.go @@ -1,3 +1,5 @@ +// Package sheets implements functions pertaining to loading, sorting, +// filtering, and tagging cheatsheets. package sheets import (