package main
import (
"fmt"
"strings"
)
func main() {
test := []string{"one", "two", "three"} // The slice of data
semiformat := fmt.Sprintf("%q\n", test) // Turn the slice into a string that looks like ["one" "two" "three"]
tokens := strings.Split(semiformat, " ") // Split this string by spaces
fmt.Printf(strings.Join(tokens, ", ")) // Join the Slice together (that was split by spaces) with commas
}
package main
import "fmt"
type Project struct{ name string }
func main() {
projects := []Project\{\{"p1"}, {"p2"}}
for i := range projects {
p := projects[i]
fmt.Println(p.name) //p1, p2
}
}