Skip to content

Instantly share code, notes, and snippets.

@atotto
Created March 29, 2014 08:39
Show Gist options
  • Save atotto/9850837 to your computer and use it in GitHub Desktop.
Save atotto/9850837 to your computer and use it in GitHub Desktop.
package append_test
import "fmt"
func ExampleArrayToSlice() {
arr := []string{"a", "b", "c"}
//arr = append(arr, arr) // Compile error : cannot use arr (type []string) as type string in append
arr = append(arr, arr...)
fmt.Printf("%v", arr)
// Output:
// [a b c a b c]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment