From dbaa636c45f650bba8f842e2f3c9bdeb7d167aff Mon Sep 17 00:00:00 2001 From: ruiqiu <18362972275@163.com> Date: Thu, 21 May 2026 20:43:35 +0800 Subject: [PATCH 1/3] fix(security): build harbor-cli with Go 1.26.3 --- .dagger/go.mod | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.dagger/go.mod b/.dagger/go.mod index 231bbaf35..188806363 100644 --- a/.dagger/go.mod +++ b/.dagger/go.mod @@ -1,6 +1,6 @@ module dagger/harbor-cli -go 1.26.2 +go 1.26.3 replace go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc => go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 diff --git a/go.mod b/go.mod index 274faa68f..893a7118a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/goharbor/harbor-cli -go 1.26.2 +go 1.26.3 require ( github.com/atotto/clipboard v0.1.4 From 44f9c17a8faf994b5491d009f6d7c4eaecbe9aa4 Mon Sep 17 00:00:00 2001 From: ruiqiu <18362972275@163.com> Date: Thu, 21 May 2026 20:48:01 +0800 Subject: [PATCH 2/3] fix(ci): keep dagger module on supported Go version --- .dagger/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dagger/go.mod b/.dagger/go.mod index 188806363..231bbaf35 100644 --- a/.dagger/go.mod +++ b/.dagger/go.mod @@ -1,6 +1,6 @@ module dagger/harbor-cli -go 1.26.3 +go 1.26.2 replace go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc => go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0 From f7992a4258daab891167601822cc5502a3c79559 Mon Sep 17 00:00:00 2001 From: ruiqiu <18362972275@163.com> Date: Thu, 21 May 2026 21:20:02 +0800 Subject: [PATCH 3/3] fix(lint): use reflect.Pointer kind --- cmd/harbor/root/context/delete.go | 6 +++--- cmd/harbor/root/context/get.go | 4 ++-- cmd/harbor/root/context/update.go | 6 +++--- pkg/utils/error.go | 2 +- pkg/utils/reflect.go | 4 ++-- pkg/views/info/list/view.go | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/harbor/root/context/delete.go b/cmd/harbor/root/context/delete.go index a04a9b75a..5c0f18065 100644 --- a/cmd/harbor/root/context/delete.go +++ b/cmd/harbor/root/context/delete.go @@ -187,7 +187,7 @@ func deleteValueInConfig( func deleteNestedValue(obj interface{}, path []string, actualSegments *[]string) error { // We require obj to be a pointer to a struct so we can modify it. val := reflect.ValueOf(obj) - if val.Kind() != reflect.Ptr { + if val.Kind() != reflect.Pointer { return fmt.Errorf("object must be a pointer to a struct, got %s", val.Kind()) } val = val.Elem() // dereference pointer @@ -219,12 +219,12 @@ func deleteNestedValue(obj interface{}, path []string, actualSegments *[]string) // If this is NOT the last path segment, move deeper if i < len(path)-1 { // If the field is a pointer and nil, we can't go deeper - if fieldValue.Kind() == reflect.Ptr && fieldValue.IsNil() { + if fieldValue.Kind() == reflect.Pointer && fieldValue.IsNil() { return fmt.Errorf("field '%s' is nil and cannot be traversed", field.Name) } // Descend val = fieldValue - if val.Kind() == reflect.Ptr { + if val.Kind() == reflect.Pointer { val = val.Elem() } continue diff --git a/cmd/harbor/root/context/get.go b/cmd/harbor/root/context/get.go index 196cc63d7..4e7b37518 100644 --- a/cmd/harbor/root/context/get.go +++ b/cmd/harbor/root/context/get.go @@ -155,7 +155,7 @@ func getNestedValue(obj interface{}, path []string, actualSegments *[]string) (i for _, key := range path { // If it's a pointer, dereference - if current.Kind() == reflect.Ptr { + if current.Kind() == reflect.Pointer { current = current.Elem() } if current.Kind() != reflect.Struct { @@ -189,7 +189,7 @@ func getNestedValue(obj interface{}, path []string, actualSegments *[]string) (i } // Finally, if we ended on a pointer, dereference it - if current.Kind() == reflect.Ptr { + if current.Kind() == reflect.Pointer { current = current.Elem() } return current.Interface(), nil diff --git a/cmd/harbor/root/context/update.go b/cmd/harbor/root/context/update.go index 9619cdc21..11e797553 100644 --- a/cmd/harbor/root/context/update.go +++ b/cmd/harbor/root/context/update.go @@ -142,7 +142,7 @@ func setValueInConfig( func setNestedValue(obj interface{}, path []string, newValue string, actualSegments *[]string) error { // We require obj to be a pointer to a struct so we can modify it. val := reflect.ValueOf(obj) - if val.Kind() != reflect.Ptr { + if val.Kind() != reflect.Pointer { return fmt.Errorf("object must be a pointer to a struct, got %s", val.Kind()) } val = val.Elem() // dereference pointer @@ -174,13 +174,13 @@ func setNestedValue(obj interface{}, path []string, newValue string, actualSegme // If this is NOT the last path segment, move deeper if i < len(path)-1 { // If the field is a pointer and nil, allocate a new instance - if fieldValue.Kind() == reflect.Ptr && fieldValue.IsNil() { + if fieldValue.Kind() == reflect.Pointer && fieldValue.IsNil() { newElem := reflect.New(fieldValue.Type().Elem()) fieldValue.Set(newElem) } // Descend val = fieldValue - if val.Kind() == reflect.Ptr { + if val.Kind() == reflect.Pointer { val = val.Elem() } continue diff --git a/pkg/utils/error.go b/pkg/utils/error.go index e7cda1c76..60b206801 100644 --- a/pkg/utils/error.go +++ b/pkg/utils/error.go @@ -34,7 +34,7 @@ func ParseHarborErrorMsg(err error) string { } val := reflect.ValueOf(err) - if val.Kind() == reflect.Ptr { + if val.Kind() == reflect.Pointer { val = val.Elem() } field := val.FieldByName("Payload") diff --git a/pkg/utils/reflect.go b/pkg/utils/reflect.go index 93b058880..c160f2230 100644 --- a/pkg/utils/reflect.go +++ b/pkg/utils/reflect.go @@ -133,7 +133,7 @@ func ExtractConfigValues[T ConfigType](cfg T) map[string]any { field := v.Field(i) fieldName := t.Field(i).Name // Skip nil pointers - if field.Kind() == reflect.Ptr && field.IsNil() { + if field.Kind() == reflect.Pointer && field.IsNil() { continue } configItem := field.Interface() @@ -154,7 +154,7 @@ func ExtractConfigValues[T ConfigType](cfg T) map[string]any { default: // Handle generic pointer types using reflection val := reflect.ValueOf(configItem) - if val.Kind() == reflect.Ptr && !val.IsNil() { + if val.Kind() == reflect.Pointer && !val.IsNil() { deref := val.Elem() // Only include non-zero values if deref.IsValid() && !deref.IsZero() { diff --git a/pkg/views/info/list/view.go b/pkg/views/info/list/view.go index d6dea221c..8fc02f28e 100644 --- a/pkg/views/info/list/view.go +++ b/pkg/views/info/list/view.go @@ -111,7 +111,7 @@ func renderSectionTable(title string, data interface{}) { func createRows(data interface{}, rows *[]table.Row) { val := reflect.ValueOf(data) - if val.Kind() == reflect.Ptr { + if val.Kind() == reflect.Pointer { val = val.Elem() } @@ -127,7 +127,7 @@ func createRows(data interface{}, rows *[]table.Row) { fieldType := typ.Field(i) fieldName := fieldType.Name - if field.Kind() == reflect.Ptr && !field.IsNil() { + if field.Kind() == reflect.Pointer && !field.IsNil() { field = field.Elem() }