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: Update the go version to 1.22 #188

Merged
merged 20 commits into from
Jul 10, 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
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ on:

env:
# Common versions
GO_VERSION: '1.19'
GOLANGCI_VERSION: 'v1.49'
GO_VERSION: '1.22'
GOLANGCI_VERSION: 'v1.59'
K3D_IMAGE_VERSION: '[\"v1.26\"]'
K3D_IMAGE_VERSIONS: '[\"v1.26\"]'

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ on:

env:
# Common versions
GO_VERSION: '1.19'
GOLANGCI_VERSION: 'v1.49'
GO_VERSION: '1.22'
GOLANGCI_VERSION: 'v1.59'

jobs:

Expand Down Expand Up @@ -49,14 +49,14 @@ jobs:
submodules: true

- name: Cache Go Dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-

- name: Install StaticCheck
run: go install honnef.co/go/tools/cmd/staticcheck@2022.1
run: go install honnef.co/go/tools/cmd/staticcheck@2023.1.7

- name: Static Check
run: staticcheck ./...
Expand All @@ -78,7 +78,7 @@ jobs:
submodules: true

- name: Cache Go Dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/post-submit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch: {}

env:
GO_VERSION: '1.19'
GO_VERSION: '1.22'

jobs:

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ on:

env:
# Common versions
GO_VERSION: '1.19'
GOLANGCI_VERSION: 'v1.49'
GO_VERSION: '1.22'
GOLANGCI_VERSION: 'v1.59'
KIND_VERSION: 'v0.7.0'

jobs:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG BASE_IMAGE
# Build the manager binary
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine as builder
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.22-alpine as builder
ARG GOPROXY
ENV GOPROXY=${GOPROXY:-https://goproxy.cn}
WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.e2e
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG BASE_IMAGE
# Build the manager binary
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine as builder
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.22-alpine as builder
ARG GOPROXY
ENV GOPROXY=${GOPROXY:-https://goproxy.cn}
WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func waitWebhookSecretVolume(certDir string, timeout, interval time.Duration) er
return false
}
// check if secret files are empty
err = filepath.Walk(certDir, func(path string, info os.FileInfo, err error) error {
err = filepath.Walk(certDir, func(path string, info os.FileInfo, err error) error { //nolint:revive,unused
// even Cert dir is created, cert files are still empty for a while
if info.Size() == 0 {
return errors.New("secret is not ready")
Expand Down
8 changes: 4 additions & 4 deletions controllers/backup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ func (r *BackupReconciler) SetupWithManager(mgr ctrl.Manager) error {
// filter the changes in workflow status
// let workflow handle its reconcile
UpdateFunc: func(e ctrlEvent.UpdateEvent) bool {
new := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun)
old := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun)
newObj := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun)
oldObj := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun)
// if the workflow is not finished, skip the reconcile
if !new.Status.Finished {
if !newObj.Status.Finished {
return false
}

return !reflect.DeepEqual(old, new)
return !reflect.DeepEqual(oldObj, newObj)
},
CreateFunc: func(e ctrlEvent.CreateEvent) bool {
run := e.Object.DeepCopyObject().(*v1alpha1.WorkflowRun)
Expand Down
20 changes: 10 additions & 10 deletions controllers/workflowrun_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,37 +216,37 @@ func (r *WorkflowRunReconciler) SetupWithManager(mgr ctrl.Manager) error {
// filter the changes in workflow status
// let workflow handle its reconcile
UpdateFunc: func(e ctrlEvent.UpdateEvent) bool {
new, isNewWR := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun)
old, isOldWR := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun)
newObj, isNewWR := e.ObjectNew.DeepCopyObject().(*v1alpha1.WorkflowRun)
oldObj, isOldWR := e.ObjectOld.DeepCopyObject().(*v1alpha1.WorkflowRun)

// if the object is a event listener, reconcile the controller
if !isNewWR || !isOldWR {
return true
}

// if the workflow is finished, skip the reconcile
if new.Status.Finished {
if newObj.Status.Finished {
return false
}

// filter managedFields changes
old.ManagedFields = nil
new.ManagedFields = nil
oldObj.ManagedFields = nil
newObj.ManagedFields = nil

// filter resourceVersion changes
old.ResourceVersion = new.ResourceVersion
oldObj.ResourceVersion = newObj.ResourceVersion

// if the generation is changed, return true to let the controller handle it
if old.Generation != new.Generation {
if oldObj.Generation != newObj.Generation {
return true
}

// ignore the changes in step status
old.Status.Steps = new.Status.Steps
oldObj.Status.Steps = newObj.Status.Steps

return !reflect.DeepEqual(old, new)
return !reflect.DeepEqual(oldObj, newObj)
},
CreateFunc: func(e ctrlEvent.CreateEvent) bool {
CreateFunc: func(e ctrlEvent.CreateEvent) bool { //nolint:revive,unused
return true
},
}).
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/kubevela/workflow

go 1.19
go 1.22

require (
cuelang.org/go v0.5.0
Expand Down
Loading
Loading