func MaybeUseServiceAccount(
	serviceAccount string,
	useServiceAccount bool,
	cmd []string) []string {
	if useServiceAccount && len(serviceAccount) > 0 {
		cmd = append(cmd, "")
		copy(cmd[2:], cmd[1:])
		cmd[1] = fmt.Sprintf("--account=%v", serviceAccount)
	}
	return cmd
}
MaybeUseServiceAccount injects a '--account=...' argument to the command with
the given service account.
package gcloud
import (
	"encoding/csv"
	"fmt"
	"io"
	"strings"
	"github.com/sirupsen/logrus"
	"sigs.k8s.io/release-utils/command"
)
type Token string
func GetServiceAccountToken(
	serviceAccount string,
	useServiceAccount bool) (Token, error) {
	args := []string{
		"auth",
		"print-access-token",
	}
	args = MaybeUseServiceAccount(serviceAccount, useServiceAccount, args)
	cmd := command.New("gcloud", args...)
	std, err := cmd.RunSilentSuccessOutput()
	if err != nil {
		logrus.Errorf("could not execute cmd %v", cmd)
		return "", err
	}
	stdout := std.Output()
	token := Token(strings.TrimSpace(stdout))
	return token, nil
}