Не знаю, это поможет, но я просто добавляю свои мысли !!
package main
import "fmt"
func main() {
data := []string{"one", "two", "three"}
//fmt.Println(data)
for index, j := range data {
if index == 0 { //If the value is first one
fmt.Printf("[ '%v', ", j)
} else if len(data) == index+1 { // If the value is the last one
fmt.Printf("'%v' ]", j)
} else {
fmt.Printf(" '%v', ", j) // for all ( middle ) values
}
}
}
OutPut
[ 'one', 'two', 'three' ]
PlayGroundLink