Repository: goreleaser/nfpm
Pull request #118 (2020-01-23 06:43:52)

chore(deps): bump gopkg.in/yaml.v2 from 2.2.7 to 2.2.8
Bumps [gopkg.in/yaml.v2](https://github.com/go-yaml/yaml) from 2.2.7 to 2.2.8.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/go-yaml/yaml/commit/53403b58ad1b561927d19068c655246f2db79d48"><code>53403b5</code></a> Optimize cases with long potential simple_keys (<a href="https://github-redirect.dependabot.com/go-yaml/yaml/issues/555">#555</a>)</li>
<li>See full diff in <a href="https://github.com/go-yaml/yaml/compare/v2.2.7...v2.2.8">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=gopkg.in/yaml.v2&package-manager=go_modules&previous-version=2.2.7&new-version=2.2.8)](https://dependabot.com/compatibility-score.html?dependency-name=gopkg.in/yaml.v2&package-manager=go_modules&previous-version=2.2.7&new-version=2.2.8)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)



</details>

codecov-io: # [Codecov](https://codecov.io/gh/goreleaser/nfpm/pull/118?src=pr&el=h1) Report
> Merging [#118](https://codecov.io/gh/goreleaser/nfpm/pull/118?src=pr&el=desc) into [master](https://codecov.io/gh/goreleaser/nfpm/commit/690f627895f13c761b5e5721099f44e691a91244?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/goreleaser/nfpm/pull/118/graphs/tree.svg?width=650&token=9QKGIxn7wg&height=150&src=pr)](https://codecov.io/gh/goreleaser/nfpm/pull/118?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master     #118   +/-   ##
=======================================
  Coverage   71.34%   71.34%           
=======================================
  Files           5        5           
  Lines         499      499           
=======================================
  Hits          356      356           
  Misses         90       90           
  Partials       53       53
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/goreleaser/nfpm/pull/118?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/goreleaser/nfpm/pull/118?src=pr&el=footer). Last update [690f627...0d2a820](https://codecov.io/gh/goreleaser/nfpm/pull/118?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/deb/deb.go b/deb/deb.go
index 50d5829..dee3b4b 100644
--- a/deb/deb.go
+++ b/deb/deb.go
@@ -380,7 +380,7 @@ Conflicts: {{join .}}
 Homepage: {{.Info.Homepage}}
 {{- end }}
 {{- /* Mandatory fields */}}
-Description: {{.Info.Description}}
+Description: {{multiline .Info.Description}}
 `
 
 type controlData struct {
@@ -394,6 +394,10 @@ func writeControl(w io.Writer, data controlData) error {
 		"join": func(strs []string) string {
 			return strings.Trim(strings.Join(strs, ", "), " ")
 		},
+		"multiline": func(strs string) string {
+			ret := strings.ReplaceAll(strs, "\n", "\n  ")
+			return strings.Trim(ret, " \n")
+		},
 	})
 	return template.Must(tmpl.Parse(controlTemplate)).Execute(w, data)
 }
diff --git a/go.mod b/go.mod
index 3e6a319..5cc5140 100644
--- a/go.mod
+++ b/go.mod
@@ -20,5 +20,5 @@ require (
 	github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
 	golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc // indirect
 	gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
-	gopkg.in/yaml.v2 v2.2.7
+	gopkg.in/yaml.v2 v2.2.8
 )
diff --git a/go.sum b/go.sum
index 03e85c7..c99823d 100644
--- a/go.sum
+++ b/go.sum
@@ -60,3 +60,5 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
 gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=


Test patch:
diff --git a/deb/deb_test.go b/deb/deb_test.go
index b54f04b..535bf1e 100644
--- a/deb/deb_test.go
+++ b/deb/deb_test.go
@@ -305,3 +305,24 @@ func TestDebRules(t *testing.T) {
 	assert.NoError(t, err)
 	assert.Equal(t, string(bts), w.String())
 }
+
+func TestMultilineFields(t *testing.T) {
+	var w bytes.Buffer
+	assert.NoError(t, writeControl(&w, controlData{
+		Info: nfpm.WithDefaults(&nfpm.Info{
+			Name:        "multiline",
+			Arch:        "riscv64",
+			Description: "This field is a\nmultiline field\nthat should work.",
+			Priority:    "extra",
+			Version:     "1.0.0",
+			Section:     "default",
+		}),
+	}))
+	var golden = "testdata/multiline.golden"
+	if *update {
+		require.NoError(t, ioutil.WriteFile(golden, w.Bytes(), 0655))
+	}
+	bts, err := ioutil.ReadFile(golden) //nolint:gosec
+	assert.NoError(t, err)
+	assert.Equal(t, string(bts), w.String())
+}
diff --git a/deb/testdata/multiline.golden b/deb/testdata/multiline.golden
new file mode 100644
index 0000000..4d29e36
--- /dev/null
+++ b/deb/testdata/multiline.golden
@@ -0,0 +1,9 @@
+Package: multiline
+Version: 1.0.0
+Section: default
+Priority: extra
+Architecture: riscv64
+Installed-Size: 0
+Description: This field is a
+  multiline field
+  that should work.