Skip to content

Conversation

solvingj
Copy link

@solvingj solvingj commented Sep 3, 2025

Add two new system variables which map directly to platform specific go constants:

  • PATH_LIST_SEPARATOR -> os.PathListSeparator
  • FILE_PATH_SEPARATOR -> os.PathSeparator

Add joinEnv string function which is sibling to joinPath:

  • strings.Join(elem, string(os.PathListSeparator))

Add joinUrl string function which is sibling to joinPath:

  • path.Join(elem...)

Add all to docs

closes #2406

…constants: - PATH_LIST_SEPARATOR -> os.PathListSeparator - FILE_PATH_SEPARATOR -> os.PathSeparator Add joinEnv string function which is sibling to joinPath: - strings.Join(elem, string(os.PathListSeparator)) Add joinUrl string function which is sibling to joinPath: - path.Join(elem...) Add all to docs closes go-task#2406
Copy link
Contributor

@trulede trulede left a comment

Choose a reason for hiding this comment

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

@solvingj there are quite a few functions already in https://go-task.github.io/slim-sprig/ and perhaps its better to use those existing list functions (join, append, prepend) since that gives a better control over how such lists/strings are generated.

The PathSeparator and PathListSeparator are useful however I would suggest following the existing most-predominate naming convention:

  • PathSeparator -> osPathSeparator (note also the absence of "file")
  • PathListSeparator -> osPathListSeparator

since the allcaps just looks ODD.

Observation: this could also be done with a .env file, introducing these constants (and others). Perhaps this PR is more effort than value.

@solvingj
Copy link
Author

Up to @pd93 and @andreynering I suppose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants