Skip to content

Commit

Permalink
remove direct deps on github.com/golang/protobuf
Browse files Browse the repository at this point in the history
it is outdated and replaced by google.golang.org/protobuf
  • Loading branch information
huww98 committed Jun 18, 2024
1 parent d801e83 commit 7dd7de8
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 656 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ go 1.21
require (
github.com/container-storage-interface/spec v1.9.1-0.20240314114506-2696773158b9
github.com/golang/glog v1.2.1
github.com/golang/protobuf v1.5.4
github.com/kubernetes-csi/csi-lib-utils v0.17.0
github.com/pborman/uuid v1.2.1
github.com/stretchr/testify v1.9.0
golang.org/x/net v0.26.0
google.golang.org/grpc v1.64.0
google.golang.org/protobuf v1.33.0
k8s.io/apimachinery v0.29.0
k8s.io/klog/v2 v2.130.0
k8s.io/kubernetes v1.29.2
Expand All @@ -24,6 +24,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
Expand All @@ -37,7 +38,6 @@ require (
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
11 changes: 5 additions & 6 deletions pkg/hostpath/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ import (
"sort"
"strconv"

"github.com/golang/protobuf/ptypes"

"github.com/golang/glog"
"github.com/golang/protobuf/ptypes/wrappers"
"github.com/pborman/uuid"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
"google.golang.org/protobuf/types/known/wrapperspb"

"github.com/container-storage-interface/spec/lib/go/csi"
"k8s.io/apimachinery/pkg/util/sets"
Expand Down Expand Up @@ -398,11 +397,11 @@ func (hp *hostPath) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest

return &csi.GetCapacityResponse{
AvailableCapacity: available,
MaximumVolumeSize: &wrappers.Int64Value{Value: maxVolumeSize},
MaximumVolumeSize: &wrapperspb.Int64Value{Value: maxVolumeSize},

// We don't have a minimum volume size, so we might as well report that.
// Better explicit than implicit...
MinimumVolumeSize: &wrappers.Int64Value{Value: 0},
MinimumVolumeSize: &wrapperspb.Int64Value{Value: 0},
}, nil
}

Expand Down Expand Up @@ -585,7 +584,7 @@ func (hp *hostPath) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotR
}

snapshotID := uuid.NewUUID().String()
creationTime := ptypes.TimestampNow()
creationTime := timestamppb.Now()
file := hp.getSnapshotPath(snapshotID)

if err := hp.createSnapshotFromVolume(hostPathVolume, file); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/hostpath/groupcontrollerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/golang/glog"
"github.com/golang/protobuf/ptypes"
"github.com/pborman/uuid"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/kubernetes-csi/csi-driver-host-path/pkg/state"
)
Expand Down Expand Up @@ -104,7 +104,7 @@ func (hp *hostPath) CreateVolumeGroupSnapshot(ctx context.Context, req *csi.Crea
groupSnapshot := state.GroupSnapshot{
Name: req.GetName(),
Id: uuid.NewUUID().String(),
CreationTime: ptypes.TimestampNow(),
CreationTime: timestamppb.Now(),
SnapshotIDs: make([]string, len(req.GetSourceVolumeIds())),
SourceVolumeIDs: make([]string, len(req.GetSourceVolumeIds())),
ReadyToUse: true,
Expand Down
6 changes: 3 additions & 3 deletions pkg/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"os"
"sort"

timestamp "github.com/golang/protobuf/ptypes/timestamp"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
)

type AccessType int
Expand Down Expand Up @@ -63,7 +63,7 @@ type Snapshot struct {
Id string
VolID string
Path string
CreationTime *timestamp.Timestamp
CreationTime *timestamppb.Timestamp
SizeBytes int64
ReadyToUse bool
GroupSnapshotID string
Expand All @@ -74,7 +74,7 @@ type GroupSnapshot struct {
Id string
SnapshotIDs []string
SourceVolumeIDs []string
CreationTime *timestamp.Timestamp
CreationTime *timestamppb.Timestamp
ReadyToUse bool
}

Expand Down
180 changes: 0 additions & 180 deletions vendor/github.com/golang/protobuf/ptypes/any.go

This file was deleted.

62 changes: 0 additions & 62 deletions vendor/github.com/golang/protobuf/ptypes/any/any.pb.go

This file was deleted.

10 changes: 0 additions & 10 deletions vendor/github.com/golang/protobuf/ptypes/doc.go

This file was deleted.

0 comments on commit 7dd7de8

Please sign in to comment.