Skip to content

Instantly share code, notes, and snippets.

@disegmvm
Created January 20, 2023 20:06
Show Gist options
  • Save disegmvm/2f0d04594f13d74ba8bc8b43612c0bc1 to your computer and use it in GitHub Desktop.
Save disegmvm/2f0d04594f13d74ba8bc8b43612c0bc1 to your computer and use it in GitHub Desktop.
Declaring slice of car structs you’ll use to start.
package main
type Car struct {
ID string `json:"id"`
Title string `json:"title"`
Color string `json:"color"`
}
var Cars []Car
func main() {
Cars = []Car{
{ID: "1", Title: "BMW", Color: "Black"},
{ID: "2", Title: "Tesla", Color: "Red"},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment