From 195082d33b9acb4f85ab1e8b2d839f937c2c42ef Mon Sep 17 00:00:00 2001 From: Sean Malloy Date: Tue, 11 Aug 2020 21:37:55 -0500 Subject: [PATCH 1/2] Update To Go 1.15.0 As part of the k8s 1.19 release cycle the Go version is being bumped to 1.15.0. Updating the descheduler to use Go 1.15 prior to the descheduler v0.19.0 release. See below issues for reference: * https://github.com/kubernetes/release/issues/1421 * https://github.com/kubernetes/kubernetes/issues/93484 --- Dockerfile | 2 +- docs/contributor-guide.md | 4 ++-- go.mod | 2 +- hack/update-gofmt.sh | 2 +- hack/verify-gofmt.sh | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index b76562e27..da5625bf4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,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. -FROM golang:1.14.4 +FROM golang:1.15.0 WORKDIR /go/src/sigs.k8s.io/descheduler COPY . . diff --git a/docs/contributor-guide.md b/docs/contributor-guide.md index 0d747b891..c9df10548 100644 --- a/docs/contributor-guide.md +++ b/docs/contributor-guide.md @@ -3,7 +3,7 @@ ## Required Tools - [Git](https://git-scm.com/downloads) -- [Go 1.14+](https://golang.org/dl/) +- [Go 1.15+](https://golang.org/dl/) - [Docker](https://docs.docker.com/install/) - [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl) - [kind](https://kind.sigs.k8s.io/) @@ -40,4 +40,4 @@ make test-e2e ``` ### Miscellaneous -See the [hack directory](https://github.com/kubernetes-sigs/descheduler/tree/master/hack) for additional tools and scripts used for developing the descheduler. \ No newline at end of file +See the [hack directory](https://github.com/kubernetes-sigs/descheduler/tree/master/hack) for additional tools and scripts used for developing the descheduler. diff --git a/go.mod b/go.mod index 51642faeb..17da5bd15 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module sigs.k8s.io/descheduler -go 1.14 +go 1.15 require ( github.com/spf13/cobra v0.0.5 diff --git a/hack/update-gofmt.sh b/hack/update-gofmt.sh index 3b843c28b..927d76d72 100755 --- a/hack/update-gofmt.sh +++ b/hack/update-gofmt.sh @@ -23,7 +23,7 @@ DESCHEDULER_ROOT=$(dirname "${BASH_SOURCE}")/.. GO_VERSION=($(go version)) -if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.2|go1.3|go1.4|go1.5|go1.6|go1.7|go1.8|go1.9|go1.10|go1.11|go1.12|go1.13|go1.14') ]]; then +if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.13|go1.14|go1.15') ]]; then echo "Unknown go version '${GO_VERSION[2]}', skipping gofmt." exit 1 fi diff --git a/hack/verify-gofmt.sh b/hack/verify-gofmt.sh index 87f65e370..fb2102491 100755 --- a/hack/verify-gofmt.sh +++ b/hack/verify-gofmt.sh @@ -23,7 +23,7 @@ DESCHEDULER_ROOT=$(dirname "${BASH_SOURCE}")/.. GO_VERSION=($(go version)) -if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.2|go1.3|go1.4|go1.5|go1.6|go1.7|go1.8|go1.9|go1.10|go1.11|go1.12|go1.13|go1.14') ]]; then +if [[ -z $(echo "${GO_VERSION[2]}" | grep -E 'go1.13|go1.14|go1.15') ]]; then echo "Unknown go version '${GO_VERSION[2]}', skipping gofmt." exit 1 fi From 1fb3445692282bc41a7f09bf2efa187dacffa2d8 Mon Sep 17 00:00:00 2001 From: Sean Malloy Date: Mon, 24 Aug 2020 23:13:03 -0500 Subject: [PATCH 2/2] Fix golangci-lint Failures For 1.30.0 Upgrade --- Makefile | 2 +- pkg/descheduler/node/node_test.go | 4 ++-- test/e2e/e2e_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d90c2bff4..ec7757d09 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ LDFLAG_LOCATION=sigs.k8s.io/descheduler/cmd/descheduler/app LDFLAGS=-ldflags "-X ${LDFLAG_LOCATION}.version=${VERSION} -X ${LDFLAG_LOCATION}.buildDate=${BUILD} -X ${LDFLAG_LOCATION}.gitCommit=${COMMIT}" -GOLANGCI_VERSION := v1.15.0 +GOLANGCI_VERSION := v1.30.0 HAS_GOLANGCI := $(shell ls _output/bin/golangci-lint) # REGISTRY is the container registry to push diff --git a/pkg/descheduler/node/node_test.go b/pkg/descheduler/node/node_test.go index 95af44ad9..a5f1829e8 100644 --- a/pkg/descheduler/node/node_test.go +++ b/pkg/descheduler/node/node_test.go @@ -20,7 +20,7 @@ import ( "context" "testing" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes/fake" @@ -69,7 +69,7 @@ func TestReadyNodesWithNodeSelector(t *testing.T) { sharedInformerFactory := informers.NewSharedInformerFactory(fakeClient, 0) nodeInformer := sharedInformerFactory.Core().V1().Nodes() - stopChannel := make(chan struct{}, 0) + stopChannel := make(chan struct{}) sharedInformerFactory.Start(stopChannel) sharedInformerFactory.WaitForCacheSync(stopChannel) defer close(stopChannel) diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index eaea2d69d..5d6b97924 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -144,7 +144,7 @@ func initializeClient(t *testing.T) (clientset.Interface, coreinformers.NodeInfo t.Errorf("Error during client creation with %v", err) } - stopChannel := make(chan struct{}, 0) + stopChannel := make(chan struct{}) sharedInformerFactory := informers.NewSharedInformerFactory(clientSet, 0) sharedInformerFactory.Start(stopChannel)