Skip to content

Commit

Permalink
Update Go to 1.19
Browse files Browse the repository at this point in the history
chore: Upgrade Go from 1.18 to 1.19

Plus:

Fixes lint issues:

- Can't run linter goanalysis_metalinter: goanalysis_metalinter: buildir: package "netip" (isInitialPkg: false, needAnalyzeSource: true): in net/netip.AddrFromSlice: cannot convert Load <[]byte> t0 ([]byte) to [4]byte

Warnings:

WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused.
WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused.
WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused.

Signed-off-by: Spolti <[email protected]>
  • Loading branch information
spolti committed Oct 31, 2023
1 parent 68c135f commit ccf4a0e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,13 @@ linters:
fast: false
enable:
# These are the defaults for golangci-lint
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck

# Also enable these
- goconst
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
repos:
- repo: https://github.com/golangci/golangci-lint
rev: v1.50.1
rev: v1.51.1
hooks:
- id: golangci-lint
entry: golangci-lint run
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
###############################################################################
# Stage 1: Create the developer image for the BUILDPLATFORM only
###############################################################################
ARG GOLANG_VERSION=1.18
ARG GOLANG_VERSION=1.19
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/go-toolset:$GOLANG_VERSION AS develop

ARG PROTOC_VERSION=21.12
Expand Down Expand Up @@ -125,13 +125,13 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
GOARCH=${TARGETARCH:-amd64} \
CGO_ENABLED=0 \
GO111MODULE=on \
go build -a -o /go/bin/server ./proxy/
go mod tidy && go build -a -o /go/bin/server ./proxy/


###############################################################################
# Stage 3: Copy binaries only to create the smallest final runtime image
###############################################################################
FROM registry.access.redhat.com/ubi8/ubi-micro:8.7 as runtime
FROM registry.access.redhat.com/ubi8/ubi-micro:8.8 as runtime

ARG USER=2000

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fmt:
.PHONY: test
## Run tests
test:
go test -coverprofile cover.out `go list ./...`
go test -coverprofile cover.out `go list -buildvcs=false ./...`

.DEFAULT_GOAL := help
.PHONY: help
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/kserve/rest-proxy

go 1.18
go 1.19

require (
github.com/google/go-cmp v0.5.9
Expand Down
10 changes: 10 additions & 0 deletions scripts/fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.#

# Fix: 'fatal: detected dubious ownership in repository',
# only do this if it is running into the develop image
if [ "${PWD}" == "/opt/app" ]; then
git config --global --add safe.directory "*"
fi

pre-commit run --all-files
RETURN_CODE=$?
## cat this file for helping on identifying the root cause when some issue happens
if [ -f /$USER/.cache/pre-commit/pre-commit.log ]; then
cat /$USER/.cache/pre-commit/pre-commit.log
fi

function echoError() {
LIGHT_YELLOW='\033[1;33m'
Expand Down

0 comments on commit ccf4a0e

Please sign in to comment.