mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Out tests for features that didn't exist in old golang versions (like gofmt didn't exist in 1.3 or the linker didn't want an = in 1.4) checked for the new version. But this means every time there is a new version we have to update the test. This PR inverts the test. We do it the old way for the old version and if a new version comes along we just assume it is going to work the new way.
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
# Copyright 2014 The Kubernetes Authors 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.
 | 
						|
 | 
						|
# GoFmt apparently is changing @ head...
 | 
						|
 | 
						|
set -o errexit
 | 
						|
set -o nounset
 | 
						|
set -o pipefail
 | 
						|
 | 
						|
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
 | 
						|
 | 
						|
GO_VERSION=($(go version))
 | 
						|
 | 
						|
if [[ -n $(echo "${GO_VERSION[2]}" | grep -E 'go1.1|go1.2|go1.3') ]]; then
 | 
						|
  echo "Unsupported go version '${GO_VERSION}', skipping gofmt."
 | 
						|
  exit 0
 | 
						|
fi
 | 
						|
 | 
						|
cd "${KUBE_ROOT}"
 | 
						|
 | 
						|
find_files() {
 | 
						|
  find . -not \( \
 | 
						|
      \( \
 | 
						|
        -wholename './output' \
 | 
						|
        -o -wholename './_output' \
 | 
						|
        -o -wholename './_gopath' \
 | 
						|
        -o -wholename './release' \
 | 
						|
        -o -wholename './target' \
 | 
						|
        -o -wholename '*/third_party/*' \
 | 
						|
        -o -wholename '*/Godeps/*' \
 | 
						|
      \) -prune \
 | 
						|
    \) -name '*.go'
 | 
						|
}
 | 
						|
 | 
						|
GOFMT="gofmt -s -w"
 | 
						|
find_files | xargs $GOFMT
 |