diff --git a/.golangci.yaml b/.golangci.yaml index 7c2c99d..ffa4edc 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d7df237..3b7dca5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/Dockerfile b/Dockerfile index 5a40499..b00e3e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 diff --git a/Makefile b/Makefile index f40b0ca..8317090 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/go.mod b/go.mod index 4b2f2c7..ef329a7 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/scripts/fmt.sh b/scripts/fmt.sh index 7617f0c..cdbc0ed 100755 --- a/scripts/fmt.sh +++ b/scripts/fmt.sh @@ -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'