I'm generating a makefile
using GO text/template
The template is generated as expected (with the right content ) but the problem is that it’s not indented with tabs and I got errors while running make
command after generation.
This is the output of the template:
all: app app_2
DIR = $(PWD)
.PHONY: app
app:
@echo "run module 1"
.PHONY: app_2
app_2:
@echo "run module 2”
When I run make I got error "makefile:7: *** missing separator. Stop.” (This is the line with the first echo”)
If I change the ideation to tab
(after the file was generated) with Goland
or vsCode
, I was able to run the file successfully and see the expected output..., any idea how to make it work with go text/template ?
This is the template
all: {{- range .Load.Proc}} {{.Name}}{{end}}
{{- range .Load.Proc}}
.PHONY: {{.Name}}
{{.Name}}:
@echo {{.Text}}
{{end}}
This is the makefile issue: makefile:4: *** missing separator. Stop but for me it's a problem since I want to generate the file without the need to manually change the indentation.