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
34 lines
797 B
Go
34 lines
797 B
Go
package sort
|
|
|
|
// import (
|
|
// "sort"
|
|
|
|
// "google.golang.org/protobuf/ptypes"
|
|
|
|
// pb "github.com/hashicorp/vagrant/internal/server/gen"
|
|
// )
|
|
|
|
// // ArtifactStartDesc sorts builds by start time descending (most recent first).
|
|
// // For the opposite, use sort.Reverse.
|
|
// type ArtifactStartDesc []*pb.PushedArtifact
|
|
|
|
// func (s ArtifactStartDesc) Len() int { return len(s) }
|
|
// func (s ArtifactStartDesc) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
|
// func (s ArtifactStartDesc) 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 = (ArtifactStartDesc)(nil)
|
|
// )
|