From 9f2b4e3f5eedb0e84b56d472173c013fc8f6e028 Mon Sep 17 00:00:00 2001 From: chuntaojun Date: Sun, 24 Dec 2023 23:12:46 +0800 Subject: [PATCH] fix:github action update go version to 1.21 --- .github/workflows/docker.yml | 2 +- .github/workflows/golangci-lint.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/testing.yml | 2 +- pkg/controller/configmap.go | 6 ++++-- pkg/controller/controller.go | 6 ++++-- pkg/util/map.go | 3 ++- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ee112f1f..4215834d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -21,7 +21,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: "1.20" + go-version: "1.21" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 56913241..64134fe4 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -29,7 +29,7 @@ jobs: golangci: strategy: matrix: - go-version: [ "1.20" ] + go-version: [ "1.21" ] name: golangci-lint runs-on: ubuntu-latest steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae537624..3d9b4f32 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: "1.20" + go-version: "1.21" - name: Build id: build diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 786ec16f..65cf3605 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: "1.20" + go-version: "1.21" - name: Build polairs-controller run: make build diff --git a/pkg/controller/configmap.go b/pkg/controller/configmap.go index a8120751..d23567d0 100644 --- a/pkg/controller/configmap.go +++ b/pkg/controller/configmap.go @@ -103,7 +103,8 @@ func (p *PolarisController) syncConfigMap(task *Task) error { metav1.SetMetaDataAnnotation(&operationConfigMap.ObjectMeta, util.PolarisConfigGroup, groupName) } // 记录ConfigMap 的 sync 来源 kubernetes 集群 - metav1.SetMetaDataLabel(&operationConfigMap.ObjectMeta, util.InternalConfigFileSyncSourceClusterKey, p.config.PolarisController.ClusterName) + metav1.SetMetaDataLabel(&operationConfigMap.ObjectMeta, util.InternalConfigFileSyncSourceClusterKey, + p.config.PolarisController.ClusterName) cachedConfigMap, ok := p.configFileCache.Load(task.Key()) if !ok { @@ -161,7 +162,8 @@ func (p *PolarisController) processSyncNamespaceAndConfigMap(configmap *v1.Confi func (p *PolarisController) processUpdateConfigMap(old, cur *v1.ConfigMap) error { log.SyncConfigScope().Infof("Update ConfigMap %s/%s", cur.GetNamespace(), cur.GetName()) if !p.IsPolarisConfigMap(cur) { - log.SyncConfigScope().Infof("user cancel sync ConfigMap %s/%s, delete(%v)", cur.GetNamespace(), cur.GetName(), p.allowDeleteConfig()) + log.SyncConfigScope().Infof("user cancel sync ConfigMap %s/%s, delete(%v)", cur.GetNamespace(), + cur.GetName(), p.allowDeleteConfig()) return p.processDeleteConfigMap(cur) } _, err := polarisapi.UpdateConfigMap(cur) diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index d96eefaf..4ef68c4e 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -204,12 +204,14 @@ func NewPolarisController( // AllowSyncFromConfigMap 是否开启配置同步从 ConfigMap 到 Polaris func (p *PolarisController) AllowSyncFromConfigMap() bool { - return p.config.PolarisController.ConfigSync.Enable && p.config.PolarisController.ConfigSync.SyncDirection != util.SyncDirectionPolarisKubernetes + return p.config.PolarisController.ConfigSync.Enable && + p.config.PolarisController.ConfigSync.SyncDirection != util.SyncDirectionPolarisKubernetes } // AllowSyncToConfigMap 是否开启配置同步从 Polaris 到 Kubernetes func (p *PolarisController) AllowSyncToConfigMap() bool { - return p.config.PolarisController.ConfigSync.Enable && p.config.PolarisController.ConfigSync.SyncDirection != util.SyncDirectionKubernetesToPolaris + return p.config.PolarisController.ConfigSync.Enable && + p.config.PolarisController.ConfigSync.SyncDirection != util.SyncDirectionKubernetesToPolaris } func (p *PolarisController) allowDeleteConfig() bool { diff --git a/pkg/util/map.go b/pkg/util/map.go index 648bf207..15415cea 100644 --- a/pkg/util/map.go +++ b/pkg/util/map.go @@ -126,7 +126,8 @@ func (set *SyncSet[K]) Contains(val K) bool { func (set *SyncSet[K]) String() string { ret := set.ToSlice() - data, _ := json.Marshal(ret) + data, err := json.Marshal(ret) + _ = err return string(data) }