Ver código fonte

Fix linter problems

Signed-off-by: Ulysses Souza <[email protected]>
Ulysses Souza 5 anos atrás
pai
commit
d2fece3311
3 arquivos alterados com 3 adições e 57 exclusões
  1. 0 54
      cli/cmd/run/opts.go
  2. 2 2
      errdefs/errors.go
  3. 1 1
      tests/aci-e2e/e2e-aci.go

+ 0 - 54
cli/cmd/run/opts.go

@@ -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
-}

+ 2 - 2
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)
 }

+ 1 - 1
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())
 }