Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
527cb505
Commit
527cb505
authored
Apr 22, 2016
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Demand at least go1.6
parent
cbf886c7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
82 deletions
+33
-82
golang.sh
hack/lib/golang.sh
+26
-25
version.sh
hack/lib/version.sh
+1
-8
test-go.sh
hack/test-go.sh
+0
-1
install-std-race.sh
hack/travis/install-std-race.sh
+0
-30
update-gofmt.sh
hack/update-gofmt.sh
+2
-6
verify-gofmt.sh
hack/verify-gofmt.sh
+2
-6
resource_printer.go
pkg/kubectl/resource_printer.go
+1
-4
io_util.go
pkg/volume/util/io_util.go
+1
-2
No files found.
hack/lib/golang.sh
View file @
527cb505
...
...
@@ -253,27 +253,14 @@ kube::golang::create_gopath_tree() {
ln
-s
"
${
KUBE_ROOT
}
"
"
${
go_pkg_dir
}
"
}
# kube::golang::setup_env will check that the `go` commands is available in
# ${PATH}. If not running on Travis, it will also check that the Go version is
# good enough for the Kubernetes build.
#
# Inputs:
# KUBE_EXTRA_GOPATH - If set, this is included in created GOPATH
#
# Outputs:
# env-var GOPATH points to our local output dir
# env-var GOBIN is unset (we want binaries in a predictable place)
# env-var GO15VENDOREXPERIMENT=1
# current directory is within GOPATH
kube::golang::setup_env
()
{
kube::golang::create_gopath_tree
# Ensure the go tool exists and is a viable version.
kube::golang::verify_go_version
()
{
if
[[
-z
"
$(
which go
)
"
]]
;
then
kube::log::usage_from_stdin
<<
EOF
Can't find 'go' in PATH, please fix and retry.
See http://golang.org/doc/install for installation instructions.
EOF
exit
2
return
2
fi
# Travis continuous build uses a head go release that doesn't report
...
...
@@ -282,15 +269,33 @@ EOF
if
[[
"
${
TRAVIS
:-}
"
!=
"true"
]]
;
then
local
go_version
go_version
=(
$(
go version
)
)
if
[[
"
${
go_version
[2]
}
"
<
"go1.
4
"
]]
;
then
if
[[
"
${
go_version
[2]
}
"
<
"go1.
6
"
]]
;
then
kube::log::usage_from_stdin
<<
EOF
Detected go version:
${
go_version
[*]
}
.
Kubernetes requires go version 1.
4
or greater.
Please install Go version 1.
4
or later.
Kubernetes requires go version 1.
6
or greater.
Please install Go version 1.
6
or later.
EOF
exit
2
return
2
fi
fi
}
# kube::golang::setup_env will check that the `go` commands is available in
# ${PATH}. If not running on Travis, it will also check that the Go version is
# good enough for the Kubernetes build.
#
# Inputs:
# KUBE_EXTRA_GOPATH - If set, this is included in created GOPATH
#
# Outputs:
# env-var GOPATH points to our local output dir
# env-var GOBIN is unset (we want binaries in a predictable place)
# env-var GO15VENDOREXPERIMENT=1
# current directory is within GOPATH
kube::golang::setup_env
()
{
kube::golang::verify_go_version
kube::golang::create_gopath_tree
export
GOPATH
=
${
KUBE_GOPATH
}
...
...
@@ -441,16 +446,12 @@ kube::golang::build_binaries_for_platform() {
for
test
in
"
${
tests
[@]
:+
${
tests
[@]
}}
"
;
do
local
outfile
=
$(
kube::golang::output_filename_for_binary
"
${
test
}
"
\
"
${
platform
}
"
)
# Go 1.4 added -o to control where the binary is saved, but Go 1.3 doesn't
# have this flag. Whenever we deprecate go 1.3, update to use -o instead of
# changing into the output directory.
mkdir
-p
"
$(
dirname
${
outfile
})
"
pushd
"
$(
dirname
${
outfile
})
"
>
/dev/null
go
test
-c
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
goldflags
}
"
\
-o
"
${
outfile
}
"
\
"
$(
dirname
${
test
})
"
popd
>
/dev/null
done
}
...
...
hack/lib/version.sh
View file @
527cb505
...
...
@@ -107,18 +107,11 @@ kube::version::load_version_vars() {
source
"
${
version_file
}
"
}
# golang 1.5+ wants `-X key=val`, but golang 1.4- REQUIRES `-X key val`
kube::version::ldflag
()
{
local
key
=
${
1
}
local
val
=
${
2
}
GO_VERSION
=(
$(
go version
)
)
if
[[
-n
$(
echo
"
${
GO_VERSION
[2]
}
"
|
grep
-E
'go1.1|go1.2|go1.3|go1.4'
)
]]
;
then
echo
"-X
${
KUBE_GO_PACKAGE
}
/pkg/version.
${
key
}
${
val
}
"
else
echo
"-X
${
KUBE_GO_PACKAGE
}
/pkg/version.
${
key
}
=
${
val
}
"
fi
echo
"-X
${
KUBE_GO_PACKAGE
}
/pkg/version.
${
key
}
=
${
val
}
"
}
# Prints the value that needs to be passed to the -ldflags parameter of go build
...
...
hack/test-go.sh
View file @
527cb505
...
...
@@ -46,7 +46,6 @@ kube::test::find_dirs() {
)
}
# -covermode=atomic becomes default with -race in Go >=1.3
KUBE_TIMEOUT
=
${
KUBE_TIMEOUT
:-
-timeout 120s
}
KUBE_COVER
=
${
KUBE_COVER
:-
n
}
# set to 'y' to enable coverage collection
KUBE_COVERMODE
=
${
KUBE_COVERMODE
:-
atomic
}
...
...
hack/travis/install-std-race.sh
deleted
100755 → 0
View file @
cbf886c7
#!/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.
# This script installs std -race on Travis (see https://code.google.com/p/go/issues/detail?id=6479)
set
-o
errexit
set
-o
nounset
set
-o
pipefail
if
[[
"
${
TRAVIS
}
"
==
"true"
]]
;
then
GO_VERSION
=(
$(
go version
)
)
if
[[
${
GO_VERSION
[2]
}
<
"go1.3"
]]
;
then
echo
"Installing the -race compatible version of the std go library"
go
install
-a
-race
std
fi
fi
hack/update-gofmt.sh
View file @
527cb505
...
...
@@ -21,13 +21,9 @@ set -o nounset
set
-o
pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
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
kube::golang::verify_go_version
cd
"
${
KUBE_ROOT
}
"
...
...
hack/verify-gofmt.sh
View file @
527cb505
...
...
@@ -21,13 +21,9 @@ set -o nounset
set
-o
pipefail
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
GO_VERSION
=(
$(
go version
)
)
if
[[
-z
$(
echo
"
${
GO_VERSION
[2]
}
"
|
grep
-E
'go1.4|go1.6'
)
]]
;
then
echo
"Unsupported go version '
${
GO_VERSION
[2]
}
', skipping gofmt."
exit
1
fi
kube::golang::verify_go_version
cd
"
${
KUBE_ROOT
}
"
...
...
pkg/kubectl/resource_printer.go
View file @
527cb505
...
...
@@ -1739,10 +1739,7 @@ func appendAllLabels(showLabels bool, itemLabels map[string]string) string {
func
appendLabelTabs
(
columnLabels
[]
string
)
string
{
var
buffer
bytes
.
Buffer
for
i
:=
range
columnLabels
{
// NB: This odd dance is to make the loop both compatible with go 1.3 and
// pass `gofmt -s`
_
=
i
for
range
columnLabels
{
buffer
.
WriteString
(
"
\t
"
)
}
buffer
.
WriteString
(
"
\n
"
)
...
...
pkg/volume/util/io_util.go
View file @
527cb505
...
...
@@ -22,8 +22,7 @@ import (
"path/filepath"
)
//IoUtil is a util for common IO operations
//it also backports certain operations from golang 1.5
// IoUtil is a mockable util for common IO operations
type
IoUtil
interface
{
ReadDir
(
dirname
string
)
([]
os
.
FileInfo
,
error
)
Lstat
(
name
string
)
(
os
.
FileInfo
,
error
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment