From 263ce3e4b368a50efee1a53af11a76a12af0a119 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 6 Jan 2024 16:23:02 -0500 Subject: Break up migration repo into fs and db with a service --- vendor/gotest.tools/v3/internal/format/format.go | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 vendor/gotest.tools/v3/internal/format/format.go (limited to 'vendor/gotest.tools/v3/internal/format/format.go') diff --git a/vendor/gotest.tools/v3/internal/format/format.go b/vendor/gotest.tools/v3/internal/format/format.go new file mode 100644 index 0000000..5097e4b --- /dev/null +++ b/vendor/gotest.tools/v3/internal/format/format.go @@ -0,0 +1,27 @@ +package format // import "gotest.tools/v3/internal/format" + +import "fmt" + +// Message accepts a msgAndArgs varargs and formats it using fmt.Sprintf +func Message(msgAndArgs ...interface{}) string { + switch len(msgAndArgs) { + case 0: + return "" + case 1: + return fmt.Sprintf("%v", msgAndArgs[0]) + default: + return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) + } +} + +// WithCustomMessage accepts one or two messages and formats them appropriately +func WithCustomMessage(source string, msgAndArgs ...interface{}) string { + custom := Message(msgAndArgs...) + switch { + case custom == "": + return source + case source == "": + return custom + } + return fmt.Sprintf("%s: %s", source, custom) +} -- cgit v1.2.3