Repository: flant/shell-operator
Pull request #422 (2022-08-22 19:18:30)

fix(deps): bump github.com/go-chi/chi from 4.0.3+incompatible to 5.0.7
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>

<!--
Thank you for sending a pull request! Here some tips for contributors:

1. Fill the description template below.
2. Include appropriate tests (if necessary). Make sure that all CI checks passed.
3. If the Pull Request is a work in progress, make use of GitHub's "Draft PR" feature and mark it as such.
-->

#### Overview

Update go-chi to v5.0.7.

#### What this PR does / why we need it

Dependabot tries to [update](https://github.com/flant/shell-operator/pull/389) go-chi to the latest incompatible version v4.1.2, but this version changes signature for `StructuredLoggerEntry.Write` method, so PR fails.

Latest go-chi is v5.0.7 and is compatible with v4.1.2.


Patch:
diff --git a/go.mod b/go.mod
index 5535ccb..85cf0b3 100644
--- a/go.mod
+++ b/go.mod
@@ -5,7 +5,7 @@ go 1.16
 require (
 	github.com/flant/kube-client v0.0.6
 	github.com/flant/libjq-go v1.6.2-0.20200616114952-907039e8a02a // branch: master
-	github.com/go-chi/chi v4.0.3+incompatible
+	github.com/go-chi/chi/v5 v5.0.7
 	github.com/go-openapi/spec v0.19.8
 	github.com/go-openapi/strfmt v0.19.5
 	github.com/go-openapi/swag v0.19.9
diff --git a/go.sum b/go.sum
index 7663de3..78b1ffe 100644
--- a/go.sum
+++ b/go.sum
@@ -108,8 +108,8 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4
 github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
-github.com/go-chi/chi v4.0.3+incompatible h1:gakN3pDJnzZN5jqFV2TEdF66rTfKeITyR8qu6ekICEY=
-github.com/go-chi/chi v4.0.3+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
+github.com/go-chi/chi/v5 v5.0.7 h1:rDTPXLDHGATaeHvVlLcR4Qe0zftYethFucbjVQ1PxU8=
+github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
diff --git a/pkg/debug/server.go b/pkg/debug/server.go
index bef6cff..16e4edb 100644
--- a/pkg/debug/server.go
+++ b/pkg/debug/server.go
@@ -8,8 +8,8 @@ import (
 	"os"
 	"path"
 
-	"github.com/go-chi/chi"
-	"github.com/go-chi/chi/middleware"
+	"github.com/go-chi/chi/v5"
+	"github.com/go-chi/chi/v5/middleware"
 	log "github.com/sirupsen/logrus"
 	"sigs.k8s.io/yaml"
 
diff --git a/pkg/shell-operator/debug_server.go b/pkg/shell-operator/debug_server.go
index bc614ce..70e4a82 100644
--- a/pkg/shell-operator/debug_server.go
+++ b/pkg/shell-operator/debug_server.go
@@ -5,7 +5,7 @@ import (
 	"net/http"
 	"time"
 
-	"github.com/go-chi/chi"
+	"github.com/go-chi/chi/v5"
 
 	"github.com/flant/shell-operator/pkg/app"
 	"github.com/flant/shell-operator/pkg/config"
diff --git a/pkg/utils/structured-logger/structured-logger.go b/pkg/utils/structured-logger/structured-logger.go
index e33b5a1..d6e0460 100644
--- a/pkg/utils/structured-logger/structured-logger.go
+++ b/pkg/utils/structured-logger/structured-logger.go
@@ -5,7 +5,7 @@ import (
 	"net/http"
 	"time"
 
-	"github.com/go-chi/chi/middleware"
+	"github.com/go-chi/chi/v5/middleware"
 	"github.com/sirupsen/logrus"
 )
 
@@ -42,7 +42,7 @@ type StructuredLoggerEntry struct {
 	Logger logrus.FieldLogger
 }
 
-func (l *StructuredLoggerEntry) Write(status, bytes int, elapsed time.Duration) {
+func (l *StructuredLoggerEntry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{}) {
 	l.Logger = l.Logger.WithFields(logrus.Fields{
 		"resp_status":       status,
 		"resp_bytes_length": bytes,
diff --git a/pkg/webhook/conversion/handler.go b/pkg/webhook/conversion/handler.go
index e7d2d2a..8d9d872 100644
--- a/pkg/webhook/conversion/handler.go
+++ b/pkg/webhook/conversion/handler.go
@@ -7,8 +7,8 @@ import (
 	"net/http"
 	"strings"
 
-	"github.com/go-chi/chi"
-	"github.com/go-chi/chi/middleware"
+	"github.com/go-chi/chi/v5"
+	"github.com/go-chi/chi/v5/middleware"
 	log "github.com/sirupsen/logrus"
 
 	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
diff --git a/pkg/webhook/server/server.go b/pkg/webhook/server/server.go
index 60ae883..58d801d 100644
--- a/pkg/webhook/server/server.go
+++ b/pkg/webhook/server/server.go
@@ -10,7 +10,7 @@ import (
 	"os"
 	"time"
 
-	"github.com/go-chi/chi"
+	"github.com/go-chi/chi/v5"
 	log "github.com/sirupsen/logrus"
 )
 
diff --git a/pkg/webhook/validating/handler.go b/pkg/webhook/validating/handler.go
index 7826d05..4fc38bb 100644
--- a/pkg/webhook/validating/handler.go
+++ b/pkg/webhook/validating/handler.go
@@ -7,8 +7,8 @@ import (
 	"net/http"
 	"strings"
 
-	"github.com/go-chi/chi"
-	"github.com/go-chi/chi/middleware"
+	"github.com/go-chi/chi/v5"
+	"github.com/go-chi/chi/v5/middleware"
 	log "github.com/sirupsen/logrus"
 
 	v1 "k8s.io/api/admission/v1"


Test patch:
diff --git a/pkg/webhook/server/server_test.go b/pkg/webhook/server/server_test.go
index a71763d..dc996d2 100644
--- a/pkg/webhook/server/server_test.go
+++ b/pkg/webhook/server/server_test.go
@@ -5,7 +5,7 @@ import (
 	"io/ioutil"
 	"testing"
 
-	"github.com/go-chi/chi"
+	"github.com/go-chi/chi/v5"
 )
 
 func Test_ServerStart(t *testing.T) {