Skip to content

Commit 3d70bb4

Browse files
jackspirouclaude
andcommitted
fix(lint): resolve linting issues and improve Go idioms
Fixed all linting errors and followed Go best practices: 1. Fixed errcheck warnings in fetch/models.go by adding nolint directive for display output functions where write errors are not critical 2. Resolved function name stuttering issues in format package by renaming: - FormatModels → Models - FormatProviders → Providers - FormatAuthors → Authors - FormatAny → Any This follows standard library patterns (e.g., json.Marshal not json.JSONMarshal) 3. Fixed MarkDeprecated errcheck warning in execute.go by explicitly ignoring the error with blank identifier 4. Added OUTPUT environment variable as backwards-compatible alias for FORMAT via viper.BindEnv to maintain compatibility with existing configurations 5. Updated generated documentation and OpenAPI specs All tests now pass and linter reports 0 issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8adfb72 commit 3d70bb4

24 files changed

Lines changed: 214 additions & 119 deletions

File tree

cmd/starmap/app/app_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ func TestApp_WithOptions(t *testing.T) {
229229
customConfig := &Config{
230230
Verbose: true,
231231
Quiet: false,
232-
Output: "json",
232+
Format: "json",
233233
}
234234

235235
// Create custom logger

cmd/starmap/app/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ func LoadConfig() (*Config, error) {
5353
viper.AutomaticEnv()
5454
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_", "-", "_"))
5555

56+
// Bind format with OUTPUT as backwards-compatible alias
57+
_ = viper.BindEnv("format", "FORMAT", "OUTPUT")
58+
5659
// Bind common API keys
5760
bindAPIKeys()
5861

cmd/starmap/app/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ func TestConfig_EnvironmentVariables(t *testing.T) {
4747
if !config.Verbose {
4848
t.Error("VERBOSE environment variable not loaded")
4949
}
50-
if config.Output != "json" {
51-
t.Errorf("OUTPUT = %s, want json", config.Output)
50+
if config.Format != "json" {
51+
t.Errorf("FORMAT = %s, want json", config.Format)
5252
}
5353
}
5454

cmd/starmap/app/execute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ when API keys are configured.`,
5858

5959
// Add --output as deprecated alias for --format (backwards compatibility)
6060
rootCmd.PersistentFlags().StringVar(&a.config.Format, "output", "", "")
61-
rootCmd.PersistentFlags().MarkDeprecated("output", "use --format instead")
61+
_ = rootCmd.PersistentFlags().MarkDeprecated("output", "use --format instead")
6262

6363
// Customize version output to match version subcommand
6464
rootCmd.SetVersionTemplate("starmap {{.Version}}\n")

cmd/starmap/cmd/auth/print.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"github.com/agentstation/starmap/internal/auth/adc"
1313
"github.com/agentstation/starmap/internal/cmd/application"
1414
"github.com/agentstation/starmap/internal/cmd/emoji"
15-
"github.com/agentstation/starmap/internal/cmd/notify"
1615
"github.com/agentstation/starmap/internal/cmd/format"
16+
"github.com/agentstation/starmap/internal/cmd/notify"
1717
"github.com/agentstation/starmap/pkg/catalogs"
1818
)
1919

cmd/starmap/cmd/auth/verify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"github.com/agentstation/starmap/internal/auth"
1212
"github.com/agentstation/starmap/internal/cmd/application"
1313
"github.com/agentstation/starmap/internal/cmd/emoji"
14-
"github.com/agentstation/starmap/internal/cmd/notify"
1514
"github.com/agentstation/starmap/internal/cmd/format"
15+
"github.com/agentstation/starmap/internal/cmd/notify"
1616
"github.com/agentstation/starmap/pkg/catalogs"
1717
"github.com/agentstation/starmap/pkg/sources"
1818
)

cmd/starmap/cmd/deps/print.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"os"
66

77
"github.com/agentstation/starmap/internal/cmd/emoji"
8-
"github.com/agentstation/starmap/internal/cmd/globals"
98
"github.com/agentstation/starmap/internal/cmd/format"
9+
"github.com/agentstation/starmap/internal/cmd/globals"
1010
)
1111

1212
// displayResults shows dependency check results in the requested format.

cmd/starmap/cmd/fetch/models.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ func fetchAllProvidersRaw(ctx context.Context, app application.Application, vali
425425
}
426426

427427
// displayFetchStats displays fetch statistics to the provided writer (typically stderr).
428+
//
429+
//nolint:errcheck // Ignoring write errors for display output
428430
func displayFetchStats(w io.Writer, providerID catalogs.ProviderID, stats *sources.FetchStats) {
429431
fmt.Fprintf(w, "\n%s Request Statistics:\n", emoji.Info)
430432
fmt.Fprintf(w, " Provider: %s\n", providerID)

cmd/starmap/cmd/list/authors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111

1212
"github.com/agentstation/starmap/internal/cmd/application"
1313
"github.com/agentstation/starmap/internal/cmd/constants"
14-
"github.com/agentstation/starmap/internal/cmd/globals"
1514
"github.com/agentstation/starmap/internal/cmd/format"
15+
"github.com/agentstation/starmap/internal/cmd/globals"
1616
"github.com/agentstation/starmap/internal/cmd/table"
1717
"github.com/agentstation/starmap/pkg/catalogs"
1818
"github.com/agentstation/starmap/pkg/errors"

cmd/starmap/cmd/list/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"github.com/agentstation/starmap/internal/cmd/application"
1313
cmdconstants "github.com/agentstation/starmap/internal/cmd/constants"
1414
"github.com/agentstation/starmap/internal/cmd/filter"
15-
"github.com/agentstation/starmap/internal/cmd/globals"
1615
"github.com/agentstation/starmap/internal/cmd/format"
16+
"github.com/agentstation/starmap/internal/cmd/globals"
1717
"github.com/agentstation/starmap/internal/cmd/table"
1818
"github.com/agentstation/starmap/pkg/catalogs"
1919
"github.com/agentstation/starmap/pkg/convert"

0 commit comments

Comments
 (0)