From 612b12d1e09f7cdc6106fd49ebcb74b56344819c Mon Sep 17 00:00:00 2001 From: Brian Buller Date: Thu, 24 Aug 2017 12:17:56 -0500 Subject: [PATCH] Finished go/two-fer --- go/two-fer/two_fer.go | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/go/two-fer/two_fer.go b/go/two-fer/two_fer.go index c23982e..989a6f9 100644 --- a/go/two-fer/two_fer.go +++ b/go/two-fer/two_fer.go @@ -1,15 +1,13 @@ -// This is a "stub" file. It's a little start on your solution. -// It's not a complete solution though; you have to write some code. - -// Package twofer should have a package comment that summarizes what it's about. -// https://golang.org/doc/effective_go.html#commentary package twofer -// ShareWith needs a comment documenting it. -func ShareWith(string) string { - // Write some code here to pass the test suite. - // Then remove all the stock comments. - // They're here to help you get started but they only clutter a finished solution. - // If you leave them in, reviewers will protest! - return "" +import "fmt" + +// ShareWith just returns "One for , one for me." +// if is empty, use "you" +func ShareWith(who string) string { + ret := "One for %s, one for me." + if who == "" { + who = "you" + } + return fmt.Sprintf(ret, who) }