Fixes "go vet" for drone CI
Removes "go get" commands for go cmd packages to use the default versions Also updates client/client.go to conform to go vet style
This commit is contained in:
parent
3127ffcfb1
commit
8ad7819b1b
2 changed files with 28 additions and 27 deletions
|
@ -5,9 +5,6 @@ env:
|
|||
- PATH=$PATH:$GOROOT/bin:$GOPATH/bin
|
||||
|
||||
script:
|
||||
- go get code.google.com/p/go.tools/cmd/vet
|
||||
- go get code.google.com/p/go.tools/cmd/godoc
|
||||
- go get code.google.com/p/go.tools/cmd/cover
|
||||
- go get github.com/axw/gocov/gocov
|
||||
- go get github.com/mattn/goveralls
|
||||
- go get github.com/golang/lint/golint
|
||||
|
@ -15,7 +12,7 @@ script:
|
|||
- go get -d -t ./...
|
||||
|
||||
- hack/validate_gofmt.sh
|
||||
- goveralls -v -service drone.io -repotoken $COVERALLS_TOKEN
|
||||
- goveralls -v -service drone.io -repotoken {{COVERALLS_TOKEN}}
|
||||
- go vet ./...
|
||||
- golint ./...
|
||||
- go test -v ./...
|
||||
|
|
|
@ -90,7 +90,7 @@ func (r *clientImpl) GetImageManifest(name, tag string) (*registry.ImageManifest
|
|||
case response.StatusCode == http.StatusOK:
|
||||
break
|
||||
case response.StatusCode == http.StatusNotFound:
|
||||
return nil, ®istry.ImageManifestNotFoundError{name, tag}
|
||||
return nil, ®istry.ImageManifestNotFoundError{Name: name, Tag: tag}
|
||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||
errors := new(registry.Errors)
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
|
@ -100,7 +100,7 @@ func (r *clientImpl) GetImageManifest(name, tag string) (*registry.ImageManifest
|
|||
}
|
||||
return nil, errors
|
||||
default:
|
||||
return nil, ®istry.UnexpectedHttpStatusError{response.Status}
|
||||
return nil, ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||
}
|
||||
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
|
@ -144,7 +144,7 @@ func (r *clientImpl) PutImageManifest(name, tag string, manifest *registry.Image
|
|||
}
|
||||
return errors
|
||||
default:
|
||||
return ®istry.UnexpectedHttpStatusError{response.Status}
|
||||
return ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ func (r *clientImpl) DeleteImage(name, tag string) error {
|
|||
case response.StatusCode == http.StatusNoContent:
|
||||
break
|
||||
case response.StatusCode == http.StatusNotFound:
|
||||
return ®istry.ImageManifestNotFoundError{name, tag}
|
||||
return ®istry.ImageManifestNotFoundError{Name: name, Tag: tag}
|
||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||
errors := new(registry.Errors)
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
|
@ -176,7 +176,7 @@ func (r *clientImpl) DeleteImage(name, tag string) error {
|
|||
}
|
||||
return errors
|
||||
default:
|
||||
return ®istry.UnexpectedHttpStatusError{response.Status}
|
||||
return ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -194,7 +194,7 @@ func (r *clientImpl) ListImageTags(name string) ([]string, error) {
|
|||
case response.StatusCode == http.StatusOK:
|
||||
break
|
||||
case response.StatusCode == http.StatusNotFound:
|
||||
return nil, ®istry.RepositoryNotFoundError{name}
|
||||
return nil, ®istry.RepositoryNotFoundError{Name: name}
|
||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||
errors := new(registry.Errors)
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
|
@ -204,7 +204,7 @@ func (r *clientImpl) ListImageTags(name string) ([]string, error) {
|
|||
}
|
||||
return nil, errors
|
||||
default:
|
||||
return nil, ®istry.UnexpectedHttpStatusError{response.Status}
|
||||
return nil, ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||
}
|
||||
|
||||
tags := struct {
|
||||
|
@ -234,7 +234,7 @@ func (r *clientImpl) GetImageLayer(name, tarsum string, byteOffset int) (io.Read
|
|||
}
|
||||
|
||||
if response.StatusCode == http.StatusNotFound {
|
||||
return nil, 0, ®istry.LayerNotFoundError{name, tarsum}
|
||||
return nil, 0, ®istry.LayerNotFoundError{Name: name, TarSum: tarsum}
|
||||
}
|
||||
// TODO(bbland): handle other status codes, like 5xx errors
|
||||
switch {
|
||||
|
@ -247,7 +247,7 @@ func (r *clientImpl) GetImageLayer(name, tarsum string, byteOffset int) (io.Read
|
|||
return response.Body, int(length), nil
|
||||
case response.StatusCode == http.StatusNotFound:
|
||||
response.Body.Close()
|
||||
return nil, 0, ®istry.LayerNotFoundError{name, tarsum}
|
||||
return nil, 0, ®istry.LayerNotFoundError{Name: name, TarSum: tarsum}
|
||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||
errors := new(registry.Errors)
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
|
@ -258,7 +258,7 @@ func (r *clientImpl) GetImageLayer(name, tarsum string, byteOffset int) (io.Read
|
|||
return nil, 0, errors
|
||||
default:
|
||||
response.Body.Close()
|
||||
return nil, 0, ®istry.UnexpectedHttpStatusError{response.Status}
|
||||
return nil, 0, ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ func (r *clientImpl) InitiateLayerUpload(name, tarsum string) (string, error) {
|
|||
case response.StatusCode == http.StatusAccepted:
|
||||
return response.Header.Get("Location"), nil
|
||||
case response.StatusCode == http.StatusNotModified:
|
||||
return "", ®istry.LayerAlreadyExistsError{name, tarsum}
|
||||
return "", ®istry.LayerAlreadyExistsError{Name: name, TarSum: tarsum}
|
||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||
errors := new(registry.Errors)
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
|
@ -290,7 +290,7 @@ func (r *clientImpl) InitiateLayerUpload(name, tarsum string) (string, error) {
|
|||
}
|
||||
return "", errors
|
||||
default:
|
||||
return "", ®istry.UnexpectedHttpStatusError{response.Status}
|
||||
return "", ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ func (r *clientImpl) GetLayerUploadStatus(location string) (int, int, error) {
|
|||
case response.StatusCode == http.StatusNoContent:
|
||||
return parseRangeHeader(response.Header.Get("Range"))
|
||||
case response.StatusCode == http.StatusNotFound:
|
||||
return 0, 0, ®istry.LayerUploadNotFoundError{location}
|
||||
return 0, 0, ®istry.LayerUploadNotFoundError{Location: location}
|
||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||
errors := new(registry.Errors)
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
|
@ -316,7 +316,7 @@ func (r *clientImpl) GetLayerUploadStatus(location string) (int, int, error) {
|
|||
}
|
||||
return 0, 0, errors
|
||||
default:
|
||||
return 0, 0, ®istry.UnexpectedHttpStatusError{response.Status}
|
||||
return 0, 0, ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ func (r *clientImpl) UploadLayer(location string, layer io.ReadCloser, length in
|
|||
case response.StatusCode == http.StatusCreated:
|
||||
return nil
|
||||
case response.StatusCode == http.StatusNotFound:
|
||||
return ®istry.LayerUploadNotFoundError{location}
|
||||
return ®istry.LayerUploadNotFoundError{Location: location}
|
||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||
errors := new(registry.Errors)
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
|
@ -358,7 +358,7 @@ func (r *clientImpl) UploadLayer(location string, layer io.ReadCloser, length in
|
|||
}
|
||||
return errors
|
||||
default:
|
||||
return ®istry.UnexpectedHttpStatusError{response.Status}
|
||||
return ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,9 +393,13 @@ func (r *clientImpl) UploadLayerChunk(location string, layerChunk io.ReadCloser,
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ®istry.LayerUploadInvalidRangeError{location, lastValidRange, layerSize}
|
||||
return ®istry.LayerUploadInvalidRangeError{
|
||||
Location: location,
|
||||
LastValidRange: lastValidRange,
|
||||
LayerSize: layerSize,
|
||||
}
|
||||
case response.StatusCode == http.StatusNotFound:
|
||||
return ®istry.LayerUploadNotFoundError{location}
|
||||
return ®istry.LayerUploadNotFoundError{Location: location}
|
||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||
errors := new(registry.Errors)
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
|
@ -405,7 +409,7 @@ func (r *clientImpl) UploadLayerChunk(location string, layerChunk io.ReadCloser,
|
|||
}
|
||||
return errors
|
||||
default:
|
||||
return ®istry.UnexpectedHttpStatusError{response.Status}
|
||||
return ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,7 +441,7 @@ func (r *clientImpl) FinishChunkedLayerUpload(location string, length int, check
|
|||
case response.StatusCode == http.StatusCreated:
|
||||
return nil
|
||||
case response.StatusCode == http.StatusNotFound:
|
||||
return ®istry.LayerUploadNotFoundError{location}
|
||||
return ®istry.LayerUploadNotFoundError{Location: location}
|
||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||
errors := new(registry.Errors)
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
|
@ -447,7 +451,7 @@ func (r *clientImpl) FinishChunkedLayerUpload(location string, length int, check
|
|||
}
|
||||
return errors
|
||||
default:
|
||||
return ®istry.UnexpectedHttpStatusError{response.Status}
|
||||
return ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -469,7 +473,7 @@ func (r *clientImpl) CancelLayerUpload(location string) error {
|
|||
case response.StatusCode == http.StatusNoContent:
|
||||
return nil
|
||||
case response.StatusCode == http.StatusNotFound:
|
||||
return ®istry.LayerUploadNotFoundError{location}
|
||||
return ®istry.LayerUploadNotFoundError{Location: location}
|
||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||
errors := new(registry.Errors)
|
||||
decoder := json.NewDecoder(response.Body)
|
||||
|
@ -479,7 +483,7 @@ func (r *clientImpl) CancelLayerUpload(location string) error {
|
|||
}
|
||||
return errors
|
||||
default:
|
||||
return ®istry.UnexpectedHttpStatusError{response.Status}
|
||||
return ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue