Skip to content

Instantly share code, notes, and snippets.

@topherPedersen
Created February 20, 2020 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save topherPedersen/151b06ad34f9b179e36a490ea8d19cfb to your computer and use it in GitHub Desktop.
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
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