1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

Fix parsing of repo options.

Before this it break when leaving, for example,
the `brew` section empty.
This commit is contained in:
Jorin Vogel 2017-01-19 09:05:20 +01:00
parent aa1699747e
commit 22dd16df81
2 changed files with 19 additions and 0 deletions

View File

@ -31,5 +31,8 @@ func (Pipe) Run(ctx *context.Context) (err error) {
func split(pair string) (string, string) {
parts := strings.Split(pair, "/")
if len(parts) == 1 {
return parts[0], ""
}
return parts[0], parts[1]
}

View File

@ -11,4 +11,20 @@ func TestSplit(t *testing.T) {
a, b := split("a/b")
assert.Equal("a", a)
assert.Equal("b", b)
a, b = split("")
assert.Equal("", a)
assert.Equal("", b)
a, b = split("a")
assert.Equal("a", a)
assert.Equal("", b)
a, b = split("a/")
assert.Equal("a", a)
assert.Equal("", b)
a, b = split("/b")
assert.Equal("", a)
assert.Equal("b", b)
}