forked from TrueCloudLab/distribution
Merge pull request #737 from BrianBland/drone-vet
Fixes "go vet" for drone CI
This commit is contained in:
commit
e1798d1ffb
2 changed files with 28 additions and 27 deletions
|
@ -5,9 +5,6 @@ env:
|
||||||
- PATH=$PATH:$GOROOT/bin:$GOPATH/bin
|
- PATH=$PATH:$GOROOT/bin:$GOPATH/bin
|
||||||
|
|
||||||
script:
|
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/axw/gocov/gocov
|
||||||
- go get github.com/mattn/goveralls
|
- go get github.com/mattn/goveralls
|
||||||
- go get github.com/golang/lint/golint
|
- go get github.com/golang/lint/golint
|
||||||
|
@ -15,7 +12,7 @@ script:
|
||||||
- go get -d -t ./...
|
- go get -d -t ./...
|
||||||
|
|
||||||
- hack/validate_gofmt.sh
|
- hack/validate_gofmt.sh
|
||||||
- goveralls -v -service drone.io -repotoken $COVERALLS_TOKEN
|
- goveralls -v -service drone.io -repotoken {{COVERALLS_TOKEN}}
|
||||||
- go vet ./...
|
- go vet ./...
|
||||||
- golint ./...
|
- golint ./...
|
||||||
- go test -v ./...
|
- go test -v ./...
|
||||||
|
|
|
@ -90,7 +90,7 @@ func (r *clientImpl) GetImageManifest(name, tag string) (*registry.ImageManifest
|
||||||
case response.StatusCode == http.StatusOK:
|
case response.StatusCode == http.StatusOK:
|
||||||
break
|
break
|
||||||
case response.StatusCode == http.StatusNotFound:
|
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:
|
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||||
errors := new(registry.Errors)
|
errors := new(registry.Errors)
|
||||||
decoder := json.NewDecoder(response.Body)
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
@ -100,7 +100,7 @@ func (r *clientImpl) GetImageManifest(name, tag string) (*registry.ImageManifest
|
||||||
}
|
}
|
||||||
return nil, errors
|
return nil, errors
|
||||||
default:
|
default:
|
||||||
return nil, ®istry.UnexpectedHttpStatusError{response.Status}
|
return nil, ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||||
}
|
}
|
||||||
|
|
||||||
decoder := json.NewDecoder(response.Body)
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
@ -144,7 +144,7 @@ func (r *clientImpl) PutImageManifest(name, tag string, manifest *registry.Image
|
||||||
}
|
}
|
||||||
return errors
|
return errors
|
||||||
default:
|
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:
|
case response.StatusCode == http.StatusNoContent:
|
||||||
break
|
break
|
||||||
case response.StatusCode == http.StatusNotFound:
|
case response.StatusCode == http.StatusNotFound:
|
||||||
return ®istry.ImageManifestNotFoundError{name, tag}
|
return ®istry.ImageManifestNotFoundError{Name: name, Tag: tag}
|
||||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||||
errors := new(registry.Errors)
|
errors := new(registry.Errors)
|
||||||
decoder := json.NewDecoder(response.Body)
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
@ -176,7 +176,7 @@ func (r *clientImpl) DeleteImage(name, tag string) error {
|
||||||
}
|
}
|
||||||
return errors
|
return errors
|
||||||
default:
|
default:
|
||||||
return ®istry.UnexpectedHttpStatusError{response.Status}
|
return ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -194,7 +194,7 @@ func (r *clientImpl) ListImageTags(name string) ([]string, error) {
|
||||||
case response.StatusCode == http.StatusOK:
|
case response.StatusCode == http.StatusOK:
|
||||||
break
|
break
|
||||||
case response.StatusCode == http.StatusNotFound:
|
case response.StatusCode == http.StatusNotFound:
|
||||||
return nil, ®istry.RepositoryNotFoundError{name}
|
return nil, ®istry.RepositoryNotFoundError{Name: name}
|
||||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||||
errors := new(registry.Errors)
|
errors := new(registry.Errors)
|
||||||
decoder := json.NewDecoder(response.Body)
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
@ -204,7 +204,7 @@ func (r *clientImpl) ListImageTags(name string) ([]string, error) {
|
||||||
}
|
}
|
||||||
return nil, errors
|
return nil, errors
|
||||||
default:
|
default:
|
||||||
return nil, ®istry.UnexpectedHttpStatusError{response.Status}
|
return nil, ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||||
}
|
}
|
||||||
|
|
||||||
tags := struct {
|
tags := struct {
|
||||||
|
@ -234,7 +234,7 @@ func (r *clientImpl) GetImageLayer(name, tarsum string, byteOffset int) (io.Read
|
||||||
}
|
}
|
||||||
|
|
||||||
if response.StatusCode == http.StatusNotFound {
|
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
|
// TODO(bbland): handle other status codes, like 5xx errors
|
||||||
switch {
|
switch {
|
||||||
|
@ -247,7 +247,7 @@ func (r *clientImpl) GetImageLayer(name, tarsum string, byteOffset int) (io.Read
|
||||||
return response.Body, int(length), nil
|
return response.Body, int(length), nil
|
||||||
case response.StatusCode == http.StatusNotFound:
|
case response.StatusCode == http.StatusNotFound:
|
||||||
response.Body.Close()
|
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:
|
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||||
errors := new(registry.Errors)
|
errors := new(registry.Errors)
|
||||||
decoder := json.NewDecoder(response.Body)
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
@ -258,7 +258,7 @@ func (r *clientImpl) GetImageLayer(name, tarsum string, byteOffset int) (io.Read
|
||||||
return nil, 0, errors
|
return nil, 0, errors
|
||||||
default:
|
default:
|
||||||
response.Body.Close()
|
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:
|
case response.StatusCode == http.StatusAccepted:
|
||||||
return response.Header.Get("Location"), nil
|
return response.Header.Get("Location"), nil
|
||||||
case response.StatusCode == http.StatusNotModified:
|
case response.StatusCode == http.StatusNotModified:
|
||||||
return "", ®istry.LayerAlreadyExistsError{name, tarsum}
|
return "", ®istry.LayerAlreadyExistsError{Name: name, TarSum: tarsum}
|
||||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||||
errors := new(registry.Errors)
|
errors := new(registry.Errors)
|
||||||
decoder := json.NewDecoder(response.Body)
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
@ -290,7 +290,7 @@ func (r *clientImpl) InitiateLayerUpload(name, tarsum string) (string, error) {
|
||||||
}
|
}
|
||||||
return "", errors
|
return "", errors
|
||||||
default:
|
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:
|
case response.StatusCode == http.StatusNoContent:
|
||||||
return parseRangeHeader(response.Header.Get("Range"))
|
return parseRangeHeader(response.Header.Get("Range"))
|
||||||
case response.StatusCode == http.StatusNotFound:
|
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:
|
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||||
errors := new(registry.Errors)
|
errors := new(registry.Errors)
|
||||||
decoder := json.NewDecoder(response.Body)
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
@ -316,7 +316,7 @@ func (r *clientImpl) GetLayerUploadStatus(location string) (int, int, error) {
|
||||||
}
|
}
|
||||||
return 0, 0, errors
|
return 0, 0, errors
|
||||||
default:
|
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:
|
case response.StatusCode == http.StatusCreated:
|
||||||
return nil
|
return nil
|
||||||
case response.StatusCode == http.StatusNotFound:
|
case response.StatusCode == http.StatusNotFound:
|
||||||
return ®istry.LayerUploadNotFoundError{location}
|
return ®istry.LayerUploadNotFoundError{Location: location}
|
||||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||||
errors := new(registry.Errors)
|
errors := new(registry.Errors)
|
||||||
decoder := json.NewDecoder(response.Body)
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
@ -358,7 +358,7 @@ func (r *clientImpl) UploadLayer(location string, layer io.ReadCloser, length in
|
||||||
}
|
}
|
||||||
return errors
|
return errors
|
||||||
default:
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return ®istry.LayerUploadInvalidRangeError{location, lastValidRange, layerSize}
|
return ®istry.LayerUploadInvalidRangeError{
|
||||||
|
Location: location,
|
||||||
|
LastValidRange: lastValidRange,
|
||||||
|
LayerSize: layerSize,
|
||||||
|
}
|
||||||
case response.StatusCode == http.StatusNotFound:
|
case response.StatusCode == http.StatusNotFound:
|
||||||
return ®istry.LayerUploadNotFoundError{location}
|
return ®istry.LayerUploadNotFoundError{Location: location}
|
||||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||||
errors := new(registry.Errors)
|
errors := new(registry.Errors)
|
||||||
decoder := json.NewDecoder(response.Body)
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
@ -405,7 +409,7 @@ func (r *clientImpl) UploadLayerChunk(location string, layerChunk io.ReadCloser,
|
||||||
}
|
}
|
||||||
return errors
|
return errors
|
||||||
default:
|
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:
|
case response.StatusCode == http.StatusCreated:
|
||||||
return nil
|
return nil
|
||||||
case response.StatusCode == http.StatusNotFound:
|
case response.StatusCode == http.StatusNotFound:
|
||||||
return ®istry.LayerUploadNotFoundError{location}
|
return ®istry.LayerUploadNotFoundError{Location: location}
|
||||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||||
errors := new(registry.Errors)
|
errors := new(registry.Errors)
|
||||||
decoder := json.NewDecoder(response.Body)
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
@ -447,7 +451,7 @@ func (r *clientImpl) FinishChunkedLayerUpload(location string, length int, check
|
||||||
}
|
}
|
||||||
return errors
|
return errors
|
||||||
default:
|
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:
|
case response.StatusCode == http.StatusNoContent:
|
||||||
return nil
|
return nil
|
||||||
case response.StatusCode == http.StatusNotFound:
|
case response.StatusCode == http.StatusNotFound:
|
||||||
return ®istry.LayerUploadNotFoundError{location}
|
return ®istry.LayerUploadNotFoundError{Location: location}
|
||||||
case response.StatusCode >= 400 && response.StatusCode < 500:
|
case response.StatusCode >= 400 && response.StatusCode < 500:
|
||||||
errors := new(registry.Errors)
|
errors := new(registry.Errors)
|
||||||
decoder := json.NewDecoder(response.Body)
|
decoder := json.NewDecoder(response.Body)
|
||||||
|
@ -479,7 +483,7 @@ func (r *clientImpl) CancelLayerUpload(location string) error {
|
||||||
}
|
}
|
||||||
return errors
|
return errors
|
||||||
default:
|
default:
|
||||||
return ®istry.UnexpectedHttpStatusError{response.Status}
|
return ®istry.UnexpectedHttpStatusError{Status: response.Status}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue