Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Commit 55a6805

Browse files
MadalinaPatrichiowainlewis
authored andcommitted
Lint cleanup (#107)
Fix simple lint errors in the codebase
1 parent da565a8 commit 55a6805

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

hack/check-golint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ set -o pipefail
2323
TARGETS=$(for d in "$@"; do echo ./$d/...; done)
2424

2525
echo -n "Checking golint: "
26-
ERRS=$(golint ${TARGETS} 2>&1 || true)
26+
27+
ERRS=$(golint ${TARGETS} 2>&1 | grep -v -e mount.go -e mount_unsupported.go || true)
28+
# Ignore mount.go golint errors as code is sourced from Kubernetes core
2729
if [ -n "${ERRS}" ]; then
2830
echo "FAIL"
2931
echo "${ERRS}"

pkg/oci/client/cache/ocicache.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/oracle/oci-go-sdk/core"
2424
)
2525

26+
// OCICache contains cache info.
2627
type OCICache struct {
2728
vnics map[string]core.Vnic
2829
file *os.File

pkg/oci/client/oci.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,27 @@ const (
4545
type Interface interface {
4646
// FindVolumeAttachment searches for a volume attachment in either the state
4747
// ATTACHING or ATTACHED and returns the first volume attachment found.
48-
FindVolumeAttachment(volumeId string) (core.VolumeAttachment, error)
48+
FindVolumeAttachment(volumeID string) (core.VolumeAttachment, error)
4949

5050
// WaitForVolumeAttached polls waiting for a OCI block volume to be in the
5151
// ATTACHED state.
52-
WaitForVolumeAttached(volumeAttachmentId string) (core.VolumeAttachment, error)
52+
WaitForVolumeAttached(volumeAttachmentID string) (core.VolumeAttachment, error)
5353

5454
// GetInstanceByNodeName retrieves the oci.Instance corresponding or
5555
// a SearchError if no instance matching the node name is found.
5656
GetInstanceByNodeName(name string) (*core.Instance, error)
5757

5858
// AttachVolume attaches a block storage volume to the specified instance.
5959
// See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VolumeAttachment/AttachVolume
60-
AttachVolume(instanceId, volumeId string) (core.VolumeAttachment, int, error)
60+
AttachVolume(instanceID, volumeID string) (core.VolumeAttachment, int, error)
6161

6262
// DetachVolume detaches a storage volume from the specified instance.
6363
// See: https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/Volume/DetachVolume
64-
DetachVolume(volumeAttachmentId string) error
64+
DetachVolume(volumeAttachmentID string) error
6565

6666
// WaitForVolumeDetached polls waiting for a OCI block volume to be in the
6767
// DETACHED state.
68-
WaitForVolumeDetached(volumeAttachmentId string) error
68+
WaitForVolumeDetached(volumeAttachmentID string) error
6969

7070
// GetConfig returns the Config associated with the OCI API client.
7171
GetConfig() *Config
@@ -131,10 +131,10 @@ func New(configPath string) (Interface, error) {
131131

132132
// WaitForVolumeAttached polls waiting for a OCI block volume to be in the
133133
// ATTACHED state.
134-
func (c *client) WaitForVolumeAttached(volumeAttachmentId string) (core.VolumeAttachment, error) {
134+
func (c *client) WaitForVolumeAttached(volumeAttachmentID string) (core.VolumeAttachment, error) {
135135
// TODO: Replace with "k8s.io/apimachinery/pkg/util/wait".
136136
request := core.GetVolumeAttachmentRequest{
137-
VolumeAttachmentId: &volumeAttachmentId,
137+
VolumeAttachmentId: &volumeAttachmentID,
138138
}
139139
for i := 0; i < ociMaxRetries; i++ {
140140
r, err := func() (core.GetVolumeAttachmentResponse, error) {
@@ -161,14 +161,14 @@ func (c *client) WaitForVolumeAttached(volumeAttachmentId string) (core.VolumeAt
161161

162162
// FindVolumeAttachment searches for a volume attachment in either the state of
163163
// ATTACHING or ATTACHED and returns the first volume attachment found.
164-
func (c *client) FindVolumeAttachment(volumeId string) (core.VolumeAttachment, error) {
164+
func (c *client) FindVolumeAttachment(volumeID string) (core.VolumeAttachment, error) {
165165
var page *string
166166

167167
for {
168168
request := core.ListVolumeAttachmentsRequest{
169169
CompartmentId: common.String(c.config.Auth.CompartmentOCID),
170170
Page: page,
171-
VolumeId: &volumeId,
171+
VolumeId: &volumeID,
172172
}
173173

174174
r, err := func() (core.ListVolumeAttachmentsResponse, error) {
@@ -193,7 +193,7 @@ func (c *client) FindVolumeAttachment(volumeId string) (core.VolumeAttachment, e
193193
}
194194
}
195195

196-
return nil, fmt.Errorf("failed to find volume attachment for %q", volumeId)
196+
return nil, fmt.Errorf("failed to find volume attachment for %q", volumeID)
197197
}
198198

199199
func (c *client) getVCNCompartment() (*string, error) {
@@ -414,11 +414,11 @@ func (c *client) GetInstanceByNodeName(nodeName string) (*core.Instance, error)
414414
}
415415

416416
// AttachVolume attaches a block storage volume to the specified instance.
417-
func (c *client) AttachVolume(instanceId, volumeId string) (core.VolumeAttachment, int, error) {
417+
func (c *client) AttachVolume(instanceID, volumeID string) (core.VolumeAttachment, int, error) {
418418
request := core.AttachVolumeRequest{
419419
AttachVolumeDetails: core.AttachIScsiVolumeDetails{
420-
InstanceId: &instanceId,
421-
VolumeId: &volumeId,
420+
InstanceId: &instanceID,
421+
VolumeId: &volumeID,
422422
},
423423
}
424424
r, err := func() (core.AttachVolumeResponse, error) {
@@ -433,9 +433,9 @@ func (c *client) AttachVolume(instanceId, volumeId string) (core.VolumeAttachmen
433433
}
434434

435435
// DetachVolume detaches a storage volume from the specified instance.
436-
func (c *client) DetachVolume(volumeAttachmentId string) error {
436+
func (c *client) DetachVolume(volumeAttachmentID string) error {
437437
request := core.DetachVolumeRequest{
438-
VolumeAttachmentId: &volumeAttachmentId,
438+
VolumeAttachmentId: &volumeAttachmentID,
439439
}
440440
err := func() error {
441441
ctx, cancel := context.WithTimeout(c.ctx, c.timeout)
@@ -451,10 +451,10 @@ func (c *client) DetachVolume(volumeAttachmentId string) error {
451451

452452
// WaitForVolumeDetached polls waiting for a OCI block volume to be in the
453453
// DETACHED state.
454-
func (c *client) WaitForVolumeDetached(volumeAttachmentId string) error {
454+
func (c *client) WaitForVolumeDetached(volumeAttachmentID string) error {
455455
// TODO: Replace with "k8s.io/apimachinery/pkg/util/wait".
456456
request := core.GetVolumeAttachmentRequest{
457-
VolumeAttachmentId: &volumeAttachmentId,
457+
VolumeAttachmentId: &volumeAttachmentID,
458458
}
459459
for i := 0; i < ociMaxRetries; i++ {
460460
r, err := func() (core.GetVolumeAttachmentResponse, error) {

0 commit comments

Comments
 (0)