Skip to content

templater: add joinEnv helper for PATH-like vars - #2733

Closed
SergioChan wants to merge 1 commit into
go-task:mainfrom
SergioChan:fix-joinenv-2406
Closed

templater: add joinEnv helper for PATH-like vars#2733
SergioChan wants to merge 1 commit into
go-task:mainfrom
SergioChan:fix-joinenv-2406

Conversation

@SergioChan

Copy link
Copy Markdown
Contributor

Summary

  • add a new joinEnv template helper that joins path-like values with the OS-specific path list separator (: on POSIX, ; on Windows)
  • expose joinEnv in the templater function map so Taskfiles can build cross-platform PATH values cleanly
  • add unit coverage for both direct helper behavior and template function registration

Testing

  • git diff --check
  • go test ./internal/templater (not runnable in this environment: required Go toolchain go1.25 is unavailable via GOTOOLCHAIN download)

Related

Fixes #2406

return shell.Fields(s, nil)
}

func joinEnv(elems ...string) string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would suggest to call this function pathJoinList.

@trulede

trulede commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

A more succinct solution to duplicate #2408

@trulede trulede added the area: templating Changes related to the templating engine. label Mar 14, 2026
@SergioChan

Copy link
Copy Markdown
Contributor Author

Thanks, agree this should be more succinct and we should avoid redundant direction with #2408.

I’ll revisit this with a tighter approach and either update this PR accordingly or close it if superseded.

@trulede trulede closed this Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: templating Changes related to the templating engine.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

joinEnv - Just like joinPath but with ; for windows else :

2 participants