Merge pull request #7 from AkihiroSuda/gometalinter

Improve CI
docker-18.09
Tõnis Tiigi 2017-06-13 09:47:50 -07:00 committed by GitHub
commit c2721095af
9 changed files with 60 additions and 16 deletions

View File

@ -8,3 +8,5 @@ install:
script:
- ./hack/test
- ./hack/lint
- ./hack/validate-vendor

23
cache/refs.go vendored
View File

@ -94,20 +94,17 @@ func (cr *cacheRecord) Mount() ([]mount.Mount, error) {
return nil, errors.Wrapf(err, "failed to mount %s", cr.id)
}
return m, nil
} else {
if cr.viewMount == nil { // TODO: handle this better
cr.view = generateID()
m, err := cr.cm.Snapshotter.View(context.TODO(), cr.view, cr.id)
if err != nil {
cr.view = ""
return nil, errors.Wrapf(err, "failed to mount %s", cr.id)
}
cr.viewMount = m
}
return cr.viewMount, nil
}
return nil, errors.New("snapshot mount not implemented")
if cr.viewMount == nil { // TODO: handle this better
cr.view = generateID()
m, err := cr.cm.Snapshotter.View(context.TODO(), cr.view, cr.id)
if err != nil {
cr.view = ""
return nil, errors.Wrapf(err, "failed to mount %s", cr.id)
}
cr.viewMount = m
}
return cr.viewMount, nil
}
func (cr *cacheRecord) ID() string {

12
gometalinter.json Normal file
View File

@ -0,0 +1,12 @@
{
"Vendor": true,
"Deadline": "8m",
"DisableAll": true,
"Enable": [
"gofmt",
"goimports",
"ineffassign",
"vet"
]
}

View File

@ -0,0 +1,7 @@
FROM golang:1.8-alpine
RUN apk add --no-cache git
RUN go get -u gopkg.in/alecthomas/gometalinter.v1 \
&& mv /go/bin/gometalinter.v1 /go/bin/gometalinter \
&& gometalinter --install
WORKDIR /go/src/github.com/tonistiigi/buildkit_poc
COPY . .

7
hack/lint Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -eu -o pipefail -x
# update this to iidfile after 17.06
docker build -t buildkit_poc:lint -f ./hack/dockerfiles/lint.Dockerfile --force-rm .
docker run buildkit_poc:lint gometalinter --config=gometalinter.json ./...

View File

@ -4,4 +4,5 @@ set -eu -o pipefail -x
# update this to iidfile after 17.06
docker build -t buildkit_poc:test -f ./hack/dockerfiles/test.Dockerfile --force-rm .
docker run -v /tmp --privileged buildkit_poc:test go test ${TESTFLAGS:--v} ${TESTPKGS:-./...}
docker run -v /tmp --privileged buildkit_poc:test go test ${TESTFLAGS:--v} ${TESTPKGS:-./...}
docker run buildkit_poc:test go build ./...

20
hack/validate-vendor Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -eu -o pipefail -x
# update this to iidfile after 17.06
docker build -t buildkit_poc:vendor -f ./hack/dockerfiles/vendor.Dockerfile --force-rm .
diffs="$(docker run buildkit_poc:vendor git status --porcelain -- vendor 2>/dev/null)"
if [ "$diffs" ]; then
{
set +x
echo 'The result of vndr differs'
echo
echo "$diffs"
echo
echo 'Please vendor your package with github.com/LK4D4/vndr.'
echo
} >&2
false
fi
echo 'Congratulations! All vendoring changes are done the right way.'

View File

@ -116,7 +116,6 @@ func (pr *progressReader) Read(ctx context.Context) (*Progress, error) {
pr.cond.Wait()
}
}
return nil, errors.Errorf("Read not implemented")
}
func (pr *progressReader) append(pw *progressWriter) {

View File

@ -127,5 +127,4 @@ func saveProgress(ctx context.Context, pr ProgressReader, t *trace) error {
}
t.items = append(t.items, *p)
}
return nil
}