Merge pull request #27911 from jfrazelle/start-enable-golint

Automatic merge from submit-queue

Start verifying golint on a per-package basis as packages are fixed

<!--
Checklist for submitting a Pull Request

Please remove this comment block before submitting.

1. Please read our [contributor guidelines](https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md).
2. See our [developer guide](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md).
3. If you want this PR to automatically close an issue when it is merged,
   add `fixes #<issue number>` or `fixes #<issue number>, fixes #<issue number>`
   to close multiple issues (see: https://github.com/blog/1506-closing-issues-via-pull-requests).
4. Follow the instructions for [labeling and writing a release note for this PR](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes) in the block below.
-->

```release-note
Added `golint` for pkg/security/podsecuritypolicy/capabilities` along with validation.
```


[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()

This is a POC to start enabling `golint` checks on a per-package basis, we did this on the docker project and it was a great way for new contributors to help and it benefits the project overall. All they have to do is add the package they fixed to the bash array in `hack/verify-golint.sh` and fix all the lint errors. 
Eventually when all the packages have been fixed we can change the function to `find_files`. Or something based off which files are changed in a patch set to verify `golint`.
Now I used this specific package as the POC because I wanted to show the downside of this changing the api of the package.
Most of the times this arose in docker/docker we decided that if someone wasn't importing their deps locally then it was their loss, but I'm not sure if you all will agree.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/27911)
<!-- Reviewable:end -->
This commit is contained in:
Kubernetes Submit Queue
2016-08-11 15:03:06 -07:00
committed by GitHub
10 changed files with 302 additions and 10 deletions

View File

@@ -61,5 +61,5 @@ docker run --rm=true -i \
-e "WORKSPACE=/workspace" \
${KUBEKINS_SERVICE_ACCOUNT_FILE:+-e "KUBEKINS_SERVICE_ACCOUNT_FILE=/service-account.json"} \
"${docker_extra_args[@]:+${docker_extra_args[@]}}" \
gcr.io/google_containers/kubekins-test:go1.6.3-docker1.9.1-rev1 \
gcr.io/google_containers/kubekins-test:go1.6.3-docker1.9.1-rev2 \
bash -c "bash <(curl -fsS --retry 3 --keepalive-time 2 'https://raw.githubusercontent.com/kubernetes/kubernetes/master/hack/jenkins/e2e-runner.sh')"

View File

@@ -45,5 +45,5 @@ docker run --rm=true \
-e "KUBE_VERIFY_GIT_BRANCH=${KUBE_VERIFY_GIT_BRANCH:-}" \
-e "REPO_DIR=${REPO_DIR}" \
-e "HOST_ARTIFACTS_DIR=${HOST_ARTIFACTS_DIR}" \
-i gcr.io/google_containers/kubekins-test:go1.6.3-docker1.9.1-rev1 \
-i gcr.io/google_containers/kubekins-test:go1.6.3-docker1.9.1-rev2 \
bash -c "cd kubernetes && ${KUBE_TEST_SCRIPT:-./hack/jenkins/test-dockerized.sh}"

View File

@@ -44,6 +44,8 @@ RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y \
RUN curl -L "https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz" |\
tar -C /usr/bin -xvzf- --strip-components=3 usr/local/bin/docker
RUN go get github.com/golang/lint/golint
RUN mkdir -p /go/src/k8s.io/kubernetes \
&& ln -s /go/src/k8s.io/kubernetes /workspace/kubernetes

View File

@@ -16,7 +16,7 @@ all: push
# Tag format: $GO_VERSION-$EMBEDDED_DOCKER_VERSION-$REVISION
# These versions are specified in the Dockerfile
TAG = go1.6.3-docker1.9.1-rev1
TAG = go1.6.3-docker1.9.1-rev2
container:
docker build -t gcr.io/google_containers/kubekins-test .