summary refs log tree commit diff
path: root/.config/yamlfs/go.yaml
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-11-18 17:42:16 +0100
committerRobert Günzler <r@gnzler.io>2022-11-18 18:38:20 +0100
commitd6afa4cb7fbd919989b12277f1e67bbf883a2853 (patch)
tree2ce0de9cbcfccd401b276099f90645660eaaa73e /.config/yamlfs/go.yaml
parenta8127ecbecc0f0da64c0e6714e8553dda6e0e329 (diff)
yamlfs: update
Diffstat (limited to '.config/yamlfs/go.yaml')
-rw-r--r--.config/yamlfs/go.yaml22
1 files changed, 13 insertions, 9 deletions
diff --git a/.config/yamlfs/go.yaml b/.config/yamlfs/go.yaml
index 34a1979..96f6599 100644
--- a/.config/yamlfs/go.yaml
+++ b/.config/yamlfs/go.yaml
@@ -1,3 +1,4 @@
+{% $man := .man %}
 cmd:
   {% .name %}:
     main.go: |
@@ -17,6 +18,9 @@ version:
     	Version = "0.0.0+unknown"
     )
 
+go.mod: |
+{% exec "sh" "-c" (printf "cd /tmp/;go mod init %s;cat go.mod;rm go.mod;" .pkg) | indent 4 %}
+
 Makefile: |
   .POSIX:
 
@@ -29,7 +33,7 @@ Makefile: |
   GO           ?= go
   GOLINT       ?= $(GO) vet # golangci-lint run --build-tags "$(GO_BUILDTAGS)"
   GOTEST       ?= $(GO) test # gotestsum --format=testname --
-  {% if .man -%}
+  {% if $man -%}
   SCDOC        ?= scdoc
   {%- end %}
   
@@ -38,7 +42,7 @@ Makefile: |
   GOTEST_FLAGS ?=
   GOLINT_FLAGS ?=
 
-  all: lint test build {% if .man %}man{% end %}
+  all: lint test build {% if $man %}man{% end %}
 
   .PHONY: build
   build: {% .name %}
@@ -47,7 +51,7 @@ Makefile: |
   {% .name %}: GO_VERSIONFLAGS += -X $(GO_PKG)/version.Version=$(VERSION)
   {% .name %}: GO_VERSIONFLAGS += -X $(GO_PKG)/version.Revision=$(REVISION)
   {% .name %}: GO_VERSIONFLAGS += -X $(GO_PKG)/version.Package=$(GO_PKG)
-  {% .name %}:
+  {% .name %}: $(shell find . -name '*.go')
   	$(GO) build -o $(DESTDIR)$(PREFIX)/$@ -tags '$(GO_BUILDTAGS)' -ldflags '$(GO_LDFLAGS) $(GO_VERSIONFLAGS)' ./cmd/$@
 
   .PHONY: lint
@@ -62,7 +66,7 @@ Makefile: |
   .PHONY: check
   check: test
 
-  {% if .man %}
+  {% if $man %}
   manpages = doc/{% .name %}.1
   $(manpages): %: %.scd
   $(manpages):
@@ -79,18 +83,18 @@ Makefile: |
   .PHONY: install
   install:
   	mkdir -p $(DESTDIR)$(BINDIR)
-  	{% if .man -%}
+	{% if $man -%}
   	mkdir -p $(DESTDIR)$(MANDIR)/man1
   	{%- end %}
   	cp -f {% .name %} $(DESTDIR)$(BINDIR)
-  	{% if .man -%}
+	{% if $man -%}
   	cp -f doc/{% .name %}.1 $(DESTDIR)$(MANDIR)/man1
   	{%- end %}
 
   .PHONY: uninstall
   uninstall:
   	rm -v $(DESTDIR)$(BINDIR)/{% .name %}
-  	{% if .man -%}
+	{% if $man -%}
   	rm -v $(DESTDIR)$(MANDIR)/man1/{% .name %}.1
   	{%- end %}
 
@@ -119,7 +123,7 @@ Makefile: |
 
   [{Makefile,go.mod,go.sum,*go}]
   indent_style = tab
-  indent_size = 8
+  indent_size = 4
 
   [*.md]
   trim_trailing_whitespace = false
@@ -132,7 +136,7 @@ README.md: |
 
   TODO
 
-{% if .man %}
+{% if $man %}
 doc:
   {% .name %}.1.scd: |
     {% .name %}(1)