add slice
This commit is contained in:
18
single_file_tests/slice.go
Normal file
18
single_file_tests/slice.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := make([]string, 0)
|
||||
s = append(s, "Hello", "World")
|
||||
|
||||
j, err := json.Marshal(s)
|
||||
if err != nil {
|
||||
fmt.Println("ERROR: ", err)
|
||||
return
|
||||
}
|
||||
fmt.Println(string(j))
|
||||
}
|
||||
Reference in New Issue
Block a user