INNER CODE UNIT · Go

GenerateName

terraform-lxd/terraform-provider-lxd · internal/acctest/testutils.go:25

func GenerateName(words int, separator string) string {
	if words <= 1 {
		return petname.Name()
	}

	return petname.Generate(words-1, separator) + separator + generateString(6)
}

// QuoteStrings converts slice of strings into a single string where each slice
// element is quoted and delimited with a comma and whitespace.
func QuoteStrings(slice []string) string {
	quoted := make([]string, len(slice))
	for i, s := range slice {
		quoted[i] = fmt.Sprintf("%q", s)
	}
	return strings.Join(quoted, ", ")
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…