1
0
mirror of https://github.com/rancher/norman.git synced 2025-08-31 14:51:57 +00:00

[release/v0.4] Upgrade go version to 1.23 (#587)

* Upgrade go version to 1.23

Signed-off-by: Vatsal Parekh <vatsalparekh@outlook.com>

* Upgrade golangci-lint to 1.63.4

Signed-off-by: Vatsal Parekh <vatsalparekh@outlook.com>

* correct linter issues

Signed-off-by: Vatsal Parekh <vatsalparekh@outlook.com>

---------

Signed-off-by: Vatsal Parekh <vatsalparekh@outlook.com>
This commit is contained in:
Vatsal Parekh
2025-01-29 19:23:47 +05:30
committed by GitHub
parent bf01b4d6b5
commit 70595af083
4 changed files with 8 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
FROM registry.suse.com/bci/golang:1.22 FROM registry.suse.com/bci/golang:1.23
ARG DAPPER_HOST_ARCH ARG DAPPER_HOST_ARCH
ENV ARCH $DAPPER_HOST_ARCH ENV ARCH $DAPPER_HOST_ARCH
@@ -7,7 +7,7 @@ RUN zypper -n up && \
zypper -n in git docker vim curl wget zypper -n in git docker vim curl wget
RUN rm -rf /go/src /go/pkg RUN rm -rf /go/src /go/pkg
RUN if [ "${ARCH}" == "amd64" ]; then \ RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.57.2; \ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.63.4; \
fi fi
ENV DAPPER_ENV REPO TAG DRONE_TAG ENV DAPPER_ENV REPO TAG DRONE_TAG

View File

@@ -11,7 +11,7 @@ import (
func Create(context *types.APIContext, version *types.APIVersion, typeName string, data map[string]interface{}, into interface{}) error { func Create(context *types.APIContext, version *types.APIVersion, typeName string, data map[string]interface{}, into interface{}) error {
schema := context.Schemas.Schema(version, typeName) schema := context.Schemas.Schema(version, typeName)
if schema == nil { if schema == nil {
return fmt.Errorf("failed to find schema " + typeName) return fmt.Errorf("failed to find schema %s", typeName)
} }
item, err := schema.Store.Create(context, schema, data) item, err := schema.Store.Create(context, schema, data)
@@ -37,7 +37,7 @@ func Create(context *types.APIContext, version *types.APIVersion, typeName strin
func ByID(context *types.APIContext, version *types.APIVersion, typeName string, id string, into interface{}) error { func ByID(context *types.APIContext, version *types.APIVersion, typeName string, id string, into interface{}) error {
schema := context.Schemas.Schema(version, typeName) schema := context.Schemas.Schema(version, typeName)
if schema == nil { if schema == nil {
return fmt.Errorf("failed to find schema " + typeName) return fmt.Errorf("failed to find schema %s", typeName)
} }
item, err := schema.Store.ByID(context, schema, id) item, err := schema.Store.ByID(context, schema, id)
@@ -63,7 +63,7 @@ func ByID(context *types.APIContext, version *types.APIVersion, typeName string,
func List(context *types.APIContext, version *types.APIVersion, typeName string, opts *types.QueryOptions, into interface{}) error { func List(context *types.APIContext, version *types.APIVersion, typeName string, opts *types.QueryOptions, into interface{}) error {
schema := context.Schemas.Schema(version, typeName) schema := context.Schemas.Schema(version, typeName)
if schema == nil { if schema == nil {
return fmt.Errorf("failed to find schema " + typeName) return fmt.Errorf("failed to find schema %s", typeName)
} }
data, err := schema.Store.List(context, schema, opts) data, err := schema.Store.List(context, schema, opts)

4
go.mod
View File

@@ -1,8 +1,8 @@
module github.com/rancher/norman module github.com/rancher/norman
go 1.22.0 go 1.23
toolchain go1.22.1 toolchain go1.23.4
require ( require (
github.com/ghodss/yaml v1.0.0 github.com/ghodss/yaml v1.0.0

View File

@@ -298,7 +298,7 @@ func Body(req *http.Request) (map[string]interface{}, error) {
return valuesToBody(req.MultipartForm.Value), nil return valuesToBody(req.MultipartForm.Value), nil
} }
if req.PostForm != nil && len(req.PostForm) > 0 { if len(req.PostForm) > 0 {
return valuesToBody(map[string][]string(req.Form)), nil return valuesToBody(map[string][]string(req.Form)), nil
} }