1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00
Jo 24347358e9
feat: add map and indexOrDefault template functions (#4317)
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>
2023-09-20 16:03:46 -03:00
..
2023-09-14 13:53:40 -03:00
2023-09-14 13:53:40 -03:00
2023-09-14 13:53:40 -03:00

Documentation

Documentation is written in mkdocs and there are a few extensions that allow richer authoring than markdown.

To iterate with documentation, therefore, it is recommended to run the mkdocs server and view your pages in a browser.

Prerequisites

NOTE to M1/M2 mac owners

If running on an arm64-based mac (M1 or M2, aka "Applie Silicon"), you may find this method quite slow. Until multiarch docker images can be built and made available, you may wish to build your own via:

git clone git@github.com:squidfunk/mkdocs-material.git
docker build -t docker.io/squidfunk/mkdocs-material .