mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-22 04:08:49 +02:00
24347358e9
Add a new function `map` to template functions. `map` creates a map from a list of pairs of key values, then you can convert a key to a value using `.Get`. This simplifies writing key-mapping templates. For example, the defaule `archives.name_template` ```yaml name_template: >- {{ .ProjectName }}_ {{- title .Os }}_ {{- if eq .Arch "amd64" }}x86_64 {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} ``` becomes ```yaml name_template: >- {{ $arch := map "amd64" "x86_64" "386" "i386" -}} {{ .ProjectName }}_ {{- title .OS }}_ {{- $arch.Get .Arch .Arch }} {{- if .Arm }}v{{ .Arm }}{{ end }} ``` --------- Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>