import ( "container/vector" "fmt" ) func main() { vec := vector.New(0) vec.Push("apple") vec.Push("banana") vec.Push("orange") fmt.Println(vec) // [apple banana orange] }
import ( "container/vector" "fmt" ) type Employee struct { Name string Salary float64 } func main() { vec := vector.New(0) emp1 := Employee{"John", 5000.00} emp2 := Employee{"Sam", 6000.00} vec.Push(emp1) vec.Push(emp2) fmt.Println(vec) // [{John 5000} {Sam 6000}] }In this example, a new vector is created with length 0 using `vector.New(0)`. Then, two `Employee` structs are created and added to the vector using the `Push` method. Finally, the contents of the vector are printed using `fmt.Println`.