Created
February 20, 2020 08:02
-
-
Save topherPedersen/151b06ad34f9b179e36a490ea8d19cfb to your computer and use it in GitHub Desktop.
Define a Struct in Golang, Instantiate an Instace of that Struct, and Append Items to the Struct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type ServerResponse struct { | |
Songs []string | |
} | |
func main() { | |
var serverResponse ServerResponse | |
serverResponse.Songs = append(serverResponse.Songs, "hello, world") | |
fmt.Println(serverResponse.Songs[0]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment