diff --git a/build/pause/pause.go b/build/pause/pause.go index 3af8097af44..21a11b7f646 100644 --- a/build/pause/pause.go +++ b/build/pause/pause.go @@ -1,3 +1,19 @@ +/* +Copyright 2014 Google Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package main import "syscall" diff --git a/hack/verify-boilerplate.sh b/hack/verify-boilerplate.sh index 22155b02566..67106146777 100755 --- a/hack/verify-boilerplate.sh +++ b/hack/verify-boilerplate.sh @@ -14,19 +14,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -REPO_ROOT="$(realpath "$(dirname $0)/..")" +REPO_ROOT="$(cd "$(dirname "$0")/../" && pwd -P)" result=0 -dirs=("pkg" "cmd") - -for dir in ${dirs[@]}; do - for file in $(grep -r -l "" "${REPO_ROOT}/${dir}/" | grep "[.]go"); do - if [[ "$(${REPO_ROOT}/hooks/boilerplate.sh "${file}")" -eq "0" ]]; then - echo "Boilerplate header is wrong for: ${file}" - result=1 - fi - done +gofiles="$(find ${REPO_ROOT} -type f | grep "[.]go$" | grep -v "third_party/\|release/\|output/\|target/")" +for file in ${gofiles}; do + if [[ "$(${REPO_ROOT}/hooks/boilerplate.sh "${file}")" -eq "0" ]]; then + echo "Boilerplate header is wrong for: ${file}" + result=1 + fi done dirs=("cluster" "hack" "hooks") diff --git a/hack/verify-gofmt.sh b/hack/verify-gofmt.sh index 52ea5e19ea1..81491f8d15e 100755 --- a/hack/verify-gofmt.sh +++ b/hack/verify-gofmt.sh @@ -24,9 +24,11 @@ if [[ ${GO_VERSION[2]} != "go1.2" && ${GO_VERSION[2]} != "go1.3" ]]; then exit 0 fi +REPO_ROOT="$(cd "$(dirname "$0")/../" && pwd -P)" -bad=$(gofmt -s -l pkg/ cmd/) -if [ "$?" != "0" ]; then +files="$(find ${REPO_ROOT} -type f | grep "[.]go$" | grep -v "third_party/\|release/\|output/\|target/")" +bad=$(gofmt -s -l ${files}) +if [[ -n "${bad}" ]]; then echo "$bad" exit 1 fi diff --git a/pkg/api/validation.go b/pkg/api/validation.go index de34dcce39d..b3b2385f874 100644 --- a/pkg/api/validation.go +++ b/pkg/api/validation.go @@ -321,7 +321,7 @@ func ValidateReplicationController(controller *ReplicationController) []error { errors = append(errors, makeInvalidError("ReplicationController.ReplicaSelector", controller.DesiredState.ReplicaSelector)) } if controller.DesiredState.Replicas < 0 { - errors = append(errors, makeInvalidError("ReplicationController.Replicas", controller.DesiredState.Replicas )) + errors = append(errors, makeInvalidError("ReplicationController.Replicas", controller.DesiredState.Replicas)) } errors = append(errors, ValidateManifest(&controller.DesiredState.PodTemplate.DesiredState.Manifest)...) return errors diff --git a/pkg/api/validation_test.go b/pkg/api/validation_test.go index 9d4ec61b436..8c1a8246df8 100644 --- a/pkg/api/validation_test.go +++ b/pkg/api/validation_test.go @@ -420,7 +420,7 @@ func TestValidateReplicationController(t *testing.T) { "negative_replicas": { JSONBase: JSONBase{ID: "abc"}, DesiredState: ReplicationControllerState{ - Replicas: -1, + Replicas: -1, ReplicaSelector: validSelector, }, }, diff --git a/pkg/apiserver/minionproxy_test.go b/pkg/apiserver/minionproxy_test.go index 419b57d0bbf..e298a9b361a 100644 --- a/pkg/apiserver/minionproxy_test.go +++ b/pkg/apiserver/minionproxy_test.go @@ -111,7 +111,7 @@ func TestMinionProxy(t *testing.T) { fmt.Sprintf("/%s", proxy.Host): "/", } - for value, _ := range failureCases { + for value := range failureCases { resp, err := http.Get(fmt.Sprintf("%s%s", server.URL, value)) if err != nil { t.Errorf("unexpected error for %s: %v", value, err) diff --git a/pkg/kubelet/config/file.go b/pkg/kubelet/config/file.go index 3c935307785..cdeff20d267 100644 --- a/pkg/kubelet/config/file.go +++ b/pkg/kubelet/config/file.go @@ -9,7 +9,7 @@ You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or sied. +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ diff --git a/pkg/kubelet/config/file_test.go b/pkg/kubelet/config/file_test.go index cb41669e851..4fed13fd298 100644 --- a/pkg/kubelet/config/file_test.go +++ b/pkg/kubelet/config/file_test.go @@ -73,11 +73,9 @@ func TestReadFromFile(t *testing.T) { expected := CreatePodUpdate(kubelet.SET, kubelet.Pod{ Name: "test", Manifest: api.ContainerManifest{ - ID: "test", - Version: "v1beta1", - Containers: []api.Container{api.Container{ - Image: "test/image"}, - }, + ID: "test", + Version: "v1beta1", + Containers: []api.Container{{Image: "test/image"}}, }, }) if !reflect.DeepEqual(expected, update) { diff --git a/pkg/kubelet/config/http.go b/pkg/kubelet/config/http.go index b28f68056e7..2a2533d04a3 100644 --- a/pkg/kubelet/config/http.go +++ b/pkg/kubelet/config/http.go @@ -9,7 +9,7 @@ You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or sied. +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ diff --git a/pkg/kubelet/server_test.go b/pkg/kubelet/server_test.go index 42493516663..9ea5f92f203 100644 --- a/pkg/kubelet/server_test.go +++ b/pkg/kubelet/server_test.go @@ -106,7 +106,7 @@ func TestContainer(t *testing.T) { if len(received) != 1 { t.Errorf("Expected 1 manifest, but got %v", len(received)) } - expectedPods := []Pod{Pod{Name: "1", Manifest: expected[0]}} + expectedPods := []Pod{{Name: "1", Manifest: expected[0]}} if !reflect.DeepEqual(expectedPods, received[0]) { t.Errorf("Expected %#v, but got %#v", expectedPods, received[0]) } @@ -129,7 +129,7 @@ func TestContainers(t *testing.T) { if len(received) != 1 { t.Errorf("Expected 1 update, but got %v", len(received)) } - expectedPods := []Pod{Pod{Name: "1", Manifest: expected[0]}, Pod{Name: "2", Manifest: expected[1]}} + expectedPods := []Pod{{Name: "1", Manifest: expected[0]}, {Name: "2", Manifest: expected[1]}} if !reflect.DeepEqual(expectedPods, received[0]) { t.Errorf("Expected %#v, but got %#v", expectedPods, received[0]) } diff --git a/pkg/util/config/config.go b/pkg/util/config/config.go index 18fa574704b..c76b70c6b99 100644 --- a/pkg/util/config/config.go +++ b/pkg/util/config/config.go @@ -9,7 +9,7 @@ You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or cied. +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */