From d636cfa28fae23933b28ec7b40d55766e09cb459 Mon Sep 17 00:00:00 2001 From: rajatgupta24 Date: Wed, 28 Sep 2022 14:49:10 +0530 Subject: [PATCH] This PR updates the go to 1.18.4 This PR also updates the `lint` phony in Makefile related to: https://github.com/jenkins-x/jx/issues/8283 - [x] Change the version in `go.mod` file. - [x] Run `go mod tidy` and ensure that it does not error out. - [x] Change `GO_VERSION` in `makefile` to the version you are upgrading. - [x] Check if there are any references to an older version and replace those. - [x] Verify that - [x] The build works by running `make build`. - [x] Tests are working, by running `make test`. - [x] Linting checks are working by running `make lint`. --- .github/workflows/jenkins-x-release.yaml | 2 +- .../workflows/jenkins-x/upload-binaries.sh | 2 +- Makefile | 9 +++-- go.mod | 8 ++-- go.sum | 14 +++---- hack/linter.sh | 40 ++++--------------- 6 files changed, 26 insertions(+), 49 deletions(-) diff --git a/.github/workflows/jenkins-x-release.yaml b/.github/workflows/jenkins-x-release.yaml index 81b7812..c5924dd 100644 --- a/.github/workflows/jenkins-x-release.yaml +++ b/.github/workflows/jenkins-x-release.yaml @@ -22,7 +22,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GIT_BOT_TOKEN }} VERSION: ${{ steps.prep.outputs.version }} name: release-binary - uses: docker://golang:1.17.11 + uses: docker://golang:1.18 with: args: -c "make release" entrypoint: bash diff --git a/.github/workflows/jenkins-x/upload-binaries.sh b/.github/workflows/jenkins-x/upload-binaries.sh index 57d0307..5005d89 100755 --- a/.github/workflows/jenkins-x/upload-binaries.sh +++ b/.github/workflows/jenkins-x/upload-binaries.sh @@ -22,7 +22,7 @@ git push origin v$VERSION export BRANCH=$(git rev-parse --abbrev-ref HEAD) export BUILDDATE=$(date) export REV=$(git rev-parse HEAD) -export GOVERSION="1.17.11" +export GOVERSION="1.18" export ROOTPACKAGE="github.com/$REPOSITORY" # Install syft diff --git a/Makefile b/Makefile index f8a3b8a..8508d67 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ REV := $(shell git rev-parse --short HEAD 2> /dev/null || echo 'unknown') ROOT_PACKAGE := github.com/$(ORG_REPO) BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2> /dev/null || echo 'unknown') BUILD_DATE := $(shell date +%Y%m%d-%H:%M:%S) -GO_VERSION := 1.17.11 +GO_VERSION := 1.18 GO := GO111MODULE=on go BUILD_TARGET = build @@ -96,8 +96,11 @@ errors: lint2: golint ./... -lint: - golangci-lint run +.PHONY: lint +lint: ## Lint the code + ./hack/gofmt.sh + ./hack/linter.sh + ./hack/generate.sh imports: goimports -l -w . diff --git a/go.mod b/go.mod index d370978..1e7ed16 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/jenkins-x/jx-git-operator -go 1.17 +go 1.18 require ( github.com/google/uuid v1.2.0 @@ -54,10 +54,10 @@ require ( github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect - golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect - golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602 // indirect - golang.org/x/sys v0.0.0-20220207234003-57398862261d // indirect + golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect diff --git a/go.sum b/go.sum index af7bb68..ff511ad 100644 --- a/go.sum +++ b/go.sum @@ -317,8 +317,8 @@ golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g= -golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -388,8 +388,8 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -456,12 +456,10 @@ golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220207234003-57398862261d h1:Bm7BNOQt2Qv7ZqysjeLjgCBanX+88Z/OtdvsrEv1Djc= -golang.org/x/sys v0.0.0-20220207234003-57398862261d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= diff --git a/hack/linter.sh b/hack/linter.sh index 9513303..13f1809 100755 --- a/hack/linter.sh +++ b/hack/linter.sh @@ -9,38 +9,14 @@ fi DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -if ! [ -x "$(command -v golangci-lint)" ]; then - echo "Installing GolangCI-Lint" - ${DIR}/install_golint.sh -b $GOPATH/bin v1.20.0 +linterVersion="$(golangci-lint --version | awk '{print $4}')" + +expectedLinterVersion=1.46.2 + +if [ "${linterVersion}" != "${expectedLinterVersion}" ]; then + echo "Install GolangCI-Lint version ${expectedLinterVersion}" + exit 1 fi export GO111MODULE=on -golangci-lint run \ - --no-config \ - --disable-all \ - -E golint \ - -E varcheck \ - -E errcheck \ - -E misspell \ - -E unconvert \ - -E deadcode \ - -E unconvert \ - -E gosec \ - -E gofmt \ - -E goimports \ - -E structcheck \ - -E interfacer \ - -E govet \ - -E unparam \ - -E megacheck \ - -E goconst \ - -E ineffassign \ - -E unparam \ - -E gocritic \ - -E maligned \ - -E typecheck \ - --skip-dirs vendor \ - --deadline 15m0s \ - --verbose \ - --build-tags build - +golangci-lint run --verbose --build-tags build