Skip to content

Commit

Permalink
Merge pull request #529 from BenTheElder/staticcheck
Browse files Browse the repository at this point in the history
add staticcheck to verify
  • Loading branch information
k8s-ci-robot committed May 15, 2019
2 parents cf5af1d + e76d1e6 commit a25f57d
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ module sigs.k8s.io/kind/hack/tools
go 1.12

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/spf13/pflag v1.0.2 // indirect
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7
golang.org/x/tools v0.0.0-20180911133044-677d2ff680c1 // indirect
golang.org/x/tools v0.0.0-20190514230902-921b34c7d07f // indirect
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a // indirect
k8s.io/code-generator v0.0.0-20181116211957-405721ab9678
k8s.io/gengo v0.0.0-20181113154421-fd15ee9cc2f7 // indirect
k8s.io/klog v0.1.0 // indirect
Expand Down
11 changes: 11 additions & 0 deletions hack/tools/go.sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc=
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7 h1:00BeQWmeaGazuOrq8Q5K5d3/cHaGuFrZzpaHBXfrsUA=
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20180911133044-677d2ff680c1 h1:dzEuQYa6+a3gROnSlgly5ERUm4SZKJt+dh+4iSbO+bI=
golang.org/x/tools v0.0.0-20180911133044-677d2ff680c1/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190514230902-921b34c7d07f h1:dts7Z0mEJGlDyDVnbbogjfEhUYvrBjvYECNJxwG5IK8=
golang.org/x/tools v0.0.0-20190514230902-921b34c7d07f/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a h1:LJwr7TCTghdatWv40WobzlKXc9c4s8oGa7QKJUtHhWA=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/code-generator v0.0.0-20181116211957-405721ab9678 h1:HymXxD0e1DpTrSSXAj+vsAag/sqvq/mCv4J2OONqM90=
k8s.io/code-generator v0.0.0-20181116211957-405721ab9678/go.mod h1:MYiN+ZJZ9HkETbgVZdWw2AsuAi9PZ4V80cwfuf2axe8=
k8s.io/gengo v0.0.0-20181113154421-fd15ee9cc2f7 h1:zjNgw2qqBQmKd0S59lGZBQqFxJqUZroVbDphfnVm5do=
Expand Down
1 change: 1 addition & 0 deletions hack/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package tools
import (
// linter(s)
_ "golang.org/x/lint"
_ "honnef.co/go/tools/cmd/staticcheck"

// kubernetes code generators
_ "k8s.io/code-generator/cmd/conversion-gen"
Expand Down
6 changes: 6 additions & 0 deletions hack/verify-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ if [[ "${VERIFY_GOVET:-true}" == "true" ]]; then
cd "${REPO_ROOT}"
fi

if [[ "${VERIFY_STATICCHECK:-true}" == "true" ]]; then
echo "verifying staticcheck ..."
hack/verify-staticcheck.sh || res=1
cd "${REPO_ROOT}"
fi

if [[ "${VERIFY_GENERATED:-true}" == "true" ]]; then
echo "verifying generated ..."
hack/verify-generated.sh || res=1
Expand Down
38 changes: 38 additions & 0 deletions hack/verify-staticcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Copyright 2019 The Kubernetes Authors.
#
# 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.

# CI script to run staticcheck
set -o errexit
set -o nounset
set -o pipefail

# cd to the repo root
REPO_ROOT=$(git rev-parse --show-toplevel)
cd "${REPO_ROOT}"

# enable modules and the proxy cache
export GO111MODULE="on"
GOPROXY="${GOPROXY:-https://proxy.golang.org}"
export GOPROXY

# build staticcheck
BINDIR="${REPO_ROOT}/bin"
# use the tools module
cd "hack/tools"
go build -o "${BINDIR}/staticcheck" honnef.co/go/tools/cmd/staticcheck
# go back to the root
cd "${REPO_ROOT}"

"${BINDIR}/staticcheck" ./pkg/... ./cmd/... .
1 change: 1 addition & 0 deletions pkg/cluster/config/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
func Funcs(codecs runtimeserializer.CodecFactory) []interface{} {
return []interface{}{
fuzzConfig,
fuzzNode,
}
}

Expand Down

0 comments on commit a25f57d

Please sign in to comment.