From 1e70916ca7e4d5c0ad00edbfd1877e06d7587fc6 Mon Sep 17 00:00:00 2001 From: "Santiago M. Mola" Date: Thu, 27 Jul 2017 17:16:34 +0200 Subject: format/config: add GoString This is more convenient for testing and debugging. --- plumbing/format/config/option.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'plumbing/format/config/option.go') diff --git a/plumbing/format/config/option.go b/plumbing/format/config/option.go index 3c391c6..481af02 100644 --- a/plumbing/format/config/option.go +++ b/plumbing/format/config/option.go @@ -1,6 +1,7 @@ package config import ( + "fmt" "strings" ) @@ -21,6 +22,15 @@ func (o *Option) IsKey(key string) bool { return strings.ToLower(o.Key) == strings.ToLower(key) } +func (opts Options) GoString() string { + var strs []string + for _, opt := range opts { + strs = append(strs, fmt.Sprintf("%#v", opt)) + } + + return strings.Join(strs, ", ") +} + // Get gets the value for the given key if set, // otherwise it returns the empty string. // -- cgit