Skip to content

Commit c429bdb

Browse files
committed
More lint
1 parent 3f62020 commit c429bdb

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

cmd/docker-mcp/catalog/bootstrap.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func Bootstrap(ctx context.Context, outputPath string) error {
2929
}
3030

3131
// Parse the Docker catalog to extract server entries
32-
var dockerCatalog map[string]interface{}
32+
var dockerCatalog map[string]any
3333
if err := yaml.Unmarshal(dockerCatalogData, &dockerCatalog); err != nil {
3434
return fmt.Errorf("failed to parse Docker catalog: %w", err)
3535
}
@@ -40,7 +40,7 @@ func Bootstrap(ctx context.Context, outputPath string) error {
4040
return fmt.Errorf("docker catalog missing 'registry' section")
4141
}
4242

43-
registry, ok := registryInterface.(map[string]interface{})
43+
registry, ok := registryInterface.(map[string]any)
4444
if !ok {
4545
return fmt.Errorf("docker catalog 'registry' section is not a map")
4646
}
@@ -57,8 +57,8 @@ func Bootstrap(ctx context.Context, outputPath string) error {
5757
}
5858

5959
// Create bootstrap catalog with just the Docker servers
60-
bootstrapCatalog := map[string]interface{}{
61-
"registry": map[string]interface{}{
60+
bootstrapCatalog := map[string]any{
61+
"registry": map[string]any{
6262
DockerHubServerName: dockerHubServer,
6363
DockerCLIServerName: dockerCLIServer,
6464
},

cmd/docker-mcp/commands/bootstrap_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ func TestBootstrapCatalogCommand(t *testing.T) {
5050
assert.Contains(t, bootstrapContent, catalog.DockerCLIServerName, "bootstrap catalog should contain docker server")
5151

5252
// Parse the YAML to ensure it's valid
53-
var registry map[string]interface{}
53+
var registry map[string]any
5454
err = yaml.Unmarshal(content, &registry)
5555
require.NoError(t, err, "bootstrap catalog should be valid YAML")
5656

5757
// Verify structure
58-
registryMap, ok := registry["registry"].(map[string]interface{})
58+
registryMap, ok := registry["registry"].(map[string]any)
5959
require.True(t, ok, "bootstrap catalog should have registry map")
6060

6161
// Check that we have exactly the Docker servers
@@ -109,7 +109,7 @@ func TestBootstrapInvalidPath(t *testing.T) {
109109
// Test bootstrapping to invalid path (use a file as directory path)
110110
// Create a file that will conflict with the directory creation
111111
conflictFile := filepath.Join(tempHome, "conflict-file")
112-
err := os.WriteFile(conflictFile, []byte("test"), 0644)
112+
err := os.WriteFile(conflictFile, []byte("test"), 0o644)
113113
require.NoError(t, err)
114114

115115
// Try to bootstrap to a path that treats the file as a directory
@@ -172,7 +172,7 @@ func setupTestDockerCatalog(t *testing.T, homeDir string) {
172172
// Create .docker/mcp directory structure
173173
mcpDir := filepath.Join(homeDir, ".docker", "mcp")
174174
catalogsDir := filepath.Join(mcpDir, "catalogs")
175-
err := os.MkdirAll(catalogsDir, 0755)
175+
err := os.MkdirAll(catalogsDir, 0o755)
176176
require.NoError(t, err)
177177

178178
// Create catalog.json registry
@@ -185,7 +185,7 @@ func setupTestDockerCatalog(t *testing.T, homeDir string) {
185185
}
186186
}
187187
}`
188-
err = os.WriteFile(filepath.Join(mcpDir, "catalog.json"), []byte(catalogRegistry), 0644)
188+
err = os.WriteFile(filepath.Join(mcpDir, "catalog.json"), []byte(catalogRegistry), 0o644)
189189
require.NoError(t, err)
190190

191191
// Create minimal docker-mcp.yaml catalog with dockerhub and docker servers
@@ -204,7 +204,7 @@ func setupTestDockerCatalog(t *testing.T, homeDir string) {
204204
image: "docker@sha256:test456"
205205
tools:
206206
- name: "docker"`
207-
err = os.WriteFile(filepath.Join(catalogsDir, "docker-mcp.yaml"), []byte(dockerCatalog), 0644)
207+
err = os.WriteFile(filepath.Join(catalogsDir, "docker-mcp.yaml"), []byte(dockerCatalog), 0o644)
208208
require.NoError(t, err)
209209
}
210210

@@ -215,7 +215,7 @@ func setupDetailedTestDockerCatalog(t *testing.T, homeDir string) {
215215
// Create .docker/mcp directory structure
216216
mcpDir := filepath.Join(homeDir, ".docker", "mcp")
217217
catalogsDir := filepath.Join(mcpDir, "catalogs")
218-
err := os.MkdirAll(catalogsDir, 0755)
218+
err := os.MkdirAll(catalogsDir, 0o755)
219219
require.NoError(t, err)
220220

221221
// Create catalog.json registry
@@ -228,7 +228,7 @@ func setupDetailedTestDockerCatalog(t *testing.T, homeDir string) {
228228
}
229229
}
230230
}`
231-
err = os.WriteFile(filepath.Join(mcpDir, "catalog.json"), []byte(catalogRegistry), 0644)
231+
err = os.WriteFile(filepath.Join(mcpDir, "catalog.json"), []byte(catalogRegistry), 0o644)
232232
require.NoError(t, err)
233233

234234
// Create more detailed docker-mcp.yaml catalog with multiple servers
@@ -291,6 +291,6 @@ func setupDetailedTestDockerCatalog(t *testing.T, homeDir string) {
291291
image: "mcp/elasticsearch@sha256:testxyz"
292292
tools:
293293
- name: "search"`
294-
err = os.WriteFile(filepath.Join(catalogsDir, "docker-mcp.yaml"), []byte(dockerCatalog), 0644)
294+
err = os.WriteFile(filepath.Join(catalogsDir, "docker-mcp.yaml"), []byte(dockerCatalog), 0o644)
295295
require.NoError(t, err)
296296
}

cmd/docker-mcp/commands/catalog_validation_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestDockerCatalogProtection(t *testing.T) {
2929
// Create the MCP directory structure
3030
mcpDir := filepath.Join(tempHome, ".docker", "mcp")
3131
catalogsDir := filepath.Join(mcpDir, "catalogs")
32-
require.NoError(t, os.MkdirAll(catalogsDir, 0755))
32+
require.NoError(t, os.MkdirAll(catalogsDir, 0o755))
3333

3434
// Initialize the catalog system
3535
ctx := context.Background()
@@ -66,7 +66,7 @@ registry:
6666
image: "test/server:latest"
6767
`
6868
dockerCatalogPath := filepath.Join(catalogsDir, "docker-mcp.yaml")
69-
require.NoError(t, os.WriteFile(dockerCatalogPath, []byte(dockerCatalog), 0644))
69+
require.NoError(t, os.WriteFile(dockerCatalogPath, []byte(dockerCatalog), 0o644))
7070

7171
// Forking FROM Docker catalog should work
7272
err := catalog.Fork(catalog.DockerCatalogName, "my-docker-fork")
@@ -89,7 +89,7 @@ registry:
8989
image: "source/server:latest"
9090
`
9191
sourcePath := filepath.Join(catalogsDir, "source.yaml")
92-
require.NoError(t, os.WriteFile(sourcePath, []byte(sourceCatalog), 0644))
92+
require.NoError(t, os.WriteFile(sourcePath, []byte(sourceCatalog), 0o644))
9393

9494
// Try to add to Docker catalog
9595
args := catalog.ParseAddArgs(catalog.DockerCatalogName, "test-server", sourcePath)
@@ -136,7 +136,7 @@ registry:
136136
image: "normal/server:latest"
137137
`
138138
sourcePath := filepath.Join(catalogsDir, "normal-source.yaml")
139-
require.NoError(t, os.WriteFile(sourcePath, []byte(sourceCatalog), 0644))
139+
require.NoError(t, os.WriteFile(sourcePath, []byte(sourceCatalog), 0o644))
140140

141141
args := catalog.ParseAddArgs("normal-catalog", "normal-server", sourcePath)
142142
err = catalog.ValidateArgs(*args)

cmd/docker-mcp/commands/export_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func TestExportInvalidOutputPath(t *testing.T) {
103103
// Test exporting to a path where we can't write (use a file as directory path)
104104
// Create a file that will conflict with the directory creation
105105
conflictFile := filepath.Join(tempHome, "conflict-file")
106-
err := os.WriteFile(conflictFile, []byte("test"), 0644)
106+
err := os.WriteFile(conflictFile, []byte("test"), 0o644)
107107
require.NoError(t, err)
108108

109109
// Try to export to a path that treats the file as a directory
@@ -125,7 +125,7 @@ func setupTestCatalogRegistry(t *testing.T, homeDir string) {
125125
// Create .docker/mcp directory structure
126126
mcpDir := filepath.Join(homeDir, ".docker", "mcp")
127127
catalogsDir := filepath.Join(mcpDir, "catalogs")
128-
err := os.MkdirAll(catalogsDir, 0755)
128+
err := os.MkdirAll(catalogsDir, 0o755)
129129
require.NoError(t, err)
130130

131131
// Create catalog.json registry
@@ -138,7 +138,7 @@ func setupTestCatalogRegistry(t *testing.T, homeDir string) {
138138
}
139139
}
140140
}`
141-
err = os.WriteFile(filepath.Join(mcpDir, "catalog.json"), []byte(catalogRegistry), 0644)
141+
err = os.WriteFile(filepath.Join(mcpDir, "catalog.json"), []byte(catalogRegistry), 0o644)
142142
require.NoError(t, err)
143143

144144
// Create my-catalog.yaml (configured catalog)
@@ -151,6 +151,6 @@ func setupTestCatalogRegistry(t *testing.T, homeDir string) {
151151
container:
152152
image: custom/test-server
153153
command: []`
154-
err = os.WriteFile(filepath.Join(catalogsDir, "my-catalog.yaml"), []byte(customCatalog), 0644)
154+
err = os.WriteFile(filepath.Join(catalogsDir, "my-catalog.yaml"), []byte(customCatalog), 0o644)
155155
require.NoError(t, err)
156156
}

cmd/docker-mcp/commands/feature_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestIsFeatureEnabledTrue(t *testing.T) {
1818
configFile := filepath.Join(tempDir, "config.json")
1919

2020
// Create config with enabled feature
21-
config := map[string]interface{}{
21+
config := map[string]any{
2222
"features": map[string]string{
2323
"configured-catalogs": "enabled",
2424
},

0 commit comments

Comments
 (0)