diff --git a/assets/.golangci.yml b/assets/.golangci.yml index 83fd28a..b2710f1 100644 --- a/assets/.golangci.yml +++ b/assets/.golangci.yml @@ -68,7 +68,7 @@ formatters: goimports: local-prefixes: - - {{.GoModule.Name}} + - { { .GoModule.Name } } output: formats: diff --git a/assets/Makefile b/assets/Makefile index ac014a2..c3a899c 100644 --- a/assets/Makefile +++ b/assets/Makefile @@ -23,6 +23,9 @@ ASSETS_DIR ?= assets .PHONY: default default: all +# Verify environment, and define PLUGIN_ID, PLUGIN_VERSION, HAS_SERVER and HAS_WEBAPP as needed. +include build/setup.mk + ifneq ($(MM_DEBUG),) GO_BUILD_GCFLAGS = -gcflags "all=-N -l" else diff --git a/assets/build/_setup.mk b/assets/build/_setup.mk index 9ff3a24..91bcc00 100644 --- a/assets/build/_setup.mk +++ b/assets/build/_setup.mk @@ -5,9 +5,9 @@ ifeq ($(GO),) endif # Gather build variables to inject into the manifest tool -BUILD_HASH_SHORT = $(shell git rev-parse --short HEAD 2>/dev/null) +BUILD_HASH_SHORT = $(shell git rev-parse --short HEAD) BUILD_TAG_LATEST = $(shell git describe --tags --match 'v*' --abbrev=0 2>/dev/null) -BUILD_TAG_CURRENT = $(shell git tag --points-at HEAD 2>/dev/null) +BUILD_TAG_CURRENT = $(shell git tag --points-at HEAD) # Extract the plugin id from the manifest. PLUGIN_ID ?= $(shell pluginctl manifest get '{{"{{"}}.Id{{"}}"}}') diff --git a/manifest.go b/manifest.go index 945c94d..d13a047 100644 --- a/manifest.go +++ b/manifest.go @@ -188,15 +188,7 @@ Examples: } var buf bytes.Buffer - if err := tmpl.Execute(&buf, struct { - model.Manifest - HasWebapp bool - HasServer bool - }{ - Manifest: *manifest, - HasWebapp: HasWebappCode(manifest), - HasServer: HasServerCode(manifest), - }); err != nil { + if err := tmpl.Execute(&buf, *manifest); err != nil { return fmt.Errorf("failed to execute template: %w", err) }