Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to go 1.23 #224

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/jenkins-x-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GIT_BOT_TOKEN }}
VERSION: ${{ steps.prep.outputs.version }}
name: release-binary
uses: docker://golang:1.18.6
uses: docker://golang:1.23.2@sha256:a7f2fc9834049c1f5df787690026a53738e55fc097cd8a4a93faa3e06c67ee32
with:
args: -c "make release"
entrypoint: bash
Expand All @@ -40,15 +40,15 @@ jobs:
REPO_NAME: ${{ github.event.repository.name }}
VERSION: ${{ steps.prep.outputs.version }}
name: changelog
uses: docker://ghcr.io/jenkins-x/jx-changelog:0.0.43
uses: docker://ghcr.io/jenkins-x/jx-boot:3.10.166
with:
entrypoint: .github/workflows/jenkins-x/changelog.sh
- env:
GITHUB_TOKEN: ${{ secrets.GIT_BOT_TOKEN }}
REPOSITORY: ${{ github.repository }}
VERSION: ${{ steps.prep.outputs.version }}
name: upload-binaries
uses: docker://goreleaser/goreleaser:v1.10.2
uses: docker://ghcr.io/jenkins-x/jx-goreleaser-image:1.0.0@sha256:35070795367fea9a789c1c3a138b5e32262e4253d38e47406ba9ab7833ff15b2
with:
entrypoint: .github/workflows/jenkins-x/upload-binaries.sh
- name: Set up QEMU
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jenkins-x/upload-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.18.6"
export GOVERSION="1.23.2"
export ROOTPACKAGE="github.com/$REPOSITORY"

# Install syft
Expand Down
95 changes: 95 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
linters-settings:
depguard:
rules:
# Name of a rule.
Main:
list-mode: lax
deny:
- pkg: github.com/jenkins-x/jx/v2/pkg/log/
desc: "use jenkins-x/jx-logging instead"
- pkg: github.com/satori/go.uuid
desc: "use github.com/google/uuid instead"
- pkg: github.com/pborman/uuid
desc: "use github.com/google/uuid instead"
dupl:
threshold: 100
exhaustive:
default-signifies-exhaustive: false
funlen:
lines: 200
statements: 150
goconst:
min-len: 3
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
- importShadow # not important for now
- unnamedResult # not important
gocyclo:
min-complexity: 15
goimports: {}
revive:
confidence: 0
gofmt:
simplify: true
mnd:
# don't include the "operation" and "assign"
checks: [argument, case, condition, return]
govet:
settings:
printf:
funcs:
- (github.com/jenkins-x/jx-logging/v3/pkg/log/Logger()).Debugf
- (github.com/jenkins-x/jx-logging/v3/pkg/log/Logger()).Infof
- (github.com/jenkins-x/jx-logging/v3/pkg/log/Logger()).Warnf
- (github.com/jenkins-x/jx-logging/v3/pkg/log/Logger()).Errorf
- (github.com/jenkins-x/jx-logging/v3/pkg/log/Logger()).Fatalf
lll:
line-length: 140
misspell: {}
nolintlint:
allow-unused: false # report any unused nolint directives
require-explanation: false # don't require an explanation for nolint directives
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- asciicheck
- bodyclose
- depguard
- errcheck
- gofmt
- goimports
- goprintffuncname
- gosec
- gosimple
- ineffassign
- misspell
- nakedret
- rowserrcheck
- staticcheck
- typecheck
- unconvert
- unparam
- unused
- revive
- gocritic
- govet

run:
timeout: 30m
# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
25 changes: 3 additions & 22 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,57 @@
version: 2
env:
- GO111MODULE=on
- CGO_ENABLED=0
before:
hooks:
- go mod download

builds:
- id: jx-git-operator
# Path to main.go file or main package.
# Default is `.`.
main: ./main.go

# Binary name.
# Can be a path (e.g. `bin/app`) to wrap the binary in a directory.
# Default is the name of the project directory.
binary: jx-git-operator

# Custom ldflags templates.
# Default is `-s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} -X main.builtBy=goreleaser`.
ldflags:
- -X "{{.Env.ROOTPACKAGE}}/pkg/cmd/version.Version={{.Env.VERSION}}" -X "{{.Env.ROOTPACKAGE}}/pkg/cmd/version.Revision={{.Env.REV}}" -X "{{.Env.ROOTPACKAGE}}/pkg/cmd/version.Branch={{.Env.BRANCH}}" -X "{{.Env.ROOTPACKAGE}}/pkg/cmd/version.BuildDate={{.Env.BUILDDATE}}" -X "{{.Env.ROOTPACKAGE}}/pkg/cmd/version.GoVersion={{.Env.GOVERSION}}"

ldflags: ""
# GOOS list to build for.
# For more info refer to: https://golang.org/doc/install/source#environment
# Defaults are darwin and linux.
goos:
- windows
- darwin
- linux

# GOARCH to build for.
# For more info refer to: https://golang.org/doc/install/source#environment
# Defaults are 386 and amd64.
goarch:
- amd64
- arm
- arm64

archives:
- name_template: "jx-git-operator-{{ .Os }}-{{ .Arch }}"
format_overrides:
- goos: windows
format: zip

checksum:
# You can change the name of the checksums file.
# Default is `jx-git-operator_{{ .Version }}_checksums.txt`.
name_template: "jx-git-operator-checksums.txt"

# Algorithm to be used.
# Accepted options are sha256, sha512, sha1, crc32, md5, sha224 and sha384.
# Default is sha256.
algorithm: sha256

changelog:
# set it to true if you wish to skip the changelog generation
skip: true

disable: true
release:
# If set to true, will not auto-publish the release.
# Default is false.
draft: false

# If set to auto, will mark the release as not ready for production
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
# If set to true, will mark the release as not ready for production.
# Default is false.
prerelease: false

# You can change the name of the GitHub release.
# Default is `{{.Tag}}`
name_template: "{{.Env.VERSION}}"

sboms:
- artifacts: archive
13 changes: 2 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ BUILD_DATE := $(shell date +%Y%m%d-%H:%M:%S)
# This does not reflect the go binary version which was used to build the jx binary, and also does not reflect the version in the catalog.
# The sole purpose of this variable is to build a new binary if we ever need to build a new jx binary with a new go version with no code change.
# If you notice that this version is not the same as the catalog version, please open a PR, the maintainers are happy to review it.
DUMMY_GO_VERSION := 1.18.6

GO_VERSION := $(shell $(GO) version | sed -e 's/^[^0-9.]*\([0-9.]*\).*/\1/')
DUMMY_GO_VERSION := 1.23

GO := GO111MODULE=on go
BUILD_TARGET = build
Expand All @@ -29,10 +27,7 @@ GOPRIVATE := github.com/jenkins-x/jx-helpers

MAIN_SRC_FILE=./main.go

BUILDFLAGS := -ldflags \
" -X main.buildTime=$(BUILD_DATE) \
-X main.gitCommit=$(REV) \
-X main.version=$(VERSION)"
BUILDFLAGS :=

REPORTS_DIR=bin

Expand All @@ -51,10 +46,6 @@ release: clean linux test

release-all: release linux win darwin

.PHONY: goreleaser
goreleaser:
step-go-releaser --organisation=$(ORG) --revision=$(REV) --branch=$(BRANCH) --build-date=$(BUILD_DATE) --go-version=$(GO_VERSION) --root-package=$(ROOT_PACKAGE) --version=$(VERSION)

fmt:
go fmt ./...

Expand Down
3 changes: 3 additions & 0 deletions charts/jx-git-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@ spec:
{{ toYaml .Values.envFrom | indent 10 }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.tolerations }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
serviceAccountName: "{{ .Values.serviceAccount.name | default "jx-git-operator" }}"
105 changes: 50 additions & 55 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,79 +1,74 @@
module github.com/jenkins-x/jx-git-operator

go 1.19
go 1.23

require (
github.com/google/uuid v1.2.0
github.com/imdario/mergo v0.3.16
github.com/jenkins-x/jx-helpers/v3 v3.3.1
github.com/jenkins-x/jx-kube-client/v3 v3.0.3
github.com/jenkins-x/jx-logging/v3 v3.0.11
github.com/pkg/errors v0.9.1
dario.cat/mergo v1.0.1
github.com/google/uuid v1.6.0
github.com/jenkins-x/jx-helpers/v3 v3.8.0
github.com/jenkins-x/jx-kube-client/v3 v3.0.8
github.com/jenkins-x/jx-logging/v3 v3.0.17
github.com/sethvargo/go-envconfig v0.3.5
github.com/stretchr/testify v1.7.0
k8s.io/api v0.22.15
k8s.io/apimachinery v0.22.15
k8s.io/client-go v11.0.0+incompatible
github.com/stretchr/testify v1.9.0
k8s.io/api v0.31.1
k8s.io/apimachinery v0.31.1
k8s.io/client-go v0.31.1
)

require (
cloud.google.com/go v0.81.0 // indirect
github.com/AlecAivazis/survey/v2 v2.3.4 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.19 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.14 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v4.11.0+incompatible // indirect
github.com/fatih/color v1.10.0 // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-logr/logr v0.4.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/jenkins-x/jx-api/v4 v4.4.0 // indirect
github.com/jenkins-x/logrus-stackdriver-formatter v0.2.4 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jenkins-x/jx-api/v4 v4.7.6 // indirect
github.com/jenkins-x/logrus-stackdriver-formatter v0.2.7 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rawlingsj/jsonschema v0.0.0-20210511142122-a9c2cfdb7dcf // indirect
github.com/rickar/props v0.0.0-20170718221555-0b06aeb2f037 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
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-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-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-20210723032227-1f47c861a9ac // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.26.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.9.0 // indirect
k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c // indirect
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
)

replace (
k8s.io/api => k8s.io/api v0.22.15
k8s.io/apimachinery => k8s.io/apimachinery v0.22.15
k8s.io/client-go => k8s.io/client-go v0.22.15
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240521193020-835d969ad83a // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading