Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
Snapshot: fix gofmt and golint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmetana committed Sep 4, 2017
1 parent 01fddeb commit 0c2b15a
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ import (
"github.com/kubernetes-incubator/external-storage/snapshot/pkg/volume/cinder"
"github.com/kubernetes-incubator/external-storage/snapshot/pkg/volume/gce_pd"
"github.com/kubernetes-incubator/external-storage/snapshot/pkg/volume/hostpath"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/api/core/v1"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
Expand Down Expand Up @@ -134,7 +134,7 @@ func (p *snapshotProvisioner) Provision(options controller.VolumeOptions) (*v1.P
}
// FIXME: should also check if any VolumeSnapshotData points to this VolumeSnapshot
if len(snapshot.Spec.SnapshotDataName) == 0 {
return nil, fmt.Errorf("VolumeSnapshot %s is not bound to any VolumeSnapshotData", snapshotName, err)
return nil, fmt.Errorf("VolumeSnapshot %s is not bound to any VolumeSnapshotData", snapshotName)
}
var snapshotData crdv1.VolumeSnapshotData
err = p.crdclient.Get().
Expand Down Expand Up @@ -191,7 +191,7 @@ func (p *snapshotProvisioner) Delete(volume *v1.PersistentVolume) error {
return errors.New("identity annotation not found on PV")
}
if ann != p.identity {
return &controller.IgnoredError{"identity annotation on PV does not match ours"}
return &controller.IgnoredError{Reason: "identity annotation on PV does not match ours"}
}

volumeType := crdv1.GetSupportedVolumeFromPVSpec(&volume.Spec)
Expand Down
6 changes: 3 additions & 3 deletions snapshot/pkg/apis/crd/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ func GetSupportedVolumeFromPVSpec(spec *core_v1.PersistentVolumeSpec) string {
if spec.GCEPersistentDisk != nil {
return "gce-pd"
}
if spec.Cinder != nil {
return "cinder"
}
if spec.Cinder != nil {
return "cinder"
}
return ""
}

Expand Down
2 changes: 1 addition & 1 deletion snapshot/pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import (

"github.com/golang/glog"
crdv1 "github.com/kubernetes-incubator/external-storage/snapshot/pkg/apis/crd/v1"
apiv1 "k8s.io/api/core/v1"
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/util/wait"
apiv1 "k8s.io/api/core/v1"
"k8s.io/client-go/rest"
)

Expand Down
2 changes: 1 addition & 1 deletion snapshot/pkg/cloudprovider/providers/aws/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import (

"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/golang/glog"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/api/core/v1"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
Expand Down
16 changes: 8 additions & 8 deletions snapshot/pkg/cloudprovider/providers/openstack/openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ import (
"gopkg.in/gcfg.v1"

"github.com/kubernetes-incubator/external-storage/snapshot/pkg/cloudprovider"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
netutil "k8s.io/apimachinery/pkg/util/net"
certutil "k8s.io/client-go/util/cert"
"k8s.io/api/core/v1"
"k8s.io/kubernetes/pkg/controller"
)

Expand Down Expand Up @@ -179,13 +179,13 @@ func (c *Caller) Call(f func()) {
}

func init() {
cloudprovider.RegisterCloudProvider(ProviderName, func(config io.Reader) (cloudprovider.Interface, error) {
cfg, err := readConfig(config)
if err != nil {
return nil, err
}
return newOpenStack(cfg)
})
cloudprovider.RegisterCloudProvider(ProviderName, func(config io.Reader) (cloudprovider.Interface, error) {
cfg, err := readConfig(config)
if err != nil {
return nil, err
}
return newOpenStack(cfg)
})
}

func newOpenStack(cfg Config) (*OpenStack, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ func (snapshots *SnapshotsV2) createSnapshot(opts SnapshotCreateOpts) (string, e

func (snapshots *SnapshotsV2) getSnapshot(snapshotID string) (Snapshot, error) {
var snap Snapshot
glog.Infof("getSnapshot for snapshotID: %s.", snapshotID)
snapshot, err := snapshotsV2.Get(snapshots.blockstorage, snapshotID).Extract()
if err != nil {
return snap, err
}
glog.Infof("Snapshot details: %#v", snapshot)
snap.ID = snapshot.ID
snap.Name = snapshot. Name
snap.Status = snapshot.Status
snap.SourceVolumeID = snapshot.VolumeID
glog.Infof("getSnapshot for snapshotID: %s.", snapshotID)
snapshot, err := snapshotsV2.Get(snapshots.blockstorage, snapshotID).Extract()
if err != nil {
return snap, err
}
glog.Infof("Snapshot details: %#v", snapshot)
snap.ID = snapshot.ID
snap.Name = snapshot.Name
snap.Status = snapshot.Status
snap.SourceVolumeID = snapshot.VolumeID

return snap, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/runtime"

"k8s.io/client-go/kubernetes"
apiv1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
kcache "k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
Expand Down
4 changes: 2 additions & 2 deletions snapshot/pkg/controller/snapshotter/snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (

"github.com/golang/glog"

v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/client-go/kubernetes"
v1 "k8s.io/api/core/v1"
"k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/util/goroutinemap"
"k8s.io/kubernetes/pkg/util/goroutinemap/exponentialbackoff"
Expand Down Expand Up @@ -102,7 +102,7 @@ func (vs *volumeSnapshotter) getPVFromVolumeSnapshot(snapshotName string, snapsh
return nil, fmt.Errorf("Failed to retrieve PVC %s from the API server: %q", pvcName, err)
}
if pvc.Status.Phase != v1.ClaimBound {
return nil, fmt.Errorf("The PVC %s not yet bound to a PV, will not attempt to take a snapshot yet.")
return nil, fmt.Errorf("The PVC %s not yet bound to a PV, will not attempt to take a snapshot yet.", pvcName)
}

pvName := pvc.Spec.VolumeName
Expand Down
2 changes: 1 addition & 1 deletion snapshot/pkg/volume/hostpath/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"os"
"os/exec"

"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/uuid"

crdv1 "github.com/kubernetes-incubator/external-storage/snapshot/pkg/apis/crd/v1"
"github.com/kubernetes-incubator/external-storage/snapshot/pkg/cloudprovider"
Expand Down

0 comments on commit 0c2b15a

Please sign in to comment.