From d2fece3311ca871c8f3de09d818dc64cbdf40e6e Mon Sep 17 00:00:00 2001 From: Ulysses Souza Date: Tue, 19 May 2020 20:03:53 +0200 Subject: [PATCH] Fix linter problems Signed-off-by: Ulysses Souza --- cli/cmd/run/opts.go | 54 ---------------------------------------- errdefs/errors.go | 4 +-- tests/aci-e2e/e2e-aci.go | 2 +- 3 files changed, 3 insertions(+), 57 deletions(-) delete mode 100644 cli/cmd/run/opts.go diff --git a/cli/cmd/run/opts.go b/cli/cmd/run/opts.go deleted file mode 100644 index b1dcb86e..00000000 --- a/cli/cmd/run/opts.go +++ /dev/null @@ -1,54 +0,0 @@ -package run - -import ( - "fmt" - "strconv" - "strings" - - "github.com/docker/api/containers" -) - -type runOpts struct { - name string - publish []string - volumes []string -} - -func toPorts(ports []string) ([]containers.Port, error) { - var result []containers.Port - - for _, port := range ports { - parts := strings.Split(port, ":") - if len(parts) != 2 { - return nil, fmt.Errorf("unable to parse ports %q", port) - } - source, err := strconv.Atoi(parts[0]) - if err != nil { - return nil, err - } - destination, err := strconv.Atoi(parts[1]) - if err != nil { - return nil, err - } - - result = append(result, containers.Port{ - HostPort: uint32(source), - ContainerPort: uint32(destination), - }) - } - return result, nil -} - -func (r *runOpts) toContainerConfig(image string) (containers.ContainerConfig, error) { - publish, err := toPorts(r.publish) - if err != nil { - return containers.ContainerConfig{}, err - } - - return containers.ContainerConfig{ - ID: r.name, - Image: image, - Ports: publish, - Volumes: r.volumes, - }, nil -} diff --git a/errdefs/errors.go b/errdefs/errors.go index 436377e7..3a4e2984 100644 --- a/errdefs/errors.go +++ b/errdefs/errors.go @@ -45,7 +45,7 @@ var ( // ErrNotImplemented is returned when a backend doesn't implement // an action ErrNotImplemented = errors.New("not implemented") - // ErrParsingFailed + // ErrParsingFailed is returned when a string cannot be parsed ErrParsingFailed = errors.New("parsing failed") ) @@ -74,7 +74,7 @@ func IsErrNotImplemented(err error) bool { return errors.Is(err, ErrNotImplemented) } -// IsErrParseFail returns true if the unwrapped error is ErrParsingFailed +// IsErrParsingFailed returns true if the unwrapped error is ErrParsingFailed func IsErrParsingFailed(err error) bool { return errors.Is(err, ErrParsingFailed) } diff --git a/tests/aci-e2e/e2e-aci.go b/tests/aci-e2e/e2e-aci.go index 4097bf35..7eece0a7 100644 --- a/tests/aci-e2e/e2e-aci.go +++ b/tests/aci-e2e/e2e-aci.go @@ -208,7 +208,7 @@ func uploadFile(credential azfile.SharedKeyCredential, baseURL, fileName, fileCo fURL, err := url.Parse(baseURL + "/" + fileName) Expect(err).To(BeNil()) fileURL := azfile.NewFileURL(*fURL, azfile.NewPipeline(&credential, azfile.PipelineOptions{})) - err = azfile.UploadBufferToAzureFile(context.TODO(), []byte(testFileContent), fileURL, azfile.UploadToAzureFileOptions{}) + err = azfile.UploadBufferToAzureFile(context.TODO(), []byte(fileContent), fileURL, azfile.UploadToAzureFileOptions{}) Expect(err).To(BeNil()) }