diff --git a/cmd/cloudcfg/cloudcfg.go b/cmd/cloudcfg/cloudcfg.go index 2ba1cc3216a..457bd645118 100644 --- a/cmd/cloudcfg/cloudcfg.go +++ b/cmd/cloudcfg/cloudcfg.go @@ -13,6 +13,7 @@ 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 ( diff --git a/cmd/kubelet/kubelet.go b/cmd/kubelet/kubelet.go index 56308f9e555..077e3346455 100644 --- a/cmd/kubelet/kubelet.go +++ b/cmd/kubelet/kubelet.go @@ -13,6 +13,7 @@ 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. */ + // The kubelet binary is responsible for maintaining a set of containers on a particular host VM. // It sync's data from both configuration file as well as from a quorum of etcd servers. // It then queries Docker to see what is currently running. It synchronizes the configuration data, diff --git a/cmd/proxy/proxy.go b/cmd/proxy/proxy.go index c9c48ccfee1..330c68d8a16 100644 --- a/cmd/proxy/proxy.go +++ b/cmd/proxy/proxy.go @@ -13,6 +13,7 @@ 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 ( diff --git a/hooks/boilerplate.sh b/hooks/boilerplate.sh new file mode 100755 index 00000000000..33c31cbf5b9 --- /dev/null +++ b/hooks/boilerplate.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Print 1 if the file in $1 has the correct boilerplate header, 0 otherwise. +FILE=$1 +LINES=$(cat "$(dirname $0)/boilerplate.txt" | wc -l) +DIFFER=$(head -$LINES "${FILE}" | diff -q - "$(dirname $0)/boilerplate.txt") + +if [[ -z "${DIFFER}" ]]; then + echo "1" + exit 0 +fi + +echo "0" diff --git a/hooks/boilerplate.txt b/hooks/boilerplate.txt new file mode 100644 index 00000000000..5fd3c3f8157 --- /dev/null +++ b/hooks/boilerplate.txt @@ -0,0 +1,16 @@ +/* +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. +*/ + diff --git a/hooks/prepare-commit-msg b/hooks/prepare-commit-msg index b6f43d3135a..8fdd02b0243 100755 --- a/hooks/prepare-commit-msg +++ b/hooks/prepare-commit-msg @@ -1,5 +1,7 @@ #!/bin/bash +KUBE_HOOKS_DIR="$(dirname "$(test -L "$0" && echo "$(dirname $0)/$(readlink "$0")" || echo "$0")")" + errors=0 for file in $(git diff --cached --name-only --diff-filter ACM | grep "\.go" | grep -v "third_party"); do diff="$(git show ":${file}" | gofmt -s -d)" @@ -7,6 +9,11 @@ for file in $(git diff --cached --name-only --diff-filter ACM | grep "\.go" | gr echo "# *** ERROR: *** File ${file} has not been gofmt'd." >> $1 errors=1 fi + boilerplate="$(${KUBE_HOOKS_DIR}/boilerplate.sh ${file})" + if [[ "$boilerplate" -eq "0" ]]; then + echo "# *** ERROR: *** File ${file} needs the boilerplate header in hooks/boilerplate.txt." >> $1 + errors=1 + fi done if [[ $errors == "1" ]]; then diff --git a/pkg/apiserver/apiserver_test.go b/pkg/apiserver/apiserver_test.go index 93748debe01..fd996ad52dd 100644 --- a/pkg/apiserver/apiserver_test.go +++ b/pkg/apiserver/apiserver_test.go @@ -13,6 +13,7 @@ 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 apiserver import ( diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index dec1f655372..bbdf20edf32 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -13,6 +13,7 @@ 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 client import ( diff --git a/pkg/client/container_info_test.go b/pkg/client/container_info_test.go index e6bc28ba2e9..1b0904f9596 100644 --- a/pkg/client/container_info_test.go +++ b/pkg/client/container_info_test.go @@ -13,6 +13,7 @@ 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 client import ( diff --git a/pkg/cloudcfg/parse.go b/pkg/cloudcfg/parse.go index 4e1f4d0e173..d776fb99383 100644 --- a/pkg/cloudcfg/parse.go +++ b/pkg/cloudcfg/parse.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 cloudcfg import ( diff --git a/pkg/cloudcfg/parse_test.go b/pkg/cloudcfg/parse_test.go index f8ac85b89de..6f14067615e 100644 --- a/pkg/cloudcfg/parse_test.go +++ b/pkg/cloudcfg/parse_test.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 cloudcfg import ( diff --git a/pkg/kubelet/kubelet_server_test.go b/pkg/kubelet/kubelet_server_test.go index 884f2b43707..e7b69a11288 100644 --- a/pkg/kubelet/kubelet_server_test.go +++ b/pkg/kubelet/kubelet_server_test.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 kubelet import ( diff --git a/pkg/kubelet/kubelet_test.go b/pkg/kubelet/kubelet_test.go index 32b75ab4fe9..14e242d3d34 100644 --- a/pkg/kubelet/kubelet_test.go +++ b/pkg/kubelet/kubelet_test.go @@ -13,6 +13,7 @@ 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 kubelet import ( diff --git a/pkg/proxy/loadbalancer.go b/pkg/proxy/loadbalancer.go index 1dcd086b902..6481ee30bfd 100644 --- a/pkg/proxy/loadbalancer.go +++ b/pkg/proxy/loadbalancer.go @@ -13,6 +13,7 @@ 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. */ + // Loadbalancer interface. Implementations use loadbalancer_ naming. package proxy diff --git a/pkg/proxy/roundrobbin.go b/pkg/proxy/roundrobbin.go index ca4707b9c81..fb11c4bf53a 100644 --- a/pkg/proxy/roundrobbin.go +++ b/pkg/proxy/roundrobbin.go @@ -13,6 +13,7 @@ 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. */ + // RoundRobin Loadbalancer package proxy diff --git a/pkg/proxy/roundrobbin_test.go b/pkg/proxy/roundrobbin_test.go index 11f01b3d572..b4af90a9819 100644 --- a/pkg/proxy/roundrobbin_test.go +++ b/pkg/proxy/roundrobbin_test.go @@ -13,6 +13,7 @@ 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 proxy import ( diff --git a/pkg/registry/controller_registry_test.go b/pkg/registry/controller_registry_test.go index 8d2257ec0d5..6c35cabc2dc 100644 --- a/pkg/registry/controller_registry_test.go +++ b/pkg/registry/controller_registry_test.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/registry/endpoints_test.go b/pkg/registry/endpoints_test.go index 65bab959682..71250d04c69 100644 --- a/pkg/registry/endpoints_test.go +++ b/pkg/registry/endpoints_test.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/registry/etcd_registry_test.go b/pkg/registry/etcd_registry_test.go index 407de8d7e3b..9e794bc6832 100644 --- a/pkg/registry/etcd_registry_test.go +++ b/pkg/registry/etcd_registry_test.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/registry/interfaces.go b/pkg/registry/interfaces.go index de077447fff..f3190b18da4 100644 --- a/pkg/registry/interfaces.go +++ b/pkg/registry/interfaces.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/registry/manifest_factory.go b/pkg/registry/manifest_factory.go index cf904b0925e..120418cee8d 100644 --- a/pkg/registry/manifest_factory.go +++ b/pkg/registry/manifest_factory.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/registry/manifest_factory_test.go b/pkg/registry/manifest_factory_test.go index ffbaa8787d3..b956c373eab 100644 --- a/pkg/registry/manifest_factory_test.go +++ b/pkg/registry/manifest_factory_test.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/registry/memory_registry.go b/pkg/registry/memory_registry.go index 994649df937..bd0e25cf103 100644 --- a/pkg/registry/memory_registry.go +++ b/pkg/registry/memory_registry.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/registry/memory_registry_test.go b/pkg/registry/memory_registry_test.go index b9adb26d9c8..3409ce09218 100644 --- a/pkg/registry/memory_registry_test.go +++ b/pkg/registry/memory_registry_test.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/registry/mock_service_registry.go b/pkg/registry/mock_service_registry.go index 951054cd5e8..712881f541a 100644 --- a/pkg/registry/mock_service_registry.go +++ b/pkg/registry/mock_service_registry.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/registry/pod_registry.go b/pkg/registry/pod_registry.go index fd9c6eb3c93..e80aa576acf 100644 --- a/pkg/registry/pod_registry.go +++ b/pkg/registry/pod_registry.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/registry/pod_registry_test.go b/pkg/registry/pod_registry_test.go index 783bbe1c905..3a64fa1a2fe 100644 --- a/pkg/registry/pod_registry_test.go +++ b/pkg/registry/pod_registry_test.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/registry/scheduler.go b/pkg/registry/scheduler.go index bbe5c3ba40a..ba057407bc3 100644 --- a/pkg/registry/scheduler.go +++ b/pkg/registry/scheduler.go @@ -13,6 +13,7 @@ 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 registry import ( diff --git a/pkg/util/etcd_tools_test.go b/pkg/util/etcd_tools_test.go index ebf11e835c7..30c4c6243b9 100644 --- a/pkg/util/etcd_tools_test.go +++ b/pkg/util/etcd_tools_test.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 util import ( diff --git a/pkg/util/fake_etcd_client.go b/pkg/util/fake_etcd_client.go index 56e023fa859..24eca43228d 100644 --- a/pkg/util/fake_etcd_client.go +++ b/pkg/util/fake_etcd_client.go @@ -13,6 +13,7 @@ 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 util import ( diff --git a/pkg/util/fake_handler.go b/pkg/util/fake_handler.go index 6ca4a3fabf5..3bc3b82c142 100644 --- a/pkg/util/fake_handler.go +++ b/pkg/util/fake_handler.go @@ -13,6 +13,7 @@ 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 util import ( diff --git a/pkg/util/fake_handler_test.go b/pkg/util/fake_handler_test.go index c5c4d00d509..cfa7cd48ee0 100644 --- a/pkg/util/fake_handler_test.go +++ b/pkg/util/fake_handler_test.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 util import ( diff --git a/pkg/util/stringlist.go b/pkg/util/stringlist.go index b26eafca9f8..1c6ccb98223 100644 --- a/pkg/util/stringlist.go +++ b/pkg/util/stringlist.go @@ -13,6 +13,7 @@ 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 util import ( diff --git a/pkg/util/stringlist_test.go b/pkg/util/stringlist_test.go index 8c0c8ed3b77..219e9ba7779 100644 --- a/pkg/util/stringlist_test.go +++ b/pkg/util/stringlist_test.go @@ -13,6 +13,7 @@ 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 util import ( diff --git a/pkg/util/util_test.go b/pkg/util/util_test.go index 3e8aeabac6f..e48311c7ac9 100644 --- a/pkg/util/util_test.go +++ b/pkg/util/util_test.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 util import (