Paul Hinze 8b5d4b8631
Update and address protobuf package deprecations
These changes address the following warning showing up on `go get`
operations:

    go: module github.com/golang/protobuf is deprecated: Use the
    "google.golang.org/protobuf" module instead.

All changes are made using the recommendations in the per-function
deprecation notices from the docs at
https://pkg.go.dev/github.com/golang/protobuf/ptypes
2022-06-08 11:51:19 -05:00

34 lines
770 B
Go

package sort
// import (
// "sort"
// "google.golang.org/protobuf/ptypes"
// pb "github.com/hashicorp/vagrant/internal/server/gen"
// )
// // BuildStartDesc sorts builds by start time descending (most recent first).
// // For the opposite, use sort.Reverse.
// type BuildStartDesc []*pb.Build
// func (s BuildStartDesc) Len() int { return len(s) }
// func (s BuildStartDesc) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
// func (s BuildStartDesc) Less(i, j int) bool {
// t1, err := ptypes.Timestamp(s[i].Status.StartTime)
// if err != nil {
// return false
// }
// t2, err := ptypes.Timestamp(s[j].Status.StartTime)
// if err != nil {
// return false
// }
// return t2.Before(t1)
// }
// var (
// _ sort.Interface = (BuildStartDesc)(nil)
// )