Skip to content

Add a resolvePath or absPath function #2681

Description

@ssbarnea

Description

Current function templates do not allow someone to resolve a path like like FOO=/foo/bar/zzz with ...

I looked at relPath and the other path related functions but I found none that can resolve paths (ideally even resolving symlinks).

Current workaround is to rely on bash to do it.

Activity

  1. trulede commented on Feb 7, 2026

    @trulede
    Contributor

    Do any of these help? https://sprig.taskfile.dev/

  2. added theissue type on Feb 7, 2026
  3. trulede commented on Feb 19, 2026

    @trulede
    Contributor

    @ssbarnea there are clean functions here (more than one): https://sprig.taskfile.dev/paths.html

    There is a go function EvalSymlinks, it could be added in this repo:
    https://github.com/go-task/slim-sprig/blob/38f81b619418835ccb38a10056359737311c99e3/functions.go#L243

    You can easily try that out, and open a PR there if you want.

  4. Djabx commented on Feb 24, 2026

    @Djabx

    Hi,

    BTW the documentation reference a function joinPath here (cc @ssbarnea it's useful for abspath).

    But I can't find any documentation anywhere here: https://sprig.taskfile.dev/paths.html.

  5. trulede commented on Feb 28, 2026

    @trulede
    Contributor

    The code for all the functions is here, its not difficult to understand:
    https://github.com/go-task/slim-sprig/blob/38f81b619418835ccb38a10056359737311c99e3/functions.go#L243

    For the functions mentioned, you need to wrap the call and consume the err return value. So, like this:

    "osAbs" : func(p string) string {abs, _ := filepath.Abs(p); return abs},

    and the corresponding documentation (https://pkg.go.dev/path/filepath#Abs).

    @Djabx @ssbarnea feel welcome to open a PR for the functions you think are missing. Or missing documentation.

  6. changed the issue type fromtoon Feb 28, 2026
  7. added
    good first issueIssues that are good for first-time contributors to pick up.
    area: templatingChanges related to the templating engine.
    and removed
    state: needs triageWaiting to be triaged by a maintainer.
    on Feb 28, 2026
  8. tsics commented on Mar 4, 2026

    @tsics

    I'd like to contribute. Please assign this issue to me. Thanks!

    @trulede

  9. tsics commented on Mar 4, 2026

    @tsics

    @ssbarnea

    Hi, could you provide a concrete example of the input and expected output? That would help clarify the use case and determine which existing function (if any) could solve the problem.

  10. mateenali66 commented on Mar 25, 2026

    @mateenali66
    Contributor

    opened a PR on slim-sprig to add osAbs: go-task/slim-sprig#23

  11. trulede commented on Apr 13, 2026

    @trulede
    Contributor

    @mateenali66 I think slim-sprig is kind of dead. If you want to add a function its better to open a PR in this repo, here
    https://github.com/go-task/task/blob/main/internal/templater/funcs.go

  12. added a commit that references this issue on Apr 13, 2026
    eefc7ad
  13. mateenali66 commented on Apr 13, 2026

    @mateenali66
    Contributor

    opened #2788 adding absPath directly to internal/templater/funcs.go, thanks for the pointer @trulede. closed go-task/slim-sprig#23 in favor of that.

  14. removed
    good first issueIssues that are good for first-time contributors to pick up.
    on Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: templatingChanges related to the templating engine.

    Fields

    No fields configured for feature.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址