Skip to content

Commit 0ba2f47

Browse files
authored
chore: Upgrade Golang version from 1.17 to 1.19 (#68)
- Remove the linters for "deadcode", "structcheck", "varcheck" - Use "os" packages instead of deprecated "io/ioutil" (SA1019) - Capture pre-commit output in a local log file Fixes #64 --------- Signed-off-by: Spolti <[email protected]>
1 parent b61efb4 commit 0ba2f47

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+169
-161
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
.DS_Store
55
Dockerfile
66
temp
7+
.pre-commit.log
8+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
*.iml
99

1010
public/
11+
12+
.pre-commit.log
13+

.golangci.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,13 @@ linters:
9393
fast: false
9494
enable:
9595
# These are the defaults for golangci-lint
96-
- deadcode
9796
- errcheck
9897
- gosimple
9998
- govet
10099
- ineffassign
101100
- staticcheck
102-
- structcheck
103101
- typecheck
104102
- unused
105-
- varcheck
106103

107104
# Also enable these
108105
- goconst

.pre-commit-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
# limitations under the License.
1414
repos:
1515
- repo: https://github.com/golangci/golangci-lint
16-
rev: v1.43.0
16+
rev: v1.51.1
1717
hooks:
1818
- id: golangci-lint
19+
log_file: .pre-commit.log
1920
- repo: https://github.com/pre-commit/mirrors-prettier
2021
rev: v2.4.1
2122
hooks:
2223
- id: prettier
24+
log_file: .pre-commit.log

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
###############################################################################
1616
# Stage 1: Create the developer image for the BUILDPLATFORM only
1717
###############################################################################
18-
ARG GOLANG_VERSION=1.17
18+
ARG GOLANG_VERSION=1.19
1919
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/go-toolset:$GOLANG_VERSION AS develop
2020

2121
ARG PROTOC_VERSION=21.5
@@ -93,6 +93,8 @@ RUN true \
9393
COPY .pre-commit-config.yaml ./
9494
RUN git init && \
9595
pre-commit install-hooks && \
96+
# Fix: 'fatal: detected dubious ownership in repository' \
97+
git config --global --add safe.directory "*" && \
9698
rm -rf .git
9799

98100
# Download dependencies before copying the source so they will be cached

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/kserve/modelmesh-runtime-adapter
22

3-
go 1.17
3+
go 1.19
44

55
require (
66
cloud.google.com/go/storage v1.28.1
@@ -12,7 +12,7 @@ require (
1212
github.com/go-logr/zapr v1.2.3
1313
github.com/golang/mock v1.6.0
1414
github.com/joho/godotenv v1.4.0
15-
github.com/stretchr/testify v1.8.1
15+
github.com/stretchr/testify v1.8.4
1616
go.uber.org/zap v1.23.0
1717
golang.org/x/sync v0.1.0
1818
google.golang.org/api v0.114.0

go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,9 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
190190
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
191191
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
192192
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
193-
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
194193
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
194+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
195+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
195196
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
196197
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
197198
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=

internal/modelschema/modelschema.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
66
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
7+
// http://www.apache.org/licenses/LICENSE-2.0
88
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,7 +16,7 @@ package modelschema
1616
import (
1717
"encoding/json"
1818
"fmt"
19-
"io/ioutil"
19+
"os"
2020
)
2121

2222
// Filename for the schema JSON
@@ -55,7 +55,7 @@ const (
5555
)
5656

5757
func NewFromFile(schemaFilename string) (*ModelSchema, error) {
58-
jsonBytes, err := ioutil.ReadFile(schemaFilename)
58+
jsonBytes, err := os.ReadFile(schemaFilename)
5959
if err != nil {
6060
return nil, fmt.Errorf("Unable to read model schema file %s: %w", schemaFilename, err)
6161
}

internal/util/connect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
66
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
7+
// http://www.apache.org/licenses/LICENSE-2.0
88
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,

internal/util/connect_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
66
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
7+
// http://www.apache.org/licenses/LICENSE-2.0
88
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,

0 commit comments

Comments
 (0)