fork download
  1. package main
  2. import "fmt"
  3. type Person struct {
  4. Name string
  5. Age int
  6. }
  7. func main() {
  8. people := []Person{}
  9. people = append(people, Person{"Alice", 30})
  10. people = append(people, Person{"Bob", 25})
  11. fmt.Println(people)
  12. people = people[1:] // remove Alice
  13. fmt.Println(people)
  14. }
  15.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
[{Alice 30} {Bob 25}]
[{Bob 25}]