event: Builder.With takes vararg labels

Change Builder.With so that its arg is a ...Label. Implement by
appending the passed labels to the event.

The compiler can prove that the vararg does not escape, so this causes
no allocation for short args.

Remove the WithAll method because it's no longer necessary.

Change-Id: I147d7bcd2c922cb4457dc2be6c4825b01a456d29
Reviewed-on: https://go-review.googlesource.com/c/exp/+/329589
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
diff --git a/event/alloc_test.go b/event/alloc_test.go
index f7a80d8..07fd434 100644
--- a/event/alloc_test.go
+++ b/event/alloc_test.go
@@ -23,7 +23,8 @@
 	e := event.NewExporter(logfmt.NewHandler(ioutil.Discard), nil)
 	ctx := event.WithExporter(context.Background(), e)
 	allocs := int(testing.AllocsPerRun(5, func() {
-		event.To(ctx).With(aString).With(anInt).Log("message")
+		event.To(ctx).With(aString).With(anInt).Log("message1")
+		event.To(ctx).With(aString, anInt).Log("message2")
 	}))
 	if allocs != 0 {
 		t.Errorf("Got %d allocs, expect 0", allocs)
diff --git a/event/builder.go b/event/builder.go
index 0c39d20..1452dcf 100644
--- a/event/builder.go
+++ b/event/builder.go
@@ -97,12 +97,6 @@
 	return clone
 }
 
-// With adds a new label to the event being constructed.
-func (b Builder) With(label Label) Builder {
-	b.addLabel(label)
-	return b
-}
-
 func (b Builder) Name(name string) Builder {
 	if b.data != nil {
 		b.data.Event.Name = name
@@ -119,27 +113,18 @@
 
 func (b builderCommon) addLabel(label Label) {
 	if b.data != nil {
-		b.data.Event.Labels = append(b.data.Event.Labels, label)
 		checkValid(b.data, b.builderID)
 	}
 }
 
-// WithAll adds all the supplied labels to the event being constructed.
-func (b Builder) WithAll(labels ...Label) Builder {
-	b.addLabels(labels)
-	return b
-}
-
-func (b builderCommon) addLabels(labels []Label) {
+// With adds all the supplied labels to the event being constructed.
+func (b Builder) With(labels ...Label) Builder {
 	if b.data == nil || len(labels) == 0 {
-		return
+		return b
 	}
 	checkValid(b.data, b.builderID)
-	if len(b.data.Event.Labels) == 0 {
-		b.data.Event.Labels = labels
-	} else {
-		b.data.Event.Labels = append(b.data.Event.Labels, labels...)
-	}
+	b.data.Event.Labels = append(b.data.Event.Labels, labels...)
+	return b
 }
 
 func (b Builder) At(t time.Time) Builder {