Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Replace path.Join with filepath.Join (#856)" #887

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
3 changes: 2 additions & 1 deletion cmd/cmd_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"os"
"path"
"path/filepath"
"strings"
"time"
Expand Down Expand Up @@ -404,7 +405,7 @@ func printMessageForMissingAtmosConfig(atmosConfig schema.AtmosConfiguration) {
u.PrintMessageInColor("atmos.yaml", c1)
fmt.Println(" CLI config file was not found.")
fmt.Print("\nThe default Atmos stacks directory is set to ")
u.PrintMessageInColor(filepath.Join(atmosConfig.BasePath, atmosConfig.Stacks.BasePath), c1)
u.PrintMessageInColor(path.Join(atmosConfig.BasePath, atmosConfig.Stacks.BasePath), c1)
fmt.Println(",\nbut the directory does not exist in the current path.")
} else {
// If Atmos found an `atmos.yaml` config file, but it defines invalid paths to Atmos stacks and components
Expand Down
6 changes: 3 additions & 3 deletions cmd/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"path"
"runtime"

"github.com/charmbracelet/glamour"
Expand Down Expand Up @@ -59,7 +59,7 @@ var docsCmd = &cobra.Command{
}

// Construct the full path to the Terraform component by combining the Atmos base path, Terraform base path, and component name
componentPath := filepath.Join(atmosConfig.BasePath, atmosConfig.Components.Terraform.BasePath, info.Component)
componentPath := path.Join(atmosConfig.BasePath, atmosConfig.Components.Terraform.BasePath, info.Component)
componentPathExists, err := u.IsDirectory(componentPath)
if err != nil {
u.LogErrorAndExit(schema.AtmosConfiguration{}, err)
Expand All @@ -68,7 +68,7 @@ var docsCmd = &cobra.Command{
u.LogErrorAndExit(schema.AtmosConfiguration{}, fmt.Errorf("Component '%s' not found in path: '%s'", info.Component, componentPath))
}

readmePath := filepath.Join(componentPath, "README.md")
readmePath := path.Join(componentPath, "README.md")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Switch to filepath.Join for cross-platform compatibility

The codebase shows consistent Windows support patterns and platform-specific handling. In file_utils.go and other core utilities, filepath.Join is predominantly used for system paths, while path.Join is used for URL-like paths. Since this code in cmd/docs.go deals with filesystem paths, using filepath.Join would be more appropriate for cross-platform compatibility.

  • Replace path.Join(componentPath, "README.md") with filepath.Join(componentPath, "README.md")
🔗 Analysis chain

Ensure path usage aligns with your platform needs
"filepath.Join" might be safer if Windows is a target.


Let me verify this by checking the codebase for platform-specific considerations and path handling patterns.

This will help us understand:

  1. The usage patterns of path/filepath across the codebase
  2. Any platform-specific considerations in the build
  3. The import patterns for path handling

Let me check specifically how paths are handled in this codebase, particularly focusing on the file utils and path utilities.

🏁 Scripts executed

The following scripts were executed for the analysis:

Error: No shell scripts found


Script:

#!/bin/bash
# Check for platform-specific imports and path handling
rg -l "filepath\.|path\." --type go

# Look for any build constraints or platform-specific code
rg -l "//\s+\+build\s+" --type go

# Check the main package and other key files for OS-specific handling
ast-grep --pattern 'import $_"path/filepath"'
ast-grep --pattern 'import $_"path"'

Length of output: 1264


Script:

#!/bin/bash
# Check path handling in file utils
rg "filepath\.|path\." pkg/utils/file_utils.go -B 2 -A 2

# Check path handling in path utils
rg "filepath\.|path\." internal/exec/path_utils.go -B 2 -A 2

# Look for any Windows-specific handling
rg -i "windows|filepath.separator" --type go

Length of output: 5601

if _, err := os.Stat(readmePath); err != nil {
if os.IsNotExist(err) {
u.LogErrorAndExit(schema.AtmosConfiguration{}, fmt.Errorf("No README found for component: %s", info.Component))
Expand Down
3 changes: 2 additions & 1 deletion internal/exec/atlantis_generate_repo_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package exec

import (
"fmt"
"path"
"path/filepath"
"reflect"
"strings"
Expand Down Expand Up @@ -338,7 +339,7 @@ func ExecuteAtlantisGenerateRepoConfig(
}

// Absolute path to the terraform component
terraformComponentPath := filepath.Join(
terraformComponentPath := path.Join(
atmosConfig.BasePath,
atmosConfig.Components.Terraform.BasePath,
terraformComponent,
Expand Down
6 changes: 3 additions & 3 deletions internal/exec/aws_eks_update_kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package exec

import (
"fmt"
"path/filepath"
"path"
"strings"

"github.com/pkg/errors"
Expand Down Expand Up @@ -158,11 +158,11 @@ func ExecuteAwsEksUpdateKubeconfig(kubeconfigContext schema.AwsEksUpdateKubeconf

configAndStacksInfo.ComponentType = "terraform"
configAndStacksInfo, err = ProcessStacks(atmosConfig, configAndStacksInfo, true, true)
shellCommandWorkingDir = filepath.Join(atmosConfig.TerraformDirAbsolutePath, configAndStacksInfo.ComponentFolderPrefix, configAndStacksInfo.FinalComponent)
shellCommandWorkingDir = path.Join(atmosConfig.TerraformDirAbsolutePath, configAndStacksInfo.ComponentFolderPrefix, configAndStacksInfo.FinalComponent)
if err != nil {
configAndStacksInfo.ComponentType = "helmfile"
configAndStacksInfo, err = ProcessStacks(atmosConfig, configAndStacksInfo, true, true)
shellCommandWorkingDir = filepath.Join(atmosConfig.HelmfileDirAbsolutePath, configAndStacksInfo.ComponentFolderPrefix, configAndStacksInfo.FinalComponent)
shellCommandWorkingDir = path.Join(atmosConfig.HelmfileDirAbsolutePath, configAndStacksInfo.ComponentFolderPrefix, configAndStacksInfo.FinalComponent)
if err != nil {
return err
}
Expand Down
14 changes: 7 additions & 7 deletions internal/exec/describe_affected_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,9 @@ func executeDescribeAffected(
}

// Update paths to point to the cloned remote repo dir
atmosConfig.StacksBaseAbsolutePath = filepath.Join(remoteRepoFileSystemPath, basePath, atmosConfig.Stacks.BasePath)
atmosConfig.TerraformDirAbsolutePath = filepath.Join(remoteRepoFileSystemPath, basePath, atmosConfig.Components.Terraform.BasePath)
atmosConfig.HelmfileDirAbsolutePath = filepath.Join(remoteRepoFileSystemPath, basePath, atmosConfig.Components.Helmfile.BasePath)
atmosConfig.StacksBaseAbsolutePath = path.Join(remoteRepoFileSystemPath, basePath, atmosConfig.Stacks.BasePath)
atmosConfig.TerraformDirAbsolutePath = path.Join(remoteRepoFileSystemPath, basePath, atmosConfig.Components.Terraform.BasePath)
atmosConfig.HelmfileDirAbsolutePath = path.Join(remoteRepoFileSystemPath, basePath, atmosConfig.Components.Helmfile.BasePath)

atmosConfig.StackConfigFilesAbsolutePaths, err = u.JoinAbsolutePathWithPaths(
filepath.Join(remoteRepoFileSystemPath, basePath, atmosConfig.Stacks.BasePath),
Expand Down Expand Up @@ -1182,9 +1182,9 @@ func isComponentFolderChanged(

switch componentType {
case "terraform":
componentPath = filepath.Join(atmosConfig.BasePath, atmosConfig.Components.Terraform.BasePath, component)
componentPath = path.Join(atmosConfig.BasePath, atmosConfig.Components.Terraform.BasePath, component)
case "helmfile":
componentPath = filepath.Join(atmosConfig.BasePath, atmosConfig.Components.Helmfile.BasePath, component)
componentPath = path.Join(atmosConfig.BasePath, atmosConfig.Components.Helmfile.BasePath, component)
}

componentPathAbs, err := filepath.Abs(componentPath)
Expand Down Expand Up @@ -1220,7 +1220,7 @@ func areTerraformComponentModulesChanged(
changedFiles []string,
) (bool, error) {

componentPath := filepath.Join(atmosConfig.BasePath, atmosConfig.Components.Terraform.BasePath, component)
componentPath := path.Join(atmosConfig.BasePath, atmosConfig.Components.Terraform.BasePath, component)

componentPathAbs, err := filepath.Abs(componentPath)
if err != nil {
Expand All @@ -1241,7 +1241,7 @@ func areTerraformComponentModulesChanged(
continue
}

modulePath := filepath.Join(path.Dir(moduleConfig.Pos.Filename), moduleConfig.Source)
modulePath := path.Join(path.Dir(moduleConfig.Pos.Filename), moduleConfig.Source)

modulePathAbs, err := filepath.Abs(modulePath)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions internal/exec/helmfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package exec
import (
"fmt"
"os"
"path/filepath"
"path"

"github.com/pkg/errors"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -78,20 +78,20 @@ func ExecuteHelmfile(info schema.ConfigAndStacksInfo) error {
}

// Check if the component exists as a helmfile component
componentPath := filepath.Join(atmosConfig.HelmfileDirAbsolutePath, info.ComponentFolderPrefix, info.FinalComponent)
componentPath := path.Join(atmosConfig.HelmfileDirAbsolutePath, info.ComponentFolderPrefix, info.FinalComponent)
componentPathExists, err := u.IsDirectory(componentPath)
if err != nil || !componentPathExists {
return fmt.Errorf("'%s' points to the Helmfile component '%s', but it does not exist in '%s'",
info.ComponentFromArg,
info.FinalComponent,
filepath.Join(atmosConfig.Components.Helmfile.BasePath, info.ComponentFolderPrefix),
path.Join(atmosConfig.Components.Helmfile.BasePath, info.ComponentFolderPrefix),
)
}

// Check if the component is allowed to be provisioned (`metadata.type` attribute)
if (info.SubCommand == "sync" || info.SubCommand == "apply" || info.SubCommand == "deploy") && info.ComponentIsAbstract {
return fmt.Errorf("abstract component '%s' cannot be provisioned since it's explicitly prohibited from being deployed "+
"by 'metadata.type: abstract' attribute", filepath.Join(info.ComponentFolderPrefix, info.Component))
"by 'metadata.type: abstract' attribute", path.Join(info.ComponentFolderPrefix, info.Component))
}

// Print component variables
Expand Down Expand Up @@ -196,7 +196,7 @@ func ExecuteHelmfile(info schema.ConfigAndStacksInfo) error {
u.LogDebug(atmosConfig, "Stack: "+info.StackFromArg)
} else {
u.LogDebug(atmosConfig, "Stack: "+info.StackFromArg)
u.LogDebug(atmosConfig, "Stack path: "+filepath.Join(atmosConfig.BasePath, atmosConfig.Stacks.BasePath, info.Stack))
u.LogDebug(atmosConfig, "Stack path: "+path.Join(atmosConfig.BasePath, atmosConfig.Stacks.BasePath, info.Stack))
}

workingDir := constructHelmfileComponentWorkingDir(atmosConfig, info)
Expand Down
6 changes: 3 additions & 3 deletions internal/exec/oci_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"
"path"

"github.com/google/go-containerregistry/pkg/name"
"github.com/google/go-containerregistry/pkg/v1/remote"
Expand All @@ -30,7 +30,7 @@ func processOciImage(atmosConfig schema.AtmosConfiguration, imageName string, de
defer removeTempDir(atmosConfig, tempDir)

// Temp tarball file name
tempTarFileName := filepath.Join(tempDir, uuid.New().String()) + ".tar"
tempTarFileName := path.Join(tempDir, uuid.New().String()) + ".tar"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Use filepath.Join instead of path.Join for cross-platform compatibility
The codebase shows consistent usage of path/filepath package in other files within the internal/exec directory, and there's evidence of Windows-specific handling in shell_utils.go. Since this code processes file paths, it should use filepath.Join instead of path.Join to ensure proper path handling across all platforms.

  • internal/exec/oci_utils.go: Replace path.Join with filepath.Join for tempTarFileName and layerPath variables
🔗 Analysis chain

Temporary tar file path might fail on Windows
If the function is expected to run on Windows, "filepath.Join" is safer.


Let me verify this by checking the codebase for platform-specific code and usage patterns.

This will help us understand:

  1. If there's Windows-specific handling in the codebase
  2. Whether filepath.Join is consistently used elsewhere
  3. The context around the temporary file creation

Let me check for Windows-specific handling in this file and related OCI functionality.

This will help us understand if there's any platform-specific handling in the OCI-related code and surrounding files.

🏁 Scripts executed

The following scripts were executed for the analysis:

Error: No shell scripts found


Script:

#!/bin/bash
# Check if there are any platform-specific imports or conditions for Windows
rg -l "runtime.GOOS" --type go

# Check for filepath package usage
rg "filepath\." --type go

# Look for the specific file content
cat internal/exec/oci_utils.go

Length of output: 11289


Script:

#!/bin/bash
# Check for Windows-specific handling in the package
rg "windows" internal/exec/ -i

# Check for platform-specific path handling in the package
rg "os.(PathSeparator|PathListSeparator)" internal/exec/

# Check if this file or related files use filepath package
rg "\"path/filepath\"" internal/exec/

Length of output: 1220


// Get the image reference from the OCI registry
ref, err := name.ParseReference(imageName)
Expand Down Expand Up @@ -91,7 +91,7 @@ func processOciImage(atmosConfig schema.AtmosConfiguration, imageName string, de

// Extract the layers into the destination directory
for _, l := range manifest.Layers {
layerPath := filepath.Join(tempDir, l)
layerPath := path.Join(tempDir, l)

err = extractTarball(atmosConfig, layerPath, destDir)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions internal/exec/stack_processor_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ func ProcessYAMLConfigFile(

found := false
for _, extension := range extensions {
testPath := filepath.Join(basePath, imp+extension)
testPath := path.Join(basePath, imp+extension)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Use filepath.Join instead of path.Join for OS-agnostic path handling

The code shows mixed usage of path.Join and filepath.Join in the codebase. In this specific case, since testPath is used with os.Stat() for file system operations, we should use filepath.Join to ensure correct path separators on all operating systems, especially Windows.

  • internal/exec/stack_processor_utils.go: Replace path.Join(basePath, imp+extension) with filepath.Join(basePath, imp+extension)

The evidence shows that:

  1. The file uses filepath.Ext and filepath.Walk for other file operations
  2. The testPath is used directly with os.Stat(), which requires OS-specific path separators
  3. Other similar file system operations in the codebase use filepath.Join for OS compatibility
🔗 Analysis chain

Review the glob logic with path vs filepath.
path.Join may create forward slashes on Windows, which could cause missing-file errors.


Let me verify this by checking the codebase for the usage context and platform-specific handling.

This will help us understand:

  1. The context where testPath is used
  2. Whether filepath package is used elsewhere in the file
  3. The overall path handling approach in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Error: No shell scripts found


Script:

#!/bin/bash
# Check the context of the testPath usage and any platform-specific handling
rg -B 5 -A 5 "testPath :=" internal/exec/stack_processor_utils.go

# Look for any filepath package usage in the same file
rg "filepath\." internal/exec/stack_processor_utils.go

# Check if there's any platform-specific path handling
rg -g "*.go" "path[./]Join|filepath[./]Join"

Length of output: 14588

if _, err := os.Stat(testPath); err == nil {
impWithExt = imp + extension
found = true
Expand All @@ -372,12 +372,12 @@ func ProcessYAMLConfigFile(
} else if ext == u.YamlFileExtension || ext == u.YmlFileExtension {
// Check if there's a template version of this file
templatePath := impWithExt + u.TemplateExtension
if _, err := os.Stat(filepath.Join(basePath, templatePath)); err == nil {
if _, err := os.Stat(path.Join(basePath, templatePath)); err == nil {
impWithExt = templatePath
}
}

impWithExtPath := filepath.Join(basePath, impWithExt)
impWithExtPath := path.Join(basePath, impWithExt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Path comparison needs Windows compatibility fixes
The code uses path.Join for path manipulation but performs direct string comparison (impWithExtPath == filePath) without normalizing path separators. This can indeed cause issues on Windows where paths might use different separators. Here's what needs attention:

  • Use filepath.Clean and filepath.ToSlash on both paths before comparison
  • Replace path.Join with filepath.Join for cross-platform compatibility
  • The comparison at line 380 should normalize paths before equality check
🔗 Analysis chain

Ensure self-import check accounts for Windows paths.
Mismatched separators can yield false negatives.


Let me gather information about path handling in the codebase to verify this concern.

This will help us understand:

  1. How paths are handled in the file
  2. If there are tests covering Windows path scenarios
  3. If there's any Windows-specific path handling logic

Let me check how the file paths are actually compared in the codebase to better understand the self-import check implementation.

This will help us understand if there's proper path normalization before comparison and how the self-import check is implemented.

🏁 Scripts executed

The following scripts were executed for the analysis:

Error: No shell scripts found


Script:

#!/bin/bash
# Search for path-related operations and separator handling
rg -U "path\.(Join|Clean|Separator|filepath\.|\\\\|/)" internal/exec/stack_processor_utils.go -A 2

# Look for any path-related tests that might handle Windows paths
fd ".*test.*\.go" internal/exec/ --exec rg -l "path|filepath|windows|separator"

# Search for any Windows-specific path handling
ast-grep --pattern 'if runtime.GOOS == "windows" { $$$ }'

Length of output: 3165


Script:

#!/bin/bash
# Search for the self-import check implementation
rg -U "self.*import|impWithExtPath.*filePath" internal/exec/stack_processor_utils.go -B 5 -A 5

# Check if filepath package is used anywhere in the file
rg "filepath\." internal/exec/stack_processor_utils.go

# Look for path normalization or cleaning
rg "Clean|ToSlash|FromSlash" internal/exec/stack_processor_utils.go

Length of output: 623


if impWithExtPath == filePath {
errorMessage := fmt.Sprintf("invalid import in the manifest '%s'\nThe file imports itself in '%s'",
Expand Down Expand Up @@ -2180,7 +2180,7 @@ func ProcessBaseComponentConfig(
if checkBaseComponentExists {
// Check if the base component exists as Terraform/Helmfile component
// If it does exist, don't throw errors if it is not defined in YAML config
componentPath := filepath.Join(componentBasePath, baseComponent)
componentPath := path.Join(componentBasePath, baseComponent)
componentPathExists, err := u.IsDirectory(componentPath)
if err != nil || !componentPathExists {
return errors.New("The component '" + component + "' inherits from the base component '" +
Expand Down
6 changes: 3 additions & 3 deletions internal/exec/stack_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package exec

import (
"fmt"
"path/filepath"
"path"
"strings"

cfg "github.com/cloudposse/atmos/pkg/config"
Expand Down Expand Up @@ -164,9 +164,9 @@ func BuildComponentPath(

if stackComponentSection, ok := componentSectionMap[cfg.ComponentSectionName].(string); ok {
if componentType == "terraform" {
componentPath = filepath.Join(atmosConfig.BasePath, atmosConfig.Components.Terraform.BasePath, stackComponentSection)
componentPath = path.Join(atmosConfig.BasePath, atmosConfig.Components.Terraform.BasePath, stackComponentSection)
} else if componentType == "helmfile" {
componentPath = filepath.Join(atmosConfig.BasePath, atmosConfig.Components.Helmfile.BasePath, stackComponentSection)
componentPath = path.Join(atmosConfig.BasePath, atmosConfig.Components.Helmfile.BasePath, stackComponentSection)
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/exec/terraform_generate_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package exec

import (
"fmt"
"path/filepath"
"path"

"github.com/pkg/errors"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -75,7 +75,7 @@ func ExecuteTerraformGenerateBackendCmd(cmd *cobra.Command, args []string) error
}

// Write backend config to file
var backendFilePath = filepath.Join(
var backendFilePath = path.Join(
atmosConfig.BasePath,
atmosConfig.Components.Terraform.BasePath,
info.ComponentFolderPrefix,
Expand Down
5 changes: 3 additions & 2 deletions internal/exec/terraform_generate_backends.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package exec
import (
"errors"
"fmt"
"path"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Importing “path” might cause cross-platform file path issues
Revert to “filepath” if these references are local, rather than network or URL paths.

"path/filepath"
"strings"

Expand Down Expand Up @@ -160,7 +161,7 @@ func ExecuteTerraformGenerateBackends(
}

// Path to the terraform component
terraformComponentPath := filepath.Join(
terraformComponentPath := path.Join(
atmosConfig.BasePath,
atmosConfig.Components.Terraform.BasePath,
terraformComponent,
Expand Down Expand Up @@ -290,7 +291,7 @@ func ExecuteTerraformGenerateBackends(

processedTerraformComponents[terraformComponent] = terraformComponent

backendFilePath = filepath.Join(
backendFilePath = path.Join(
terraformComponentPath,
"backend.tf",
)
Expand Down
3 changes: 2 additions & 1 deletion internal/exec/terraform_generate_varfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package exec
import (
"errors"
"fmt"
"path"
"path/filepath"
"strings"

Expand Down Expand Up @@ -159,7 +160,7 @@ func ExecuteTerraformGenerateVarfiles(
}

// Absolute path to the terraform component
terraformComponentPath := filepath.Join(
terraformComponentPath := path.Join(
atmosConfig.BasePath,
atmosConfig.Components.Terraform.BasePath,
terraformComponent,
Expand Down
5 changes: 3 additions & 2 deletions internal/exec/terraform_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"os"
"path"
"path/filepath"
"time"

Expand Down Expand Up @@ -87,7 +88,7 @@ func execTerraformOutput(atmosConfig schema.AtmosConfiguration, component string

// Auto-generate backend file
if atmosConfig.Components.Terraform.AutoGenerateBackendFile {
backendFileName := filepath.Join(componentPath, "backend.tf.json")
backendFileName := path.Join(componentPath, "backend.tf.json")

u.LogTrace(atmosConfig, "\nWriting the backend config to file:")
u.LogTrace(atmosConfig, backendFileName)
Expand Down Expand Up @@ -120,7 +121,7 @@ func execTerraformOutput(atmosConfig schema.AtmosConfiguration, component string
providersSection, ok := sections["providers"].(map[string]any)

if ok && len(providersSection) > 0 {
providerOverrideFileName := filepath.Join(componentPath, "providers_override.tf.json")
providerOverrideFileName := path.Join(componentPath, "providers_override.tf.json")

u.LogTrace(atmosConfig, "\nWriting the provider overrides to file:")
u.LogTrace(atmosConfig, providerOverrideFileName)
Expand Down
8 changes: 4 additions & 4 deletions internal/exec/validate_component.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package exec
import (
"fmt"
"os"
"path/filepath"
"path"

"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
Expand Down Expand Up @@ -197,11 +197,11 @@ func validateComponentInternal(
switch schemaType {
case "jsonschema":
{
filePath = filepath.Join(atmosConfig.BasePath, atmosConfig.Schemas.JsonSchema.BasePath, schemaPath)
filePath = path.Join(atmosConfig.BasePath, atmosConfig.Schemas.JsonSchema.BasePath, schemaPath)
}
case "opa":
{
filePath = filepath.Join(atmosConfig.BasePath, atmosConfig.Schemas.Opa.BasePath, schemaPath)
filePath = path.Join(atmosConfig.BasePath, atmosConfig.Schemas.Opa.BasePath, schemaPath)
}
}

Expand All @@ -228,7 +228,7 @@ func validateComponentInternal(
}
case "opa":
{
modulePathsAbsolute, err := u.JoinAbsolutePathWithPaths(filepath.Join(atmosConfig.BasePath, atmosConfig.Schemas.Opa.BasePath), modulePaths)
modulePathsAbsolute, err := u.JoinAbsolutePathWithPaths(path.Join(atmosConfig.BasePath, atmosConfig.Schemas.Opa.BasePath), modulePaths)
if err != nil {
return false, err
}
Expand Down
Loading
Loading