internal/workflow: make Slice method variadic

Simplify API usage when the caller has multiple values they wish
to make a slice from, allowing:

	Slice([]workflow.Value{v1, v2})

To be written as:

	Slice(v1, v2)

For cases where the caller has a slice, they can do Slice(s...),
which is only 3 extra characters compared to now.

This was motivated by further uses of Slice in an upcoming CL.

For golang/go#53537.

Change-Id: I820ba6eaaa0d833259fed7bb6cc66b12b3f25611
Reviewed-on: https://go-review.googlesource.com/c/build/+/414034
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/internal/relui/workflows.go b/internal/relui/workflows.go
index a6cf9c3..aab04c0 100644
--- a/internal/relui/workflows.go
+++ b/internal/relui/workflows.go
@@ -590,7 +590,7 @@
 	nextVersion := wd.Task("Get next version", version.GetNextVersion, kindVal)
 	milestones := wd.Task("Pick milestones", milestone.FetchMilestones, nextVersion, kindVal)
 	checked := wd.Action("Check blocking issues", milestone.CheckBlockers, milestones, nextVersion, kindVal)
-	dlcl := wd.Task("Mail DL CL", version.MailDLCL, wd.Slice([]workflow.Value{nextVersion}), wd.Constant(false))
+	dlcl := wd.Task("Mail DL CL", version.MailDLCL, wd.Slice(nextVersion), wd.Constant(false))
 	dlclCommit := wd.Task("Wait for DL CL", version.AwaitCL, dlcl, wd.Constant(""))
 	wd.Output("Download CL submitted", dlclCommit)
 
@@ -662,7 +662,7 @@
 			testsPassed = append(testsPassed, long)
 		}
 	}
-	stagedArtifacts := wd.Task("Stage artifacts for signing", tasks.copyToStaging, version, wd.Slice(artifacts))
+	stagedArtifacts := wd.Task("Stage artifacts for signing", tasks.copyToStaging, version, wd.Slice(artifacts...))
 	signedArtifacts := wd.Task("Wait for signed artifacts", tasks.awaitSigned, version, wd.Constant(darwinTargets), stagedArtifacts)
 	signedAndTested := wd.Task("Wait for signing and tests", func(ctx *workflow.TaskContext, artifacts []artifact) ([]artifact, error) {
 		return artifacts, nil
diff --git a/internal/workflow/workflow.go b/internal/workflow/workflow.go
index 2b699b0..47a61a2 100644
--- a/internal/workflow/workflow.go
+++ b/internal/workflow/workflow.go
@@ -201,7 +201,7 @@
 
 // Slice combines multiple Values of the same type into a Value containing
 // a slice of that type.
-func (d *Definition) Slice(vs []Value) Value {
+func (d *Definition) Slice(vs ...Value) Value {
 	if len(vs) == 0 {
 		return &slice{}
 	}
diff --git a/internal/workflow/workflow_test.go b/internal/workflow/workflow_test.go
index f9b6f78..50285d4 100644
--- a/internal/workflow/workflow_test.go
+++ b/internal/workflow/workflow_test.go
@@ -139,7 +139,7 @@
 	in := wd.Task("echo", echo, wd.Constant("string #"))
 	add1 := wd.Task("add 1", appendInt, in, wd.Constant(1))
 	add2 := wd.Task("add 2", appendInt, in, wd.Constant(2))
-	both := wd.Slice([]workflow.Value{add1, add2})
+	both := wd.Slice(add1, add2)
 	out := wd.Task("join", join, both)
 	wd.Output("strings", out)