Hi all,
The following works:
steps:
- name: 'gcr.io/cloud-builders/go'
args: ['build', '-o', 'main', '-v', '-ldflags', '"-d"', '-a', '.']
But adding an additional flag to -ldflags does not:
steps:
- name: 'gcr.io/cloud-builders/go'
args: ['build', '-o', 'main', '-v', '-ldflags', '"-d -w"', '-a', '.'] # Added -w flag in flag list
returns flag provided but not defined: -d -w But the -w flag is listed...
Is this expected behaviour? What is the alternative?
Instead of '"-d -w"', use '-d -w'. The quotes you provided are to help the shell figure out that -d and -w go together, but inside cloud build there is no actual shell - just the yaml parser, so '-d -w' is sufficient.
Interesting. Thank you!
Most helpful comment
Instead of
'"-d -w"', use'-d -w'. The quotes you provided are to help the shell figure out that-dand-wgo together, but inside cloud build there is no actual shell - just the yaml parser, so'-d -w'is sufficient.