Unable to parse and run variable in taskfile

69 Views Asked by At

I'm trying to move from Makefile to Taskfile and during the rewrite I find a weird problem

So, in Makefile I was defining variable like this

BUILD_CMD = go build $(FLAGS)

then providing value for FLAGS nad running it with just make build

I'm trying tor recreate the same in taskfile, so

version: '3'

vars:
  OUT_LINUX: lib-linux
  BUILD_CMD: go build $FLAGS

tasks:
  build:
    cmds:
      - echo {{.BUILD_CMD}}
    env:
      FLAGS: -o {{.OUT_LINUX}}

However, running task build just prints out parsed value of BUILD_CMD. I tried adding sh to the echo and still can't run the parsed command.

Am I missing something?

0

There are 0 best solutions below