diff --git a/api/v1alpha1/utils.go b/api/v1alpha1/utils.go index f6f3f0089..434578466 100644 --- a/api/v1alpha1/utils.go +++ b/api/v1alpha1/utils.go @@ -8,7 +8,3 @@ func ptrString(s string) *string { func ptrBool(b bool) *bool { return &b } - -func ptrInt(i int) *int { - return &i -} diff --git a/cmd/build_id_test.go b/cmd/build_id_test.go index 6ca11ae18..4e472100e 100644 --- a/cmd/build_id_test.go +++ b/cmd/build_id_test.go @@ -296,18 +296,3 @@ func TestBuildIDCmd(t *testing.T) { } }) } - -// containsBuildID checks if a string contains a substring -func containsBuildID(s, substr string) bool { - return len(s) >= len(substr) && (s == substr || len(substr) == 0 || - (len(s) > len(substr) && (s[:len(substr)] == substr || - s[len(s)-len(substr):] == substr || - func() bool { - for i := 0; i <= len(s)-len(substr); i++ { - if s[i:i+len(substr)] == substr { - return true - } - } - return false - }()))) -} diff --git a/pkg/blueprint/feature_evaluator_test.go b/pkg/blueprint/feature_evaluator_test.go index 296eb2da5..a22452dbc 100644 --- a/pkg/blueprint/feature_evaluator_test.go +++ b/pkg/blueprint/feature_evaluator_test.go @@ -1691,7 +1691,3 @@ func writeTestFile(path, content string) error { _, err = file.WriteString(content) return err } - -func mkdirAll(path string) error { - return os.MkdirAll(path, 0755) -} diff --git a/pkg/config/config_handler_public_test.go b/pkg/config/config_handler_public_test.go index 86d6bee0c..454a07a44 100644 --- a/pkg/config/config_handler_public_test.go +++ b/pkg/config/config_handler_public_test.go @@ -24,7 +24,7 @@ type SetupOptions struct { ConfigStr string } -func setupMocks(t *testing.T, opts ...*SetupOptions) *Mocks { +func setupMocks(t *testing.T, _ ...*SetupOptions) *Mocks { t.Helper() tmpDir := t.TempDir() diff --git a/pkg/generators/git_generator_test.go b/pkg/generators/git_generator_test.go index d86a9b3d0..1732dbd64 100644 --- a/pkg/generators/git_generator_test.go +++ b/pkg/generators/git_generator_test.go @@ -14,9 +14,8 @@ import ( // ============================================================================= const ( - gitGenTestMockGitignorePath = "mock/project/root/.gitignore" - gitGenTestExistingContent = "existing content\n" - gitGenTestExpectedContent = `existing content + gitGenTestExistingContent = "existing content\n" + gitGenTestExpectedContent = `existing content # managed by windsor cli .windsor/ @@ -29,7 +28,6 @@ contexts/**/.talos/ contexts/**/.omni/ contexts/**/.aws/ contexts/**/.azure/` - gitGenTestExpectedPerm = fs.FileMode(0644) ) // ============================================================================= diff --git a/pkg/pipelines/shims.go b/pkg/pipelines/shims.go index d1381d580..acffef3e3 100644 --- a/pkg/pipelines/shims.go +++ b/pkg/pipelines/shims.go @@ -2,30 +2,6 @@ package pipelines import "os" -// osStat retrieves the file info for a given path -var osStat = os.Stat - -// osGetenv retrieves an environment variable -var osGetenv = os.Getenv - -// osSetenv sets an environment variable -var osSetenv = os.Setenv - -// osReadDir reads the directory and returns directory entries -var osReadDir = os.ReadDir - -// osReadFile reads the file and returns its contents -var osReadFile = os.ReadFile - -// osRemoveAll removes a directory and all its contents -var osRemoveAll = os.RemoveAll - -// osMkdirAll creates a directory and all its parents -var osMkdirAll = os.MkdirAll - -// osWriteFile writes data to a file -var osWriteFile = os.WriteFile - // Shims provides a testable interface for system operations used by pipelines. // This struct-based approach allows for better isolation during testing by enabling // dependency injection of mock implementations for file system and environment operations. diff --git a/pkg/workstation/services/shims.go b/pkg/workstation/services/shims.go index 6ba164d25..6c9b399b7 100644 --- a/pkg/workstation/services/shims.go +++ b/pkg/workstation/services/shims.go @@ -59,7 +59,3 @@ func NewShims() *Shims { func ptrString(s string) *string { return &s } - -func ptrBool(b bool) *bool { - return &b -} diff --git a/pkg/workstation/services/talos_service_test.go b/pkg/workstation/services/talos_service_test.go index 19e95467f..fe49109b6 100644 --- a/pkg/workstation/services/talos_service_test.go +++ b/pkg/workstation/services/talos_service_test.go @@ -10,13 +10,6 @@ import ( "github.com/windsorcli/cli/pkg/constants" ) -// Package-level variables for mocking os functions -var ( - stat = os.Stat - mkdir = os.Mkdir - mkdirAll = os.MkdirAll -) - // ============================================================================= // Test Setup // =============================================================================