This question already has an answer here:
- Golang: Sorting by Slice Fields 1 answer
I have a slice in golang which looks something like this.
list := []TripInfo{
{
TripID: "uuid2",
infov:true
},
{
TripID: "uuid1",
infov:false
},
}
How can I sort it based on TripID
so that it looks something like this?
list := []TripInfo{
{
TripID: "uuid1",
infov:false
},
{
TripID: "uuid2",
infov:true
},
}
TripInfo is a struct
type TripInfo struct {
TripUUID string
infov bool
}
</div>