refactor: use official golangci-lint image for lint stage
All checks were successful
check / check (push) Successful in 1m15s

Restructure Dockerfile to match upaas/dnswatcher pattern:
- Separate lint stage using golangci/golangci-lint:v2.1.6 image
- Builder stage for tests and compilation (no lint dependency)
- Add fmt-check Makefile target
- Decouple test from lint in Makefile (lint runs in its own stage)
- Run gofmt on all files
- docker build verified passing locally
This commit is contained in:
clawbot
2026-03-10 12:36:19 -07:00
parent 9be6e2a4eb
commit f8e8eec43d
12 changed files with 42 additions and 52 deletions

View File

@@ -1,10 +1,10 @@
package cli
import (
"log"
"encoding/json"
"fmt"
"io"
"log"
"path/filepath"
"runtime"
"strings"

View File

@@ -1,8 +1,8 @@
package cli
import (
"log"
"fmt"
"log"
"log/slog"
"os"
"path/filepath"

View File

@@ -2285,6 +2285,7 @@ func verifyFileExists(t *testing.T, path string) {
}
// verifyFileNotExists checks if a file does not exist at the given path
//
//nolint:unused // kept for future use
func verifyFileNotExists(t *testing.T, path string) {
t.Helper()

View File

@@ -1,10 +1,10 @@
package cli
import (
"log"
"encoding/json"
"fmt"
"io"
"log"
"path/filepath"
"strings"

View File

@@ -1,9 +1,9 @@
package cli
import (
"log"
"encoding/json"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"

View File

@@ -1,9 +1,9 @@
package cli
import (
"log"
"encoding/json"
"fmt"
"log"
"os"
"path/filepath"
"strings"

View File

@@ -1,8 +1,8 @@
package cli
import (
"log"
"fmt"
"log"
"path/filepath"
"strings"
"text/tabwriter"

View File

@@ -26,12 +26,12 @@ type realVault struct {
func (v *realVault) GetDirectory() (string, error) {
return filepath.Join(v.stateDir, "vaults.d", v.name), nil
}
func (v *realVault) GetName() string { return v.name }
func (v *realVault) GetName() string { return v.name }
func (v *realVault) GetFilesystem() afero.Fs { return v.fs }
// Unused by getLongTermPrivateKey — these satisfy VaultInterface.
func (v *realVault) AddSecret(string, *memguard.LockedBuffer, bool) error { panic("not used") }
func (v *realVault) GetCurrentUnlocker() (Unlocker, error) { panic("not used") }
func (v *realVault) GetCurrentUnlocker() (Unlocker, error) { panic("not used") }
func (v *realVault) CreatePassphraseUnlocker(*memguard.LockedBuffer) (*PassphraseUnlocker, error) {
panic("not used")
}

View File

@@ -284,11 +284,11 @@ func TestSecretNameValidation(t *testing.T) {
{"valid/path/name", true},
{"123valid", true},
{"", false},
{"Valid-Upper-Name", true}, // uppercase allowed
{"2025-11-21-ber1app1-vaultik-test-bucket-AKI", true}, // real-world uppercase key ID
{"MixedCase/Path/Name", true}, // mixed case with path
{"invalid name", false}, // space not allowed
{"invalid@name", false}, // @ not allowed
{"Valid-Upper-Name", true}, // uppercase allowed
{"2025-11-21-ber1app1-vaultik-test-bucket-AKI", true}, // real-world uppercase key ID
{"MixedCase/Path/Name", true}, // mixed case with path
{"invalid name", false}, // space not allowed
{"invalid@name", false}, // @ not allowed
}
for _, test := range tests {

View File

@@ -154,4 +154,3 @@ func TestValidateGPGKeyID(t *testing.T) {
})
}
}