Remediate all lint findings under the canonical golangci-lint config
Fix every finding surfaced by the canonical .golangci.yml with golangci-lint v2.12.2 (refs #61), behavior-preserving throughout: - err113: dynamic errors replaced with package-level sentinels and %w wrapping; direct comparisons converted to errors.Is - goprintffuncname: printf-style helpers renamed with an f suffix (ui.Writer message methods, cli.ReportErrorf, database.Fatalf, vaultik stdoutf) and all call sites updated - revive: stuttering type names renamed (blob.Handler, blob.WithReader, blob.ChunkPosition, storage.URL, storage.Info), doc comments added, unused parameters blanked, package comments added - contextcheck/noctx: ctx threaded through blob.Packer (AddChunk/Flush/FinalizeBlob/PackChunks) and scanner call sites; context-aware exec and sql variants used - funlen/cyclop/gocognit/nestif/dupl: oversized or duplicated functions split into focused helpers across production and test code - paralleltest/tparallel/thelper/usetesting/testpackage: tests parallelized where safe (global log.Initialize kept in the serial phase), helpers marked, t.TempDir adopted, external test packages where only exported API is used - gosec: integer conversions clamped or justified, header timeouts added, remaining findings suppressed with per-site justifications - mnd/goconst/lll/wsl_v5/nlreturn/noinlineerr/errcheck and other mechanical findings fixed directly Remove the deprecated log.LogOptions alias (callers migrated to log.Options). make check is green.
This commit is contained in:
@@ -2,6 +2,7 @@ package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
@@ -15,21 +16,25 @@ func NewVersionCommand() *cobra.Command {
|
||||
Short: "Print version information",
|
||||
Long: `Print version, git commit, and build information for vaultik.`,
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("vaultik %s\n", globals.Version)
|
||||
fmt.Printf(" commit: %s\n", globals.Commit)
|
||||
fmt.Printf(" build date: %s\n", globals.CommitDate)
|
||||
fmt.Printf(" go: %s\n", runtime.Version())
|
||||
fmt.Printf(" os/arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
|
||||
fmt.Printf(" author: %s\n", globals.Author)
|
||||
fmt.Printf(" homepage: %s\n", globals.Homepage)
|
||||
fmt.Printf(" license: %s\n", globals.License)
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
_, _ = fmt.Fprintf(os.Stdout, "vaultik %s\n", globals.Version)
|
||||
_, _ = fmt.Fprintf(os.Stdout, " commit: %s\n", globals.Commit)
|
||||
_, _ = fmt.Fprintf(os.Stdout, " build date: %s\n", globals.CommitDate)
|
||||
_, _ = fmt.Fprintf(os.Stdout, " go: %s\n", runtime.Version())
|
||||
_, _ = fmt.Fprintf(os.Stdout, " os/arch: %s/%s\n",
|
||||
runtime.GOOS, runtime.GOARCH)
|
||||
_, _ = fmt.Fprintf(os.Stdout, " author: %s\n", globals.Author)
|
||||
_, _ = fmt.Fprintf(os.Stdout, " homepage: %s\n", globals.Homepage)
|
||||
_, _ = fmt.Fprintf(os.Stdout, " license: %s\n", globals.License)
|
||||
|
||||
if globals.Version == "dev" {
|
||||
fmt.Println()
|
||||
fmt.Println("This is a development build (no version information embedded).")
|
||||
fmt.Println("Build a release binary with 'make vaultik' or download from")
|
||||
fmt.Println("https://sneak.berlin/go/vaultik for embedded version metadata.")
|
||||
_, _ = fmt.Fprintln(os.Stdout)
|
||||
_, _ = fmt.Fprintln(os.Stdout,
|
||||
"This is a development build (no version information embedded).")
|
||||
_, _ = fmt.Fprintln(os.Stdout,
|
||||
"Build a release binary with 'make vaultik' or download from")
|
||||
_, _ = fmt.Fprintln(os.Stdout,
|
||||
"https://sneak.berlin/go/vaultik for embedded version metadata.")
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user