From b40e237e20f28037383ce8203a95f70a96bd02fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 Mar 2023 11:01:12 +0200 Subject: [PATCH 01/63] Bump github.com/tdewolff/minify/v2 from 2.12.4 to 2.12.5 (#2104) Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.12.4 to 2.12.5. - [Release notes](https://github.com/tdewolff/minify/releases) - [Commits](https://github.com/tdewolff/minify/compare/v2.12.4...v2.12.5) --- updated-dependencies: - dependency-name: github.com/tdewolff/minify/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 6 +++--- go.sum | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 6a0eed97d..398a0f956 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 github.com/schollz/closestmatch v2.1.0+incompatible github.com/shirou/gopsutil/v3 v3.23.2 - github.com/tdewolff/minify/v2 v2.12.4 + github.com/tdewolff/minify/v2 v2.12.5 github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 @@ -60,7 +60,7 @@ require ( github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de // indirect github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/dustin/go-humanize v1.0.0 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/gobwas/httphead v0.1.0 // indirect github.com/gobwas/pool v0.2.1 // indirect @@ -90,7 +90,7 @@ require ( github.com/sergi/go-diff v1.0.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/stretchr/testify v1.8.2 // indirect - github.com/tdewolff/parse/v2 v2.6.4 // indirect + github.com/tdewolff/parse/v2 v2.6.5 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect diff --git a/go.sum b/go.sum index ee103cb9f..7a00d88b4 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,9 @@ github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUn github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/djherbis/atime v1.1.0/go.mod h1:28OF6Y8s3NQWwacXc5eZTsEsiMzp7LF8MbXE+XJPdBE= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= @@ -53,8 +54,8 @@ github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0Hw= github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= -github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= @@ -208,10 +209,10 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8= -github.com/tdewolff/minify/v2 v2.12.4 h1:kejsHQMM17n6/gwdw53qsi6lg0TGddZADVyQOz1KMdE= -github.com/tdewolff/minify/v2 v2.12.4/go.mod h1:h+SRvSIX3kwgwTFOpSckvSxgax3uy8kZTSF1Ojrr3bk= -github.com/tdewolff/parse/v2 v2.6.4 h1:KCkDvNUMof10e3QExio9OPZJT8SbdKojLBumw8YZycQ= -github.com/tdewolff/parse/v2 v2.6.4/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs= +github.com/tdewolff/minify/v2 v2.12.5 h1:s2KDBt/D/3ayE3gcqQF8VIgTmYgkx+btuLvVAeePzZM= +github.com/tdewolff/minify/v2 v2.12.5/go.mod h1:i8QXtVyL7Ddwc4I5gqzvgBqKlTMgMNTbiXaPO4Iqg+A= +github.com/tdewolff/parse/v2 v2.6.5 h1:lYvWBk55GkqKl0JJenGpmrgu/cPHQQ6/Mm1hBGswoGQ= +github.com/tdewolff/parse/v2 v2.6.5/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs= github.com/tdewolff/test v1.0.7 h1:8Vs0142DmPFW/bQeHRP3MV19m1gvndjUb1sn8yy74LM= github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= @@ -282,8 +283,8 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= From bbe3da7733db9baae1a72af22513662ac0a6c5da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 Mar 2023 11:01:23 +0200 Subject: [PATCH 02/63] Bump google.golang.org/protobuf from 1.29.1 to 1.30.0 (#2105) Bumps [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) from 1.29.1 to 1.30.0. - [Release notes](https://github.com/protocolbuffers/protobuf-go/releases) - [Changelog](https://github.com/protocolbuffers/protobuf-go/blob/master/release.bash) - [Commits](https://github.com/protocolbuffers/protobuf-go/compare/v1.29.1...v1.30.0) --- updated-dependencies: - dependency-name: google.golang.org/protobuf dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 398a0f956..52f37215f 100644 --- a/go.mod +++ b/go.mod @@ -45,7 +45,7 @@ require ( golang.org/x/sys v0.6.0 golang.org/x/text v0.8.0 golang.org/x/time v0.3.0 - google.golang.org/protobuf v1.29.1 + google.golang.org/protobuf v1.30.0 gopkg.in/ini.v1 v1.67.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 7a00d88b4..65085b6b4 100644 --- a/go.sum +++ b/go.sum @@ -309,8 +309,8 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1N golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 65bb98f05555d658355979d58a4a2f6be1078e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C6=B0=E1=BB=9Bc=20Trung?= <93299415+trungdlp-wolffun@users.noreply.github.com> Date: Fri, 17 Mar 2023 16:03:18 +0700 Subject: [PATCH 03/63] Upgrade Redis client to v9 (#2102) Signed-off-by: Gerasimos (Makis) Maropoulos Co-authored-by: Gerasimos (Makis) Maropoulos --- go.mod | 5 +++-- go.sum | 13 +++++++++---- middleware/jwt/blocklist/redis/blocklist.go | 4 ++-- sessions/sessiondb/redis/driver_goredis.go | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 52f37215f..9b11fb85d 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,6 @@ require ( github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 github.com/fatih/structs v1.1.0 github.com/flosch/pongo2/v4 v4.0.2 - github.com/go-redis/redis/v8 v8.11.5 github.com/golang/snappy v0.0.4 github.com/google/uuid v1.3.0 github.com/gorilla/securecookie v1.1.1 @@ -33,6 +32,7 @@ require ( github.com/mailgun/raymond/v2 v2.0.48 github.com/mailru/easyjson v0.7.7 github.com/microcosm-cc/bluemonday v1.0.23 + github.com/redis/go-redis/v9 v9.0.2 github.com/russross/blackfriday/v2 v2.1.0 github.com/schollz/closestmatch v2.1.0+incompatible github.com/shirou/gopsutil/v3 v3.23.2 @@ -55,7 +55,7 @@ require ( github.com/ajg/form v1.5.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de // indirect github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect @@ -83,6 +83,7 @@ require ( github.com/nats-io/nats.go v1.23.0 // indirect github.com/nats-io/nkeys v0.3.0 // indirect github.com/nats-io/nuid v1.0.1 // indirect + github.com/nxadm/tail v1.4.8 // indirect github.com/pkg/errors v0.8.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect diff --git a/go.sum b/go.sum index 65085b6b4..1e7e201d1 100644 --- a/go.sum +++ b/go.sum @@ -22,10 +22,12 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= +github.com/bsm/ginkgo/v2 v2.5.0 h1:aOAnND1T40wEdAtkGSkvSICWeQ8L3UASX7YVCqQx+eQ= +github.com/bsm/gomega v1.20.0 h1:JhAwLmtRzXFTx2AkALSLa8ijZafntmhSoU63Ok18Uq8= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= @@ -58,8 +60,6 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4 github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= -github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= @@ -161,6 +161,7 @@ github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/gomega v1.27.1 h1:rfztXRbg6nv/5f+Raen9RcGoSecHIFgBBLQK3Wdj754= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -172,6 +173,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/redis/go-redis/v9 v9.0.2 h1:BA426Zqe/7r56kCcvxYLWe1mkaz71LKF77GwgFzSxfE= +github.com/redis/go-redis/v9 v9.0.2/go.mod h1:/xDTe9EF1LM61hek62Poq2nzQSGj0xSrEtEHbBQevps= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -276,6 +279,7 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -318,6 +322,7 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/middleware/jwt/blocklist/redis/blocklist.go b/middleware/jwt/blocklist/redis/blocklist.go index af3893732..c86e903c2 100644 --- a/middleware/jwt/blocklist/redis/blocklist.go +++ b/middleware/jwt/blocklist/redis/blocklist.go @@ -8,7 +8,7 @@ import ( "github.com/kataras/iris/v12/core/host" "github.com/kataras/iris/v12/middleware/jwt" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" ) var defaultContext = context.Background() @@ -138,7 +138,7 @@ func (b *Blocklist) ValidateToken(token []byte, c jwt.Claims, err error) error { // InvalidateToken invalidates a verified JWT token. func (b *Blocklist) InvalidateToken(token []byte, c jwt.Claims) error { key := b.GetKey(token, c) - return b.client.SetEX(defaultContext, key, token, c.Timeleft()).Err() + return b.client.SetEx(defaultContext, key, token, c.Timeleft()).Err() } // Del removes a token from the storage. diff --git a/sessions/sessiondb/redis/driver_goredis.go b/sessions/sessiondb/redis/driver_goredis.go index 50e994d06..43f8502d3 100644 --- a/sessions/sessiondb/redis/driver_goredis.go +++ b/sessions/sessiondb/redis/driver_goredis.go @@ -6,7 +6,7 @@ import ( "strconv" "time" - "github.com/go-redis/redis/v8" + "github.com/redis/go-redis/v9" ) type ( @@ -17,7 +17,7 @@ type ( ) // GoRedisClient is the interface which both -// go-redis' Client and Cluster Client implements. +// go-redis's Client and Cluster Client implements. type GoRedisClient interface { redis.Cmdable // Commands. io.Closer // CloseConnection. From bd1a1486f49e5cfc5e607d02c9be0761d2481bea Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Fri, 17 Mar 2023 11:06:00 +0200 Subject: [PATCH 04/63] minor --- go.sum | 1 + 1 file changed, 1 insertion(+) diff --git a/go.sum b/go.sum index 1e7e201d1..aea4d4a7c 100644 --- a/go.sum +++ b/go.sum @@ -56,6 +56,7 @@ github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0Hw= github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= From ec2d9d016e473856adb485b90840bcf58bf72cc1 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Fri, 17 Mar 2023 12:38:07 +0200 Subject: [PATCH 05/63] update view benchmarks and remove ace template parser --- HISTORY.md | 10 +- README.md | 2 +- README_PT_BR.md | 2 +- README_ZH_HANT.md | 2 +- _benchmarks/view/README.md | 36 +- _benchmarks/view/ace/views/layouts/main.ace | 2 +- _benchmarks/view/amber/main.go | 29 -- _benchmarks/view/amber/views/index.amber | 5 - .../view/amber/views/layouts/main.amber | 8 - .../view/amber/views/partials/footer.amber | 2 - _benchmarks/view/chart.png | Bin 10183 -> 15917 bytes _benchmarks/view/tests.yml | 2 - _examples/README.md | 4 - _examples/README_ZH_HANT.md | 4 - .../templates/layouts/layout.html | 2 +- _examples/view/layout/amber/main.go | 28 -- _examples/view/layout/amber/views/index.amber | 5 - .../layout/amber/views/layouts/main.amber | 8 - .../layout/amber/views/partials/footer.amber | 2 - _examples/view/parse-template/amber/main.go | 32 -- _examples/view/template_ace_0/views/index.ace | 2 + _examples/view/template_amber_0/main.go | 23 -- .../view/template_amber_0/views/index.amber | 11 - .../template_amber_0/views/layouts/main.amber | 15 - .../view/template_amber_1_embedded/bindata.go | 358 ------------------ .../view/template_amber_1_embedded/main.go | 31 -- .../views/layouts/application.jet | 2 +- aliases.go | 5 +- go.mod | 1 - go.sum | 2 - view/README.md | 7 +- view/ace.go | 7 + view/amber.go | 281 -------------- 33 files changed, 45 insertions(+), 885 deletions(-) delete mode 100644 _benchmarks/view/amber/main.go delete mode 100644 _benchmarks/view/amber/views/index.amber delete mode 100644 _benchmarks/view/amber/views/layouts/main.amber delete mode 100644 _benchmarks/view/amber/views/partials/footer.amber delete mode 100644 _examples/view/layout/amber/main.go delete mode 100644 _examples/view/layout/amber/views/index.amber delete mode 100644 _examples/view/layout/amber/views/layouts/main.amber delete mode 100644 _examples/view/layout/amber/views/partials/footer.amber delete mode 100644 _examples/view/parse-template/amber/main.go delete mode 100644 _examples/view/template_amber_0/main.go delete mode 100644 _examples/view/template_amber_0/views/index.amber delete mode 100644 _examples/view/template_amber_0/views/layouts/main.amber delete mode 100644 _examples/view/template_amber_1_embedded/bindata.go delete mode 100644 _examples/view/template_amber_1_embedded/main.go delete mode 100644 view/amber.go diff --git a/HISTORY.md b/HISTORY.md index f22a8e9ce..11405bbd3 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -19,6 +19,12 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene **How to upgrade**: Open your command-line and execute this command: `go get github.com/kataras/iris/v12@latest` and `go mod tidy -compat=1.20`. +# Next + +Change applies to `master` branch. + +- Remove [ace](https://github.com/eknkc/amber) template parser support, as it was discontinued by its author more than five years ago. + # Sa, 11 March 2023 | v12.2.0 This release introduces new features and some breaking changes. @@ -41,7 +47,7 @@ All new features have been tested in production and seem to work fine. Fixed all - Add `Context.Render` method for compatibility. - Support of embedded [locale files](https://github.com/kataras/iris/blob/master/_examples/i18n/template-embedded/main.go) using standard `embed.FS` with the new `LoadFS` function. -- Support of direct embedded view engines (`HTML, Blocks, Django, Handlebars, Pug, Amber, Jet` and `Ace`) with `embed.FS` or `fs.FS` (in addition to `string` and `http.FileSystem` types). +- Support of direct embedded view engines (`HTML, Blocks, Django, Handlebars, Pug, Jet` and `Ace`) with `embed.FS` or `fs.FS` (in addition to `string` and `http.FileSystem` types). - Add support for `embed.FS` and `fs.FS` on `app.HandleDir`. - Add `iris.Patches()` package-level function to customize Iris Request Context REST (and more to come) behavior. @@ -306,7 +312,7 @@ func main() { - Fix Response Recorder `Clone` concurrent access afterwards. - Add a `ParseTemplate` method on view engines to manually parse and add a template from a text as [requested](https://github.com/kataras/iris/issues/1617). [Examples](https://github.com/kataras/iris/tree/master/_examples/view/parse-template). -- Full `http.FileSystem` interface support for all **view** engines as [requested](https://github.com/kataras/iris/issues/1575). The first argument of the functions(`HTML`, `Blocks`, `Pug`, `Amber`, `Ace`, `Jet`, `Django`, `Handlebars`) can now be either a directory of `string` type (like before) or a value which completes the `http.FileSystem` interface. The `.Binary` method of all view engines was removed: pass the go-bindata's latest version `AssetFile()` exported function as the first argument instead of string. +- Full `http.FileSystem` interface support for all **view** engines as [requested](https://github.com/kataras/iris/issues/1575). The first argument of the functions(`HTML`, `Blocks`, `Pug`, `Ace`, `Jet`, `Django`, `Handlebars`) can now be either a directory of `string` type (like before) or a value which completes the `http.FileSystem` interface. The `.Binary` method of all view engines was removed: pass the go-bindata's latest version `AssetFile()` exported function as the first argument instead of string. - Add `Route.ExcludeSitemap() *Route` to exclude a route from sitemap as requested in [chat](https://chat.iris-go.com), also offline routes are excluded automatically now. diff --git a/README.md b/README.md index 4c4c96f44..dde82ada1 100644 --- a/README.md +++ b/README.md @@ -187,7 +187,7 @@ Some of the features Iris offers: * Builtin support for ngrok to put your app on the internet, the fastest way * Unique Router with dynamic path as parameter with standard types like :uuid, :string, :int... and the ability to create your own * Compression -* View Engines (HTML, Django, Amber, Handlebars, Pug/Jade and more) +* View Engines (HTML, Django, Handlebars, Pug/Jade and more) * Create your own File Server and host your own WebDAV server * Cache * Localization (i18n, sitemap) diff --git a/README_PT_BR.md b/README_PT_BR.md index de1d3b405..df94d769d 100644 --- a/README_PT_BR.md +++ b/README_PT_BR.md @@ -184,7 +184,7 @@ Alguns dos recursos que o Iris Web Framework oferece: * Suporte integrado para ngrok para colocar seu aplicativo na internet da maneira mais rápida * Router único com caminho dinâmico como parametro com tipos padrões como :uuid, :string, :int... e a habilidade de criar o seu próprio router * Compressão -* View Engines (HTML, Django, Amber, Handlebars, Pug/Jade e mais) +* View Engines (HTML, Django, Handlebars, Pug/Jade e mais) * Cria seu próprio Servidor de Arquivo e hospeda seu próprio servidor WebDAV * Cache * Localização (i18n, sitemap) diff --git a/README_ZH_HANT.md b/README_ZH_HANT.md index 8fcbe8b6b..c1e5eea70 100644 --- a/README_ZH_HANT.md +++ b/README_ZH_HANT.md @@ -195,7 +195,7 @@ Iris 提供了至少這些功能: - 內建 ngrok 支援,讓您可以把 app 以最快速的方式推上網際網路 - 包含動態路徑、具唯一性的路由,支援如 :uuid、:string、:int 等等的標準類型,並且可以自己建立 - 壓縮功能 -- 檢視 (View) 算繪引擎 (HTML、Django、Amber、Handlebars、Pug/Jade 等等) +- 檢視 (View) 算繪引擎 (HTML、Django、Handlebars、Pug/Jade 等等) - 建立自己的檔案伺服器,並寄存您自己的 WebDAV 伺服器 - 快取 - 本地化 (i18n、sitemap) diff --git a/_benchmarks/view/README.md b/_benchmarks/view/README.md index 90fc7cdb6..209e4c6a2 100644 --- a/_benchmarks/view/README.md +++ b/_benchmarks/view/README.md @@ -1,26 +1,27 @@ # View Engine Benchmarks -Benchmark between all 8 supported template parsers. +Benchmark between all 7 supported template parsers. -Amber, Ace and Pug parsers minifies the template before render. So, to have a fair benchmark, we must make sure that the byte amount of the total response body is exactly the same across all. Therefore, all other template files are minified too. +Ace and Pug parsers minifies the template before render. So, to have a fair benchmark, we must make sure that the byte amount of the total response body is exactly the same across all. Therefore, all other template files are minified too. ![Benchmarks Chart Graph](chart.png) -> Last updated: Oct 1, 2020 at 12:46pm (UTC) +> Last updated: Mar 17, 2023 at 10:31am (UTC) ## System | | | |----|:---| -| Processor | Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz | -| RAM | 15.85 GB | -| OS | Microsoft Windows 10 Pro | +| Processor | 12th Gen Intel(R) Core(TM) i7-12700H | +| RAM | 15.68 GB | +| OS | Microsoft Windows 11 Pro | | [Bombardier](https://github.com/codesenberg/bombardier) | v1.2.4 | -| [Go](https://golang.org) | go1.15.2 | +| [Go](https://golang.org) | go1.20.2 | +| [Node.js](https://nodejs.org/) | v19.5.0 | ## Terminology -**Name** is the name of the template engine used under a particular test. +**Name** is the name of the framework(or router) used under a particular test. **Reqs/sec** is the avg number of total requests could be processed per second (the higher the better). @@ -38,19 +39,18 @@ Amber, Ace and Pug parsers minifies the template before render. So, to have a fa | Name | Language | Reqs/sec | Latency | Throughput | Time To Complete | |------|:---------|:---------|:--------|:-----------|:-----------------| -| [Amber](./amber) | Go |125698 |0.99ms |44.67MB |7.96s | -| [Blocks](./blocks) | Go |123974 |1.01ms |43.99MB |8.07s | -| [Django](./django) | Go |118831 |1.05ms |42.17MB |8.41s | -| [Handlebars](./handlebars) | Go |101214 |1.23ms |35.91MB |9.88s | -| [Pug](./pug) | Go |89002 |1.40ms |31.81MB |11.24s | -| [Ace](./ace) | Go |64782 |1.93ms |22.98MB |15.44s | -| [HTML](./html) | Go |53918 |2.32ms |19.13MB |18.55s | -| [Jet](./jet) | Go |4829 |25.88ms |1.71MB |207.07s | +| [Jet](./jet) | Go |248957 |500.81us |88.26MB |4.02s | +| [Blocks](./blocks) | Go |238854 |521.76us |84.74MB |4.19s | +| [Pug](./pug) | Go |238153 |523.74us |85.07MB |4.20s | +| [Django](./django) | Go |224448 |555.40us |79.61MB |4.46s | +| [Handlebars](./handlebars) | Go |197267 |631.99us |69.96MB |5.07s | +| [Ace](./ace) | Go |157415 |792.53us |55.83MB |6.35s | +| [HTML](./html) | Go |120811 |1.03ms |42.82MB |8.29s | ## How to Run ```sh -$ go install github.com/kataras/server-benchmarks@latest -$ go install github.com/codesenberg/bombardier@latest +$ go install github.com/kataras/server-benchmarks@master +$ go install github.com/codesenberg/bombardier@master $ server-benchmarks --wait-run=3s -o ./results ``` diff --git a/_benchmarks/view/ace/views/layouts/main.ace b/_benchmarks/view/ace/views/layouts/main.ace index b1e74baaf..9453acade 100644 --- a/_benchmarks/view/ace/views/layouts/main.ace +++ b/_benchmarks/view/ace/views/layouts/main.ace @@ -3,6 +3,6 @@ html head title {{.Title}} body - {{ yield . . }} + {{ yield . }} footer = include partials/footer.ace . diff --git a/_benchmarks/view/amber/main.go b/_benchmarks/view/amber/main.go deleted file mode 100644 index 4b63f6842..000000000 --- a/_benchmarks/view/amber/main.go +++ /dev/null @@ -1,29 +0,0 @@ -package main - -import "github.com/kataras/iris/v12" - -func main() { - app := iris.New() - // By default Amber engine minifies the template before render. - app.RegisterView(iris.Amber("./views", ".amber")) - - app.Get("/", index) - - app.Listen(":8080") -} - -func index(ctx iris.Context) { - data := iris.Map{ - "Title": "Page Title", - "FooterText": "Footer contents", - "Message": "Main contents", - } - - // On Amber this is ignored: ctx.ViewLayout("layouts/main") - // Layouts are only rendered from inside the index page itself - // using the "extends" keyword. - if err := ctx.View("index", data); err != nil { - ctx.HTML("

%s

", err.Error()) - return - } -} diff --git a/_benchmarks/view/amber/views/index.amber b/_benchmarks/view/amber/views/index.amber deleted file mode 100644 index e92604dcb..000000000 --- a/_benchmarks/view/amber/views/index.amber +++ /dev/null @@ -1,5 +0,0 @@ -extends layouts/main.amber - -block content - h1 Index Body - h3 Message: #{Message} \ No newline at end of file diff --git a/_benchmarks/view/amber/views/layouts/main.amber b/_benchmarks/view/amber/views/layouts/main.amber deleted file mode 100644 index b0b751a86..000000000 --- a/_benchmarks/view/amber/views/layouts/main.amber +++ /dev/null @@ -1,8 +0,0 @@ -doctype html -html - head - title #{Title} - body - block content - footer - #{render("partials/footer.amber", $)} \ No newline at end of file diff --git a/_benchmarks/view/amber/views/partials/footer.amber b/_benchmarks/view/amber/views/partials/footer.amber deleted file mode 100644 index a202d2c01..000000000 --- a/_benchmarks/view/amber/views/partials/footer.amber +++ /dev/null @@ -1,2 +0,0 @@ -h3 Footer Partial -h4 #{FooterText} \ No newline at end of file diff --git a/_benchmarks/view/chart.png b/_benchmarks/view/chart.png index 0403fea8dadb1e7190ab5678c1bcfc4d1429f653..6ad909c6025bc04b2c969fdbfcb9f7d63826dc7a 100644 GIT binary patch literal 15917 zcmeHuX;f2Z*S0)7g;oW$$RrUQswkrfG7q&VqA1`%2xAy3h(aJhm_h(c%P3F>jL7JK zC}Sc>n1e##ksv6@pb!Fy0U1LWLkRHRhqiXIbba4i-}}AqTI~@-1JBAuVZ z8BMWQ->lXJJbjrHr=^sjS?F15*ZXjyS(eU)%|)gZ_}8`akAl$yUFKcZaM0)6!ykKnzijAcy0&>j!$h zdwN;Q=|b02Qh#VZBB=~Ti?_iX!{{1Btc0P-nc+Oo>gJY$*Ozt>;Kfdk1zuGrybk(V zHAQ<5KL3HzRvx~r=Y%;PIN4{*@54KVeo@@~F2evRAHnCSQ0?Ad5tcL4aBndqFVWcT zlmsbG@1>5BTA$uBl|*^tT5d$3{wP9Jrg8_N`NGo{%kb$NnjzEgOM^L#Qryyfz|7ET z{;f<*=;X^5-rX*N%d0EPBNQnl?B)`iOzt5Juwq1aJomw$Z;DQQ%2nv_h*Y%Gddw44KdTXX(0^Ke_zk+S@*iHA_516`8KBvik)e>HSIKz*Kr@Fo3 z@n_mNy`j&cXQ7T43c~fpjJVFB+`$+Q!|M&v#jTKQ=uFFl5nQ7ZYq^YsS>x3iW6B)$ zmP&p8WwgQqZa+pjW^;`wqP(CnGym}Au7Ej>==!x^i)o3R>&LQlKHDU@jg+P7d6u`> z7LjSh`*8mVDP-oQw!Lg>kCjE5R$-5cWK1{%hWDKscsBd~hNYyj!u)wYLyBxBrRpF( z>+i~3dSxP((~)Z_r8LJ4>I;8yeeX!Um@zD%*Fv_;f4DUVxytLN_za-Ap1j$Sk;UOG z`B{5zTljnl1FIga^B}FM-y$~=u0ZP>wk>g&FxEiXTcgb6vE#(93wTvW#Y%bH>}$p_ zr42XugH${?N3MT%K$ zN!6e@ZzshKA6(f{OybJaiyW_4$!{}S@1N7ZiF24^jT+5pJ}|oXqBRDa#hm7*7T3(b%VyI{J|<{`j`X>=YlD7mZ@U&Jy~s3scJGk zlsRqI_i&qWF)aOF?s+Fk*~YwSt7GGHiohC$j#Xtn*s>sYf7gXwT6$=EzDjk+-2^8& ztbViUq=_POEZS_eqh$%M zKJMc+@gk_ly~F!%3c@$T%X3u&D%lf41x}&8DlrqY(;8F(rTL@QNK5sjO{`AsdpAk6 zazIChAw_$;Mlul=ImAio(i$UpEeKqwK2Wo+j}N%X&rZgBNH)3B8PgE>8-b z>gMB7o(R`|M;k6D6Nw4+-|d>8ZLm5k>S$B!q>_1GM>CeZ+|*4}*oBfOZQ3XZH;9&Y zaIKo1uwU_L%XBno99>Q{*=}SGsg}eAHH+OhUtr!B`?m0dYo8pjr zGb@sYLMV0~cBTwID=#v5TSJRhDN68v>Ke60L5JN#yx%i$OBU(i5@g3&nC|Hvaldap z$}(zNJclMT!eey4mx(&D=zc}#&6o6#J?pvOGs%!l^BTR-qxNQ5Yd~#G3>w>!7xc2iC<0i8Xc;Pi0pM74-DV zblbE=jQ?>VB#$PalzLBX<&;rrf-41PtS~uaHSA2$FLD(V%aoVMGNYk>p#8cpt&0~H zGlKdLsH$mOq-p!09HnAZnD6=0TR6j%ZnP*oz2ux+zp}6@|MSf$0{Qsihpph>{y>my zYxpfF;eue52HhYI?^4jk!zgU7AUy2-F$bjK)*AepD{EF@8YOzOxVm>FA0+X5g80LH zte@)z>6q-is58J?0s4ZHE9u;e-<2DP#-+UT?r9EsL-E*<;%aiPcGG`=g=PV`g z%&dzeEFwvx&on=;dkGe^kNMS7xvG{$IUWR1d68c557R!A)@^N}tQ4DgYMz34liStg z&R8nCZge(`vg{ocTRa*F(m`h0piqIuLJcjl)7+ zJ08{M7t^9AmKW$gIJlM9_q#bdOf0jEGtbWRyANYOPY}~D$h7I4aP!ISyGS`MbiPeH zZ=WdpdndO4e(k&o3)ISZNn5;Fu!^z8?#%jWjhn7*a0g_(Kgm_hY(T=Mv^0v*x;RPRKjwQ4@G zplMoyigS>Q$tvkX`|9Z6^w>~xgr0kluF!3iP z?+pl@G*MfN)L8-ZGr9f*FM`hZQsg;&R&c)$k@SG43h=XrwH%?KFt`ahex|<0eECc4 zEMwI+>}+*vYO0zgj(Cb|3bX|`d;()A2vzZ(VNO!!Lh5cWQ8U zD9xv=Hp$S8sGVQx$7(LUK)uz~ox^NO&IK!aT5IG#bn1={diSq){Q$wEaa~13(RP9-49VjvnTc9ym;l zJ)u}ZCdziae{rK@Zmheb$g!&Z`45}yNeNU}>B@kSFIkm=jH#hA?_O9F z8rC#o;;Qd}KcnxQp&wMFV-Pe@Cs2LqN9j7(En}sm1JS!1G0Ozjt3=HqPFsg#a@fAK z@(8r?%a#^DEk)r1ox2A86;kYd1@SjpgC_fQKRofPgQ_xz-9FNhn{b0A$gB*PF8LZ; zt|-3H(bA&qaUWGziDsJGRR^Qr5nKeFtZyH_41ZT0;*X9!Xc3qkv`CT5k*;-3?gsWq z5K!sImAg{n8CdD=IYH4w&FUH&)VGgh3G)-ZLDXS~V+>!%SY|%DN7ceFOFsyu7dVa> z!!qe;+r?CCDK)1DPTK9hv1gJ}Q*B#;XD(z6Zn+NwXUFuAx=UMNt~cG>-EV1#Aw<42 zx#|b@fZvcn{*hmx*Mx9@smq_kMK{gw zhrX%*-mzJ|q&gV5&cQ_~<}>WtH_!ub+d8c+f$-}RAUi9oK}NOd`DoPJ1an>YTT+n2 zmAqI4=VU+V8)$JF)V1YG{I6Lq^%0Cv=0neXXqlBM7dG{*^y2G#0rTT;yD-O-U?=>C zT26@XJ7s2mOZfyi+kWW9>=F5s9q{WUJPJnJr~lNsho?^H2acQJ)sPl~f`XpljEbu$ zlK-=(WH5qV;4IXU=2QEYr#HWo(qG`q=W;Z?-<5V@JX+IFfV1H^6|)@qC$m#QFu$tA zjKv!scVYL}cs~2?v%)b~vF;wCTgTJO-KPA?@VY;F<-&O}gn~u7*|}Vc)5C39YPJ1O zFWcCa`?`$r#=4881lw}V@!-y%v)sjJ;0LB^yCp!d^)Ki}IW|9Aa`FI<52o*EdTdPG zQAB;TgV36xZv)HJ2j|kUCl=V7u2V82V?2RR7){ri@&$|2S`)18()r?sLV}^)8e^c) zumDosC)WB#1fh-UGfR+Cvyj#Ds>_cLnxi-s7TS{}O%T=fzLa>0PuR5n$|EucWWs#D|E;xy&AaSHuNld{5E^uT`?Jy23BNnZ;=+XKH1K`5A7{MO?5 z!aomz(ma$}{xR1-yX*fTPF&vkeK6fV!yP6CDDIs^_E}P+px~6s|6_2*c((j&VleL% zxS}2u0*fr83;>t#;BbZ)l{3)!P&M38s4;5N0>_ox1(wEoIy5 zst)C^ct(w&C?FsGDZHUN&2l*}iYW1Dv$)({bUN9HcTvxGpe}n15Y!L|*7)#b%cn6g zNPtq0|Fl@BnukcI2*N!l`zlDA5lS{ir|iqTWCCn;!ui2>w7l)c#xy)yAH<0(v=@yD zhh0F6L?{|Z!) z{oPOf0Y_Bo-K%8>{aiI0129L_LQShP9;zoY0KW7uRDvY>v7Th`zU&>W)I`;N1C=IF zqCS-W451^{&i)Q?{DSk}RK<5qKD!x-{)PvE=OBKe-BZOv1o0kMZr$H07f?znZgi>Ad0|*& z3?b-BZjb{!+`SVt6drdcYW}4|&KNqsb>{B2{$0`e8RaUALFEJa;M4o-ijlKph2LHk z`!eMTI+@Jn@fT-2U*9{1!zwu57)&_-TYUJ-W*{285-#BS9~Lv5wc>G^$qB{G`x_Yz z(>iJ|OeJg0euw>j0i9GqTph1byB1B2qjBcCYv-RH!OO_6bMbZ!_fvqgp=VP8n7T1p zv(W!HH-s*-@ExSuxx(2Vx8xj;ESweyxngc8tr8P_ZcqJRg+sO&VwX|E=tyoBO2qbf zvK%F?=kvde9dI!+jB_k>;%Rp~;PgAn(ad;iS1~dRG+s85G`0T9LBhO9i7cmZI&L9n zI4i=4hUs>sT;M3U$psGxl;;rFvom(GB6n`92rF_9Eb(D+_*{Nx+S_$kNMD`|vX?(( zCyHR#E}?iU3uI(XYT}0V);4UP!rpyV;4+6n8JVnNui>M#?K11QXCs7e&GD+Ip{AFm z;oNz>;HjPc4W=8`xhFnoE9zb8V{Q9)Syt>4gAvTlG zT-+o0=|_oDZ<%Pf-)=G{=U5&9O``B2=LVsIJStvID(iz0s!yl7Io9{cCsP=rQTdfz zQFFs`ivX@}I;;8hl}(>4ZcuS~@$r&JpQ?ZV?U!s^Ij6hbSK!m{1y1C;($@s2ngjp( zWR--#yx-UIgvrXWA{Vzkf>KtWs$EcCz99%w%&^@uf7sX(obx>Qu2>90846HW2|fR* z`|Oj693n#AM;bX(UQB>=$$e2C%(-X$@UGZ;%LOTLbxLgYN2f3jiMQZG5M$0 zqBgB-?$F_kpmq{@c_M&av+z)UmD@y#AkSp5A1w4^#e6P(TORpIr~zPmIt&yW--&lm zU9;bTmf5=+Y!FBL3-9-X>sySGY}h1xweiFRvoTRg)t($)V~Ju5I(+@f;sh{&h3E&t zE{KW5EzoSj$}cWn+nf(CJSk={wW05cQLbf{#aLIN`OMHub73(#Sio-y%=o21pb)5a z1Ps?YZU%N+=<~Pakc3TiopHR8+>w0b@})WVr*{mofp%4a-l4Ovk9S-V6t=_Dt3xzS zrykln(L>zh2pCO~&6^(pf^&fdP~G~D#4S|OPcJR7)m9vToBd@deHH$~B8aABdCQK6 zr!V7nWW6|yW;E0~bc_9s<#p(aMl++tCOIXc0)RqttJt;r-aP~XA3J@}!S&g#3J~8M zhVR$_K(3_1VDc=$N$YQgjcB>{_8jw$t1=qx=PV5|)Q~gEI?lksN-7TJggH!gnz~RX zs4R(G%tSh%fxUan5+#A-0NyJC;qVdf{mdWOfEWszj!Y1#v zW>wq}C)dwa4c-ZWSVwaB?ENEn^?}GvPXN!1_TU_i*9|;b0)s6Q&c@QsXNKFgMO9`GCe>J`-ybLSv7V?DQPIpbJL$OEF{(OjR+ z2v+x=&p^O{t~q0R+W#>_%yMC@@>=wIKJl(oG`@bfqg!iw-3=^?;2h7S4s>sowOx19 z2o->K@n+e-yGprZy_|6cI&ZD>)^!klxlRfgfQZa>!f^_sG}lQwYs|_z*#e?DRkJ^Z zsUZxmAPiyd^|CcYeXiq^e_sC|@Bekl{%7;A8~d-y1ula!=LvFPlpiSBjLJR7lOE{$ z4?O@jHa2@uajc3(Slu|_1JOe@Z~9n>woSXx^VIx(d~F8P_As3 zmNo;xHP>no zoWQ~^OrG8(seF+(2^L2gtOv}{89>&o2W|fEs1_)F{()BceVNq&{hE(lOi@E%xoRTl zA-s8ft^*KAdXwJqcVp4(SJ;o7%WyWeSzrt_N-1P>2yEThcUp1fWjSbZtdqkpzKN7@ ze|aZG%ctJ~w)^T08q+bHc>F+gvCb|WKx-8J6?mat3M73D6Z@MY3VaQRArtEZ(bty% zR_Xv~#;%(}Wh!zRxy?Qo2SiB($XZA5wCbWNDl;R`v}nUr`RXL*55i?Kb|b-fCeW)U<{l+Q|y;t zFenKfS<7#;bd#7mNgXjz^^zmR>PxrShXX2eP0#iR#x!X1 z!E`V98%OoI&Wp7&Q}wycPi5wcHc%dwoM{x4d<*JFJE$Y}Sy31c<5+bZBojI$M*ugs zTpAL99#G)^n~z@75qzdRXSYVlu8_JXMKvqDu@OM`HYWINl`q;Z|Kv_oaIQy~mTfBN zbLUDS!_;vciquF+n~{=gm7{z(*X1Yu{&<5&MM_(npqPPGwdWoqrg!NhRlx;%L^zt&0o*4W8!S znr_R#GKtdKW+HQ1unV;F6C&v4=si%g$B;V^b>ICM!coXIYIS9aEhQU`5b}$r2EGu4 z;~3~B4_Q;j{b1AkPWb!Wz2nSeV-(IYeAPtE@H{`FIG!!9jYcRJOswp$plj`TJcMwhz@d`qP(~C;0{Bs7$ z#OKP(gJKb8pdF_w=V6eG-cj`JQX%co6g2Z7qv5`7wUM<`YXispsF&GLTNaWZp$bTT zy*L4t`RK;B10r({o1c2oiUO0B2BL{cP2$ES9g&?V!!x1?wVK(p=n(!{|Je_(yA}c} zEkS&!g?9n}rh)i4=g`&G-EQwwlad)Sl)8JZVdq$d`R3w6*#5CVT}8}x!V2JDv9J8M z;hT8s^Wk6%HRg*Vz>LEgAZ>Hy4Md4S0y`j3ujp1BHbijBU2~+d>OerwJ*}?_eB;JR z8@*gy1NVw_OKt_&Ej|TnAf%QD3z*CvP9Ah#Ln2^gX|OnLXB=>s$eO4 zB8c8HZ`oN=2ve#QLE-~dJty)4d&`D>j%>ogi4F>VkepmbH<*eC;>JZ=dnsVWIy3BC%HJf4nHvUni(msm{_lSp#eDYt6X zMzNxHWn3hA;UA-ny=k2`jK6Xtz$EG{tSb2qE_l~*H1DOkeE$iF%K z1}j)x1ioItXwoku5^vL;mRISRbTUJzAXwBDC%x)pl3pc=EoGUT(7e$S759;MTv4@V%~X&j&HV(mxS!~^6Jn`M+dm$Eij(2XksX3 zqGBI(kH*|sK0FvGXF0w%lo6+3M;g0^}~X?#WQx6~%D#MAGA?Z{(Gdb!>Jw z=n4^^#fqPEV{IQczbQM&O&ssEL8>?%9Q9>wCEHRC&Q{TvQLmzRhbtw`SoQ}q6B)i= zr>lv_n7LA9loF*MxZW4c(ykTc2kC4Dzb0 zbnKvdbb*vpu*)l51Sg&HWGmH7*^*^-_d(_623!JCnXziUxcZNwAhJ>6D3*W)IMbw0^iRTWig!i|?&e3%6p&0RMSgwaM;nl3~4b0CSn=6Xyj%kj%9 zKewDMCdV-s<0VYeuga=D>M@j4s@MW1SL8`3Qi8+j#e1saN|fMdO((aCiBL{z%(qfb zYQo>=T4Y>ulp-H)%HG-yi1cl;$N9ITdp@U3Ny@&FKFT1?2BVn1-%TIX>jV80a>Jqq z>(E)8l#7=aBfW4M4Wt>E&vWfNFYMGBPd1$I$!w{V8LCp(4hrHzrv{6mfgB%Fdq&FvCTL!=0XzE%iJwg(Z|hx)C+~ z{UkSW$%3`waNE|$z&TasH0)n-CRFw82K$M8^4p=E7L`ecTZmGuUoQbTq_bsB8*cj& z-0?s3BW}cag=yUG7(}yv4|RMyK)J{FhmNTLG5lKsv~Ju1p#lKsq*iOgmqSCDiQ4Vm z`6`odWsWute8a8zF?mdz~D9b7i!6MRB>8ylfB6yPy|WmX|sf zY8Pr|r|QLWBY3$HimIUBKHP4&(02nU34C%Cvce8QSc}3cuH{`q_m-o;C?bV5QA=-` z{^=p0_yMkAqSnMHa)l}(3i~*EfNCiWWch*#j zJdouqfySqrwe(Us0)n8mZzi|6bOIfBf=LvRen%60B9?l=D+)c3ZV3l-N0P(7FSCrv z(k<>Sw_k4`Xuc||T{N+fX4}8!2hT?WV?g6RB1`9*qK)8yhPnHwBN79U!tPz7pEZU! zKy5QfAAr8Nbr9UO^2=RH(Rn&vTnIWr^PB($NGRk9!+vDEqJvg4ITwH|NiZ}-?k;jn z6NTwmg<0~i>U3XncFz7#&(<#CLo>%q?I3jr1MhUu`7i0)hMgc4%kpB@Y6#%yrd0&b zj!(n~iLT5cS1~+L@@>>LXV9L2%{^W|g*S14lvB`hq`w@)4W-7K*0^I&wmnRy?_ds;;DM!nPBckkXl zSHAcB;RB`7rdvKv`xN9miX#&Q-p_Sj&Adhh#tid0!vA?$~= zd}T?;%{$F)d2Cx}e-(UQMH-wR@}1VGt6J#J+c02Z=^|}dZUIsVv0yM;SoWe}%nv6J z3S9a>E<;a#dm4K3>(k#azrbIa=-4j{J5s+7XJ4liC!#9zxxc*q&EpHA>RxY`-??DJ z)TqlN0w&sjJ~K|u`4h%2i_WvF)qKRZ>>JB9s?UXrM=(&y8on0>?fZvnLyF0a7aV)G z*HLrul`e(wmE;Gw0}%CvJ11;N6e6;Ks2L1d9mk zsw=L^hkYE*_o8>_i{i?}6=1m)wu$oA$cy(lt;XB2!gv-~Ze3dF%xe{YYR?VZ-{D9{ zcHHHuUyqU+u5%ZUxs&q+@%ei7GM-62zNHshlRbL>*uu>wccebYrG9yyY~T5@^-<^C zL}&4f;MGO?M63F+;doo>)O<~1Vxq_1bw#qaI<+%dw1`YB6=D9`BwU@1@CwX?I6x69Va!@PdM?`S;4o${Nz{yOE82 zhNIWjyoYM2mG8nWLO!!joFK8|+}xwbo5eFfg%s8bd7BV5H8qP6SC<$w9R`Y--h`zK zM_{rGFGanbS{xM@(H<^qw$dz(Qt0FLucY5w*ahtmTO5g+C?(sqOgBFc8)>*M3r8A$ zP$Vom1TPE*bmkTik`Y3Y7YujNy|rn1ect_*5#FD)7&>SK3u zHPlcf%*Z3l1Z!-9m^Twa1YfZ#bu+gr_p%*PZBD=a`~bDLSeiSO9x{67rP*IMcNltm04$Uwiukd+nD7?%t((CBJ11NesVVL8#b#{yayB_Q zcAPjn8uu!MR-5D*!e8>_<5hN?WAkn27RUa)1%G6#CTy1)OqRWI*Cz*)lZ6%b!3RUd z@svUT!j08&-QH1U<(*L(4|Y<#Ph6ByFFb~qDf8?vYhddjHwi`PGCr1+l`)o=0;9y* z<->W>JJMs_-1c0opQO3pp5J-T%rK>J{j%}_;;h3#ZXk`Tziv1I#a8m*lS2WL(6%Cq z&o3iP^5Y$NPszn!I%5#>F--c83zf4KGPR7WjEr@5oRwR&-@Cy<+rZGyXGRuc`mN=K zoac%D(*r@r(RrD+6xxZp19k!PeQh~w2$sfuXyVAt9?>()3J0YYb}5Z29doUZ(Yr=8 zPSbvf5DzImJw`K&9gZ6pFqoi4lke0SwDZ0*_q`~^dy(!P!M@HEJ?EopGflSk=@GHZ z2e#YNqicFv-VF_f6KQW*&BH7Feq+NOzN*=$w4I+gv$nE8F7cWn2!!RQxWSRC5dn|K z(dMQG9>SR;8fCE;X@?C_IpR^AdQ|>fpVNo>ElcY-9*?jhQyK*#9qf~QZ|VtKaHEuc znn#uYOp;kRlmJK4i?qeel6%5|@1S04EOG5DdVh8`x!j}oGU;kvU*8lzet9K%mP^eZ z%m2iIc2rD9W~iTUJT5_?PBvVp&8W%_mfInJ^e8nw+i!4=6yU~%T3f3ovEiDTq9otAJ@V(mUsUThW4d!&&A*JH4g)rLxl*E=)jMT{ISo!8Lf^#abgXM~s-e<=xp3xh?Y6VOK->BV0 zOdkvOaw%OE$K2pWEpavb91M=IiNy$F@5VSUEs2atl^s@A6JMFGrUkEggd3Yf8gmC= z%VDT`_u$jd1f*mLNOO$~f4cRTV2jN4$0j;UzgmlL*cD*RThDj?ytY|iq`7OnGXjpJ zD&HQXXAgZ}Spu%VZAiJ-j)oB&KT4FimYW(WIDcQu;#Xaj?%}I-$$cCmQaNF*b*nQ5 zj6RCf^r}EIai-<;{eH>&965_ls8@<>XM*$F&v2ngxJSXjNv(TDup$v|2Y65t5GXDS zv*w+sk1@%6IinY~ofM{(%UEF92JO=<=6A34)umd3f+XW^)6mmJvp)0|+$tYZ!Fcj^ zbF7JiqIw~5BrA~G6fIC|rx$KMxjK+xlVW|&%fwt2=)}-$C0P#_wW^)4ddF2EZBKl2 zkUa7B9^G(a7Uyj3`AlrgEd$s4+^B?Zi))0ATJ$_8Bx3Fs-06a_$7|0wmBNh*vX5(Y z8)LvpB6tTHO01!^Jd(m2+U2g5n@M9;39XN5H1_d2vF(cTfoAj6*?9A2tqw|b?GQ}X zIPmuGh(D0pLJ^8Xal*V!Kx5iBk9*QrMh62{ZMJNMJcF?S6kjvb=V354?eM4;iSN~`*uxjv4*_+?T2glk^Fdy!!`OL z<-cBHtXmTXM%Qtc#YK1cXxBz<18vqc(?pYQ{3aCDK)Jh(KES!Zv}=g`ltj*3eA7d! z`4}31Rxb9vnK3o&=KQ@n#sfLW!NmTSogroWZW4*&qoMhWAwFr=mCQYS5R=F&;MVI7 zo`_k`|E`Q=6aMWbiI-uryl?1-mJ$XeFA^C$MsgArLvF9{nEEY04|za^3{+A^W8Jod zQQc|ldG|vdW$RdB+Ko5Dz9*Dq*YE!Vh!Y&C7maZDX}FZqd2lD;^sfs1XQy)(00-kj z>Dh@1-7;Al8}I*MALm<3oVrPKms>wA%)*Cf!`=7-IE>49E79W3;-coiGB6nP(htP! zKQOyXjazVsT-u)cO?78l7GKD0jN)CeDg(b%+`69Im8Yepd04u;yC*9<>O+w;SvMlw z&D&dXbpS2L$^t}D4qKip0g+B6Xy(Hl$-;i#sw{YZvIOuR*>I_&-HY_m&NM{GISUI5 ztIEsHZmzDslsE(aNV;>OEhXr9y%ixesE-h~BG``bp&UzAaXmK@Zf$KX0@%)Dd1!(2 z0(gqjU{^LEeWs>mSyP|hW%Q0lZQp&m*ri=Tn?@nV_Kq|fBq{K`ImmLPUPKKx1p@fQ zt3M?zU-i}m`9egnDs<^`U%9t^@*x-FksvziT6$Ys+wYdhwu#QH&V1YIfz7}CM){BD zVYx3c=57twxF$Zlz9+b#cKkPyTR>g}3JPDR#zPjS$rp232nqT&$uJ~u3XtR3GD{X{P5vfSlHw?KQQjUFMYcVF0uUg z%m0`Fn)}-X(5$bgcPLd~VfwVXk+%A;UPdj|=iII1Zvb-t#3$|nS;MKp z+~*aX1r~clwX4BAJXbno0!++@pA^GWGg*(+AFa>vt*_#DV}ri#z=O45+%N<14SGrk z{A813lLJfra20>UxBhai;^w8CL*x}WG$EUuC)ZxI1TYPFB4*28^!al_f6sPK8iTox z*$>?l`t}WEFYrVW(obWUWA~$BoTvx)Nxwn=fenJ$Fq>ol+q|bNA-S0X8>BMlXO8>! zjX9m0*-x@CW%@cVG6RyExdS1VMiq3bhObnfb-6-ova0NEozMz$QFnK@isQ>$D#3G~ zR3g?_y8yEpOyoi_=OigTGr^{H=i5G#GD%AzEKlY(j3N*SSCB%uwx=Pob8}_$0Ff^( zDX~d%{uPT)~NcsH=! z4v=|lT~M?qq-;q8mgP>srF3SQWZ72xljhaTq@7iBX7vj?TU$Lp4LXPm;U_CNWdCR{ zwY$Iz^b_Pr=IV)5^?-M0n`U)f;}Y1qFxq(oFnF@_LrkW=-&Pa`qbdhShUO?5YYrDW zo?v7X1Z9y=om&!ZH}`n}4TE>%IZ-1$g^s(SoUAhT;j~H z-1ibhNYLW|8JPWn&jpS!5&1$d6)pq-Rdi4y*R&qKsbA|Hflbu?eRqd;*SE2m#(wZ` zlYAZV^)U%__F3j^kedI9(&V_XL7!H+>_fhjo#z^4;pRD|jQ#_2{q^ZDXIw_RH5}~5 z@8l{TWv&k9&u-V;wiTNA_32a~F=R3aErIY|E?3ik!9%nYN;yjcXhRKa&z?QI!k}8Z z+t;7V(44n~akJs9v_aD5Iz3Q1vAQ(dyEZ*NJ@-bo;AvJ`@S8qieAjd1Fl0R(mMf$_ z9O^qsrBdfn1M$uL-*2#k#LB*}$l0KvS!e0Py}6{iRpL(rwfw0k%Lo0fMKmruK{@jB zxbDWo^)FGnPuq1?-v0O~Qg>t37s{}pOslWN)pYXHC;Z1P0Cc8UL9nqL^Azt=^ou{P zY^*J0Y0+v9g+LkR#FvrAZUUtC$zr$=C#v*j;~xMD6Oc!L_Q>mvcx)|-SNjX5R1rGn zWgKP;94YTrJKud}dLTl5KpRcmFB%$i=KG0=#O+ev=Q&VOXi;xf?VpDL)-FQIZr_U9 zizZFJe-SxxTWk6xug)S`2oIrr@TcR@_c^K5Rvlx)@705ULH@uAz@Mcfi@u6c^UOVokfkm*WkdCQ`vpA_Ng>Djx$e*;tlvgEDHP_y4g( zmbXukL_frJWgA0S)|@rh_-+R|hyM4QzrWAD%qDj)K@*tzRS*`Oi!6Fh@MFATKV!?8tasFG4RU^j!xi{iX%pgc%WqeD{84qUM>IPcbn?JaH1sgKM-6ypHY)h zdm>hSez2I`A3Zl+h4N7$kc*IddmjqPq3%rAZLBv)vkS{xefZ$NDL`qaUOKQF$T;1+ zyo@=vi=9*-ykg2gQCoxGU**7kMNeraI2iNT!^1L!0ge8ibzwXu77Nv6zPS_610Yb5 z9GY(OUpL|Z2y_43SIPh$4YGh-`7Lt5*X-5~RI2`H9vZ9!?|yzZqiBVGc=P1k3_vW; z-83G^`u%xu6@Oi{NHV#+sqD@1IeMglO5e^#UfmSCP&)AnokFD2D~>gade{89zSyj5 z_0^a*XA?1fW_T)Id*-B7ZLlBYef&2PEbLA}zR3T z($S*X0?J*U6Su_*yEpw0DG|6>q>*U%hK@37;;X(l*SUcqb$25x5{BYMf85L)j9=+b z7q$)#4*m_KvYmjQ@Zk-SkfoeWh1k24EWqEqCG!-|V@x3j?b&<8Z+eqUi5#3)m8YG~ z^F&A;flc-GRr$I5r*~4UP1+;09R3fkEwJgPt<}O)zr|k(w5_R+^OCB2w+%h;8je2N zoP`KsI1S&cxIFfztE1!KMP`&Y#gY;yul!~PxN)MQeOj6Ka5!=FZ$=P5btUeXLl^#H z(hNwsz-qWqjrwBG9%=fyfxpurl$)H07jG5Uz4GZyG9ttuQ0TEPpT#d7nFf(XhMNw} z6IiVQSYf-^;X7e_9ImCbK2p!}8GV@v`JJ#8My7`E$DL`y@yB<8z$13wc`QXIOcQ`A zH@`f+Y9tqO=4ECsj-(*T0VYLo`UeANY&!fhvn&LPf#%`%=~x1l;TCqBX_m3`Mmt2M zRMpj8Hul_Na-ZyWHv>Q&054GfpD8($ZcG;Uol6DmK-Hs(PCD!%EM3{2qHzfDcN|`B zeNX%t83)XASJzLA2=Tmfa^|yO9$qx&I*&c%pGz|}w*X!XYhm7kXa~dyq+}y2AS`4X zv&nfZva5qQx49nVraBTQyAnazhX}~Mgx_tLXCe(3QVaby2psWOXZ?ND!JE0JSo17R ze!P<9FHIo0ZSI^&et-D!`pw>aV-S6rEZh*u?z6cxC#vTQ2_gp8;MNW%ioq>_VkW(D zE@I9O@N=xb;fD9uJwgEa8Ww&UHCa4q_V2}o5ct!+G)dr~m?A+d3qa)me?7EK7sNy< zBm_7bAU`vEIQaMe_o2@>szc}U!@8QJ>`iQc9W`(12QB>fL1zIj|1~lIlreui#BHNY znq>e*vdR5;WZ(SQe;2}nY57dsfD{Mm2cop_MDx8M)PdQVK;g&ZM?`;89mN0siG`of zY*SlIPWO`%HdQC|GtmC$Gpoq{>C6BI{{giBKPY^cf{9!vQQh@ffR=+%+ha8s_Rx$ag#&mV_9Z6lNcwa`s#0i@x0UT|=5$G=uJ`0*Z#o7x0i zJk~1pu+KiwPRYJhmzO6G9ISqQ(a0tqA?oJl_vx>6l@JECVJ%iz@!8o7{Y+57_!eH7 z1hvaym=NaLmZEWeB}vh~4UTkiap@fgWzCie^}40FN6f!|zY3zZ99s2@IF8ebrT)u) zG|v;@5Hq<1q;^hYH+`bDGAK2i&0XAiKIH=ebQY+l*JP2nlP!tz#SWmB;IQ}hZmmR6 zi?OWOjy!Q9Dgh3){h-g+9-rQ;g1YtO@Wl}hS@@B9O7Kl?EMdOeT6JT!d^r5kOECIZ z_gE9pmwqp2`YU`!J633Q*z57W<899Is&0eCQUu6JdO4(ZR;a}dGqk!59mMS0LwaRK z;h;Nb7heY`t!00gsgLMb`q2#1Vky|ZmN+C2-A&f=rPv* zc-{2}pxKxl*2}oWg*t0(^PJJ5SofBF^m*PpX;IkJbF@>56Gco5 zq(s|=U}v!rli68C{)$4n8$FKkP>Dg$$m4!4GVe6hjMBXH{>TWuV(%oV`W8FWoxAu? zQ)YI6Y~ZchdWFau;LA1-?mO_k#fpj^vpJ%=0J?onAr=moF1otDX1}@k5JYX4h0y@} zmaCtkM&KTB(1HS9T?^FW_Gi-A(1RiB56Qy&Y78H#$y+lfa|@n*3R&N%qFhv5W8XF7o-7e(#wNuO}jT zbzUh1i~6PMgjIdK7ko&;&{wdHxZP~3j@=MPjsi!en<-l|I$jadGa;Yu5-od7M<-YsWGmCUxey`zIh z+x*;62u)BbsfWd({ghnnm%9T)dPKSN*Ic+dt*vPwvt}lTm`Z{3Zv0U_W$`X_k zwZD|O4SK9|$=mvtu8BsJA4U^PyB+Xuo}R64VH2529et(lA*I8h?^~p}JHAo*tUbYw za>lI0-jGr#hkdYO<-(fk!9Ek5@o}-OeRV#O8)Y$-G`4&>!p?LE%aOr*zdus&p7DAs zU)UBLp|6m?IqP)4Q>OoJ1(K^k4n_ zpeL3UDRxv&9Ix)#cRx|i@?6*Dt3O5XW|jhUi#++;>KQ@T?xSNI_7w$*#7?(>_??cdA5e zqlhvWC|IdHV#z;V51Q9ryvUoH6uz@;Hv-#0y||^!zAGhaqGxIcO{&ER+F@|bqk^${ zufeKPym~HZNEy|=UAe4U;HtEIBy%1qc2edaIt;;6#z&Ww!;jyLXAxPGS+Q8G-F5R&5NANSma+O%$xN zzU{oEfug7M_zFtMcAvWG>*=ujT43|qOp9U`kEoi>y*`JqacP7w2kvm4L>otpe;ipj z(mDce5YG8zplN`tDf-FDbZRONfg(no0dlT0S||jYR(FwGI+sd8k1Sm<;?GbYfU@19 zKA|}!Mo2gE$WGAG^_gq@WCF-JF!mm?N!S!9hV-i4U-^^~zqQ}Q{<9SN-6hJg_lJ8` z)n3_n)F?k}lKz~-gCdUSHF1?JHHiwCQem&!$6~H3w^>)(!DNT#kMD{JXdY{O9euBB zR19;Nst)=Ba@u3#B19Jcd158(Y={q!yR5h)*bx5wTQh_qR)4V*@&Jhrs4t^tS+ z;>m=`GM+UJ#RVGC0}aiVG~~m!fSx&VT!qNhy!3UehwhL?X_Jy?nx^uu+zqi`D>`SN z|524ke@}%~eN4EBz%1~m#p6xGZ_9gsv^ry$>@n1BLu-(LN`r3Qh)XK z;vjiS47cmPqf!i4)|{!c&&~aI_9@Nb7)OL+KB-nAt>a+^8n&ktR;~sWjmH#w9+XCm#c+ zy!T$~5qt0T0}YE|2|CA7+4jiE7E;Z#(4*Nd(3ZCrTFApMl$@>Urg)YW_DlM1iJ}!fH`KfaKpC8Df9>jO z6^d1`dfZXbu%`GHSNcGu;lNo@@dr{lf0vK7)tC;3KP*Yo}_W%3_PL?kpxT_y8o(h5%7BSS-Df^9Ngm^n`a#Chx7Fv)BN3vnT%Qf!SHRG+GcqLO#54}dTa`TL!&6)&%~BB|YAd_>AA`Cn{hl$mP7{wZcc<1dTlKVimVrrO_j`%({&=+VvHv(z7reu_36-3yz{u1}(T} zpIoUMDd!5HMNfy<8Rfmc&2gd@YUt~!S^>|%3qpsv-9S&^4a1JuE*w=+L2Ty&RZ-Z$ z9hhueYRv4@?R#`mQcdPRKJrFxLlv$g@2kNJ QdMu}o8z0L*ivHvO0h0+sRsaA1 diff --git a/_benchmarks/view/tests.yml b/_benchmarks/view/tests.yml index 00ee224c0..a50a03fc4 100644 --- a/_benchmarks/view/tests.yml +++ b/_benchmarks/view/tests.yml @@ -11,8 +11,6 @@ Envs: - Name: Ace Dir: ./ace - - Name: Amber - Dir: ./amber - Name: Blocks Dir: ./blocks - Name: Django diff --git a/_examples/README.md b/_examples/README.md index 7291211ed..1b316c665 100644 --- a/_examples/README.md +++ b/_examples/README.md @@ -138,7 +138,6 @@ * [Overview](view/overview/main.go) * [Layout](view/layout) * [Ace](view/layout/ace) - * [Amber](view/layout/amber) * [Blocks](view/layout/blocks) * [Django](view/layout/django) * [Handlebars](view/layout/handlebars) @@ -160,7 +159,6 @@ * Parse a Template from Text * [HTML, Pug and Ace](view/parse-parse/main.go) * [Django](view/parse-parse/django/main.go) - * [Amber](view/parse-parse/amber/main.go) * [Jet](view/parse-parse/jet/main.go) * [Handlebars](view/parse-parse/handlebars/main.go) * [Blocks](view/template_blocks_0) @@ -170,8 +168,6 @@ * [Pug Embedded`](view/template_pug_2_embedded) * [Ace](view/template_ace_0) * [Django](view/template_django_0) - * [Amber](view/template_amber_0) - * [Amber Embedded](view/template_amber_1_embedded) * [Jet](view/template_jet_0) * [Jet Embedded](view/template_jet_1_embedded) * [Jet 'urlpath' tmpl func](view/template_jet_2) diff --git a/_examples/README_ZH_HANT.md b/_examples/README_ZH_HANT.md index 5d8abbaa3..13c852b1a 100644 --- a/_examples/README_ZH_HANT.md +++ b/_examples/README_ZH_HANT.md @@ -136,7 +136,6 @@ - [概覽](view/overview/main.go) - [排版引擎](view/layout) - [Ace](view/layout/ace) - - [Amber](view/layout/amber) - [Blocks](view/layout/blocks) - [Django](view/layout/django) - [Handlebars](view/layout/handlebars) @@ -158,7 +157,6 @@ - 從文字解析樣板 - [HTML, Pug and Ace](view/parse-parse/main.go) - [Django](view/parse-parse/django/main.go) - - [Amber](view/parse-parse/amber/main.go) - [Jet](view/parse-parse/jet/main.go) - [Handlebars](view/parse-parse/handlebars/main.go) - [Blocks](view/template_blocks_0) @@ -168,8 +166,6 @@ - [Pug Embedded`](view/template_pug_2_embedded) - [Ace](view/template_ace_0) - [Django](view/template_django_0) - - [Amber](view/template_amber_0) - - [Amber Embedded](view/template_amber_1_embedded) - [Jet](view/template_jet_0) - [Jet Embedded](view/template_jet_1_embedded) - [Jet 'urlpath' tmpl func](view/template_jet_2) diff --git a/_examples/view/context-view-data/templates/layouts/layout.html b/_examples/view/context-view-data/templates/layouts/layout.html index 4e0179c7b..ef74f39c9 100644 --- a/_examples/view/context-view-data/templates/layouts/layout.html +++ b/_examples/view/context-view-data/templates/layouts/layout.html @@ -5,6 +5,6 @@ - {{ yield . . }} + {{ yield . }} diff --git a/_examples/view/layout/amber/main.go b/_examples/view/layout/amber/main.go deleted file mode 100644 index 92195ee3f..000000000 --- a/_examples/view/layout/amber/main.go +++ /dev/null @@ -1,28 +0,0 @@ -package main - -import "github.com/kataras/iris/v12" - -func main() { - app := iris.New() - app.RegisterView(iris.Amber("./views", ".amber")) - - app.Get("/", index) - - app.Listen(":8080") -} - -func index(ctx iris.Context) { - data := iris.Map{ - "Title": "Page Title", - "FooterText": "Footer contents", - "Message": "Main contents", - } - - // On Amber this is ignored: ctx.ViewLayout("layouts/main") - // Layouts are only rendered from inside the index page itself - // using the "extends" keyword. - if err := ctx.View("index", data); err != nil { - ctx.HTML("

%s

", err.Error()) - return - } -} diff --git a/_examples/view/layout/amber/views/index.amber b/_examples/view/layout/amber/views/index.amber deleted file mode 100644 index e92604dcb..000000000 --- a/_examples/view/layout/amber/views/index.amber +++ /dev/null @@ -1,5 +0,0 @@ -extends layouts/main.amber - -block content - h1 Index Body - h3 Message: #{Message} \ No newline at end of file diff --git a/_examples/view/layout/amber/views/layouts/main.amber b/_examples/view/layout/amber/views/layouts/main.amber deleted file mode 100644 index 2dbc577ac..000000000 --- a/_examples/view/layout/amber/views/layouts/main.amber +++ /dev/null @@ -1,8 +0,0 @@ -doctype html -html - head - title #{Title} - body - block content - footer - #{render("partials/footer.amber", $)} \ No newline at end of file diff --git a/_examples/view/layout/amber/views/partials/footer.amber b/_examples/view/layout/amber/views/partials/footer.amber deleted file mode 100644 index a202d2c01..000000000 --- a/_examples/view/layout/amber/views/partials/footer.amber +++ /dev/null @@ -1,2 +0,0 @@ -h3 Footer Partial -h4 #{FooterText} \ No newline at end of file diff --git a/_examples/view/parse-template/amber/main.go b/_examples/view/parse-template/amber/main.go deleted file mode 100644 index 3fa5829d7..000000000 --- a/_examples/view/parse-template/amber/main.go +++ /dev/null @@ -1,32 +0,0 @@ -package main - -import "github.com/kataras/iris/v12" - -func main() { - e := iris.Amber(nil, ".amber") // You can still use a file system though. - e.AddFunc("greet", func(name string) string { - return "Hello, " + name + "!" - }) - err := e.ParseTemplate("program.amber", []byte(`h1 #{ greet(Name) }`)) - if err != nil { - panic(err) - } - e.Reload(true) - - app := iris.New() - app.RegisterView(e) - app.Get("/", index) - - app.Listen(":8080") -} - -func index(ctx iris.Context) { - if err := ctx.View("program.amber", iris.Map{ - "Name": "Gerasimos", - // Or per template: - // "greet": func(....) - }); err != nil { - ctx.HTML("

%s

", err.Error()) - return - } -} diff --git a/_examples/view/template_ace_0/views/index.ace b/_examples/view/template_ace_0/views/index.ace index 776cc11ff..144910f0b 100644 --- a/_examples/view/template_ace_0/views/index.ace +++ b/_examples/view/template_ace_0/views/index.ace @@ -2,4 +2,6 @@ h2 {{.Title}} +h3 Body + = include partials/footer.ace . \ No newline at end of file diff --git a/_examples/view/template_amber_0/main.go b/_examples/view/template_amber_0/main.go deleted file mode 100644 index 4d6155c0f..000000000 --- a/_examples/view/template_amber_0/main.go +++ /dev/null @@ -1,23 +0,0 @@ -package main - -import "github.com/kataras/iris/v12" - -func main() { - app := iris.New() - - // Read about its markup syntax at: https://github.com/eknkc/amber - tmpl := iris.Amber("./views", ".amber") - - app.RegisterView(tmpl) - - app.Get("/", func(ctx iris.Context) { - if err := ctx.View("index.amber", iris.Map{ - "Title": "Title of The Page", - }); err != nil { - ctx.HTML("

%s

", err.Error()) - return - } - }) - - app.Listen(":8080") -} diff --git a/_examples/view/template_amber_0/views/index.amber b/_examples/view/template_amber_0/views/index.amber deleted file mode 100644 index ab89a92a8..000000000 --- a/_examples/view/template_amber_0/views/index.amber +++ /dev/null @@ -1,11 +0,0 @@ -extends layouts/main.amber - -block append meta - meta[name="keywords"][content="These are added by the child template"] - -block menu - li Item 1 - li Item 2 - -block content - p Content from child template \ No newline at end of file diff --git a/_examples/view/template_amber_0/views/layouts/main.amber b/_examples/view/template_amber_0/views/layouts/main.amber deleted file mode 100644 index b2f9ad6c8..000000000 --- a/_examples/view/template_amber_0/views/layouts/main.amber +++ /dev/null @@ -1,15 +0,0 @@ -!!! transitional -html - head - title #{Title} - - block meta - meta[name="description"][value="This is a sample"] - - body - header#mainHeader - ul - block menu - - div#content - block content \ No newline at end of file diff --git a/_examples/view/template_amber_1_embedded/bindata.go b/_examples/view/template_amber_1_embedded/bindata.go deleted file mode 100644 index d92c48890..000000000 --- a/_examples/view/template_amber_1_embedded/bindata.go +++ /dev/null @@ -1,358 +0,0 @@ -// Code generated by go-bindata. (@generated) DO NOT EDIT. - -// Package main generated by go-bindata.// sources: -// ../template_amber_0/views/index.amber -// ../template_amber_0/views/layouts/main.amber -package main - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "net/http" - "os" - "path/filepath" - "strings" - "time" -) - -func bindataRead(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -// Name return file name -func (fi bindataFileInfo) Name() string { - return fi.name -} - -// Size return file size -func (fi bindataFileInfo) Size() int64 { - return fi.size -} - -// Mode return file mode -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} - -// ModTime return file modify time -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} - -// IsDir return file whether a directory -func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 -} - -// Sys return file is sys mode -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -type assetFile struct { - *bytes.Reader - name string - childInfos []os.FileInfo - childInfoOffset int -} - -type assetOperator struct{} - -// Open implement http.FileSystem interface -func (f *assetOperator) Open(name string) (http.File, error) { - var err error - if len(name) > 0 && name[0] == '/' { - name = name[1:] - } - content, err := Asset(name) - if err == nil { - return &assetFile{name: name, Reader: bytes.NewReader(content)}, nil - } - children, err := AssetDir(name) - if err == nil { - childInfos := make([]os.FileInfo, 0, len(children)) - for _, child := range children { - childPath := filepath.Join(name, child) - info, errInfo := AssetInfo(filepath.Join(name, child)) - if errInfo == nil { - childInfos = append(childInfos, info) - } else { - childInfos = append(childInfos, newDirFileInfo(childPath)) - } - } - return &assetFile{name: name, childInfos: childInfos}, nil - } else { - // If the error is not found, return an error that will - // result in a 404 error. Otherwise the server returns - // a 500 error for files not found. - if strings.Contains(err.Error(), "not found") { - return nil, os.ErrNotExist - } - return nil, err - } -} - -// Close no need do anything -func (f *assetFile) Close() error { - return nil -} - -// Readdir read dir's children file info -func (f *assetFile) Readdir(count int) ([]os.FileInfo, error) { - if len(f.childInfos) == 0 { - return nil, os.ErrNotExist - } - if count <= 0 { - return f.childInfos, nil - } - if f.childInfoOffset+count > len(f.childInfos) { - count = len(f.childInfos) - f.childInfoOffset - } - offset := f.childInfoOffset - f.childInfoOffset += count - return f.childInfos[offset : offset+count], nil -} - -// Stat read file info from asset item -func (f *assetFile) Stat() (os.FileInfo, error) { - if len(f.childInfos) != 0 { - return newDirFileInfo(f.name), nil - } - return AssetInfo(f.name) -} - -// newDirFileInfo return default dir file info -func newDirFileInfo(name string) os.FileInfo { - return &bindataFileInfo{ - name: name, - size: 0, - mode: os.FileMode(2147484068), // equal os.FileMode(0644)|os.ModeDir - modTime: time.Time{}} -} - -// AssetFile return a http.FileSystem instance that data backend by asset -func AssetFile() http.FileSystem { - return &assetOperator{} -} - -var _indexAmber = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x8d\x31\x8a\xc3\x30\x14\x44\x7b\x83\xef\x30\xe8\x00\xbb\xec\xf6\xae\xb6\xda\x3e\x9d\x71\xf1\x6d\x4d\xb0\xb1\xbe\x24\xa4\x6f\x12\xdf\x3e\x10\x07\x4c\xd2\xcd\x63\x86\x79\xbc\x1b\xa3\xaf\x08\xb2\xa7\xcd\xea\xb7\xca\x12\xbf\x44\x47\x96\xb6\x69\x9b\x31\xa4\x69\x85\xe4\xcc\xe8\xa1\x34\x69\x1b\x00\xcf\xd4\x47\x51\x76\x6e\xe5\x7e\x4b\xc5\x57\x37\xf4\x53\x8a\xc6\x68\x9d\xbb\xcc\xac\x84\x14\x42\xbc\xa7\xc7\xb8\xc3\x66\x62\x9a\x97\xe0\x61\xd4\x1c\xc4\xe8\x86\x53\xa0\x8c\xdb\xf1\x1c\x16\xfc\x1b\x15\x3f\xef\xf8\x7b\x6e\x5f\x96\xa3\xcf\xf8\x3b\x10\xd7\x92\xf4\xc3\xf0\x08\x00\x00\xff\xff\xaa\xd2\x87\xd5\xdb\x00\x00\x00") - -func indexAmberBytes() ([]byte, error) { - return bindataRead( - _indexAmber, - "index.amber", - ) -} - -func indexAmber() (*asset, error) { - bytes, err := indexAmberBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "index.amber", size: 219, mode: os.FileMode(438), modTime: time.Unix(1599264617, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _layoutsMainAmber = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x4e\xc1\xae\x83\x30\x0c\xbb\x23\xf1\x0f\xa1\x7c\x07\xf7\xf7\x01\xdc\x10\x87\x40\x23\x11\xbd\x34\x45\x34\x20\x4d\xd3\xfe\x7d\xea\xd8\x04\xf5\xa5\xae\xdd\xda\x6e\x9a\x06\x6c\x43\x4d\x6c\x1c\x15\xa5\xae\x16\x0b\x52\x57\x00\x00\x0b\xa1\x3f\x59\x86\xb1\x09\x41\xfb\xec\xf3\xf9\xaa\xab\xcb\x99\x24\xce\xff\x10\xc8\xf0\xd2\x32\xb2\x32\x28\x06\xea\x9c\xa7\x34\x6f\xbc\xe6\x0e\x37\x0e\x07\xca\x4e\x9d\xeb\x17\x4e\xc0\x09\x10\x12\x86\x55\xc8\x8d\xbf\xd4\x29\xfa\xc7\x95\x95\x77\xd0\xd6\x06\x64\xfd\xfb\xd0\xb2\x66\x97\xf2\x7e\x9f\xa4\xfb\x7d\xa8\xe7\xa3\x9d\xa3\x1a\xa9\x95\x5f\xce\xe7\x5f\xeb\x1d\x00\x00\xff\xff\x56\x99\x59\x53\x13\x01\x00\x00") - -func layoutsMainAmberBytes() ([]byte, error) { - return bindataRead( - _layoutsMainAmber, - "layouts/main.amber", - ) -} - -func layoutsMainAmber() (*asset, error) { - bytes, err := layoutsMainAmberBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "layouts/main.amber", size: 275, mode: os.FileMode(438), modTime: time.Unix(1599263735, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "index.amber": indexAmber, - "layouts/main.amber": layoutsMainAmber, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// -// data/ -// foo.txt -// img/ -// a.png -// b.png -// -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("nonexistent") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -var _bintree = &bintree{nil, map[string]*bintree{ - "index.amber": {indexAmber, map[string]*bintree{}}, - "layouts": {nil, map[string]*bintree{ - "main.amber": {layoutsMainAmber, map[string]*bintree{}}, - }}, -}} - -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = os.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) -} diff --git a/_examples/view/template_amber_1_embedded/main.go b/_examples/view/template_amber_1_embedded/main.go deleted file mode 100644 index 36b853154..000000000 --- a/_examples/view/template_amber_1_embedded/main.go +++ /dev/null @@ -1,31 +0,0 @@ -package main - -import "github.com/kataras/iris/v12" - -// $ go install github.com/go-bindata/go-bindata/v3/go-bindata@latest -// -// $ go-bindata -fs -prefix "../template_amber_0/views" ../template_amber_0/views/... -// $ go run . -// # OR: go-bindata -fs -prefix "views" ./views/... if the views dir is rel to the executable. -// -// System files are not used, you can optionally delete the folder and run the example now. - -func main() { - app := iris.New() - - // Read about its markup syntax at: https://github.com/eknkc/amber - tmpl := iris.Amber(AssetFile(), ".amber") - - app.RegisterView(tmpl) - - app.Get("/", func(ctx iris.Context) { - if err := ctx.View("index.amber", iris.Map{ - "Title": "Title of The Page", - }); err != nil { - ctx.HTML("

%s

", err.Error()) - return - } - }) - - app.Listen(":8080") -} diff --git a/_examples/view/template_jet_0/views/layouts/application.jet b/_examples/view/template_jet_0/views/layouts/application.jet index 9fce2365a..d8945a341 100644 --- a/_examples/view/template_jet_0/views/layouts/application.jet +++ b/_examples/view/template_jet_0/views/layouts/application.jet @@ -2,7 +2,7 @@ - {{ isset(title) ? title : "" }} + {{ isset(title) ? title : "Default" }} {{block documentBody()}}{{end}} diff --git a/aliases.go b/aliases.go index 47d04e5cc..f83fad7d8 100644 --- a/aliases.go +++ b/aliases.go @@ -46,7 +46,7 @@ type ( // Developers get request information from the client's request by a Context. Context = *context.Context // ViewEngine is an alias of `context.ViewEngine`. - // See HTML, Blocks, Django, Jet, Pug, Ace, Handlebars, Amber and e.t.c. + // See HTML, Blocks, Django, Jet, Pug, Ace, Handlebars and e.t.c. ViewEngine = context.ViewEngine // UnmarshalerFunc a shortcut, an alias for the `context#UnmarshalerFunc` type // which implements the `context#Unmarshaler` interface for reading request's body @@ -267,9 +267,6 @@ var ( // Pug view engine. // Shortcut of the view.Pug. Pug = view.Pug - // Amber view engine. - // Shortcut of the view.Amber. - Amber = view.Amber // Jet view engine. // Shortcut of the view.Jet. Jet = view.Jet diff --git a/go.mod b/go.mod index 9b11fb85d..b279310a1 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,6 @@ require ( github.com/andybalholm/brotli v1.0.5 github.com/blang/semver/v4 v4.0.0 github.com/dgraph-io/badger/v2 v2.2007.4 - github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 github.com/fatih/structs v1.1.0 github.com/flosch/pongo2/v4 v4.0.2 github.com/golang/snappy v0.0.4 diff --git a/go.sum b/go.sum index aea4d4a7c..a4e63bb66 100644 --- a/go.sum +++ b/go.sum @@ -49,8 +49,6 @@ github.com/djherbis/atime v1.1.0/go.mod h1:28OF6Y8s3NQWwacXc5eZTsEsiMzp7LF8MbXE+ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o= -github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0Hw= diff --git a/view/README.md b/view/README.md index a52329667..84914048c 100644 --- a/view/README.md +++ b/view/README.md @@ -1,6 +1,6 @@ # View -Iris supports 8 template engines out-of-the-box, developers can still use any external golang template engine, +Iris supports 7 template engines out-of-the-box, developers can still use any external golang template engine, as `Context.ResponseWriter()` is an `io.Writer`. All template engines share a common API i.e. @@ -13,9 +13,8 @@ Parse using embedded assets, Layouts and Party-specific layout, Template Funcs, | 3 | Django | [flosch/pongo2](https://github.com/flosch/pongo2) | | 4 | Pug | [Joker/jade](https://github.com/Joker/jade) | | 5 | Handlebars | [mailgun/raymond](https://github.com/mailgun/raymond) | -| 6 | Amber | [eknkc/amber](https://github.com/eknkc/amber) | -| 7 | Jet | [CloudyKit/jet](https://github.com/CloudyKit/jet) | -| 8 | Ace | [yosssi/ace](https://github.com/yosssi/ace) | +| 6 | Jet | [CloudyKit/jet](https://github.com/CloudyKit/jet) | +| 7 | Ace | [yosssi/ace](https://github.com/yosssi/ace) | [List of Examples](https://github.com/kataras/iris/tree/master/_examples/view). diff --git a/view/ace.go b/view/ace.go index 04fe746f5..5da5e263d 100644 --- a/view/ace.go +++ b/view/ace.go @@ -1,6 +1,7 @@ package view import ( + "strings" "sync" "github.com/yosssi/ace" @@ -62,6 +63,12 @@ func Ace(fs interface{}, extension string) *AceEngine { []*ace.File{}, ) + if strings.Contains(name, "layout") { + for k, v := range s.layoutFuncs { + funcs[k] = v + } + } + opts := &ace.Options{ Extension: extension[1:], FuncMap: funcs, diff --git a/view/amber.go b/view/amber.go deleted file mode 100644 index 72c6d90b9..000000000 --- a/view/amber.go +++ /dev/null @@ -1,281 +0,0 @@ -package view - -import ( - "bytes" - "fmt" - "html/template" - "io" - "io/fs" - "net/http" - "os" - "path/filepath" - "strings" - "sync" - "sync/atomic" - - "github.com/kataras/iris/v12/context" - - "github.com/eknkc/amber" -) - -// AmberEngine contains the amber view engine structure. -type AmberEngine struct { - fs fs.FS - // files configuration - rootDir string - extension string - reload bool - // - rmu sync.RWMutex // locks for `ExecuteWiter` when `reload` is true. - templateCache map[string]*template.Template - bufPool *sync.Pool - - Options amber.Options -} - -var ( - _ Engine = (*AmberEngine)(nil) - _ EngineFuncer = (*AmberEngine)(nil) -) - -var amberOnce = new(uint32) - -// Amber creates and returns a new amber view engine. -// The given "extension" MUST begin with a dot. -// -// Usage: -// Amber("./views", ".amber") or -// Amber(iris.Dir("./views"), ".amber") or -// Amber(embed.FS, ".amber") or Amber(AssetFile(), ".amber") for embedded data. -func Amber(dirOrFS interface{}, extension string) *AmberEngine { - if atomic.LoadUint32(amberOnce) > 0 { - panic("Amber: cannot be registered twice as its internal implementation share the same template functions across instances.") - } else { - atomic.StoreUint32(amberOnce, 1) - } - - fileSystem := getFS(dirOrFS) - s := &AmberEngine{ - fs: fileSystem, - rootDir: "/", - extension: extension, - templateCache: make(map[string]*template.Template), - Options: amber.Options{ - PrettyPrint: false, - LineNumbers: false, - VirtualFilesystem: http.FS(fileSystem), - }, - bufPool: &sync.Pool{New: func() interface{} { - return new(bytes.Buffer) - }}, - } - - builtinFuncs := template.FuncMap{ - "render": func(name string, binding interface{}) (template.HTML, error) { - result, err := s.executeTemplateBuf(name, binding) - return template.HTML(result), err - }, - } - - for k, v := range builtinFuncs { - amber.FuncMap[k] = v - } - - return s -} - -// RootDir sets the directory to be used as a starting point -// to load templates from the provided file system. -func (s *AmberEngine) RootDir(root string) *AmberEngine { - if s.fs != nil && root != "" && root != "/" && root != "." && root != s.rootDir { - sub, err := fs.Sub(s.fs, s.rootDir) - if err != nil { - panic(err) - } - - s.fs = sub // here so the "middleware" can work. - } - - s.rootDir = filepath.ToSlash(root) - return s -} - -// Name returns the amber engine's name. -func (s *AmberEngine) Name() string { - return "Amber" -} - -// Ext returns the file extension which this view engine is responsible to render. -// If the filename extension on ExecuteWriter is empty then this is appended. -func (s *AmberEngine) Ext() string { - return s.extension -} - -// Reload if set to true the templates are reloading on each render, -// use it when you're in development and you're boring of restarting -// the whole app when you edit a template file. -// -// Note that if `true` is passed then only one `View -> ExecuteWriter` will be render each time, -// no concurrent access across clients, use it only on development status. -// It's good to be used side by side with the https://github.com/kataras/rizla reloader for go source files. -func (s *AmberEngine) Reload(developmentMode bool) *AmberEngine { - s.reload = developmentMode - return s -} - -// SetPrettyPrint if pretty printing is enabled. -// Pretty printing ensures that the output html is properly indented and in human readable form. -// Defaults to false, response is minified. -func (s *AmberEngine) SetPrettyPrint(pretty bool) *AmberEngine { - s.Options.PrettyPrint = true - return s -} - -// AddFunc adds the function to the template's function map. -// It is legal to overwrite elements of the default actions: -// - url func(routeName string, args ...string) string -// - urlpath func(routeName string, args ...string) string -// - render func(fullPartialName string) (template.HTML, error). -// -// Note that, Amber does not support functions per template, -// instead it's using the "call" directive so any template-specific -// functions should be passed using `Context.View/ViewData` binding data. -// This method will modify the global amber's FuncMap which considers -// as the "builtin" as this is the only way to actually add a function. -// Note that, if you use more than one amber engine, the functions are shared. -func (s *AmberEngine) AddFunc(funcName string, funcBody interface{}) { - s.rmu.Lock() - amber.FuncMap[funcName] = funcBody - s.rmu.Unlock() -} - -// Load parses the templates to the engine. -// It is responsible to add the necessary global functions. -// -// Returns an error if something bad happens, user is responsible to catch it. -func (s *AmberEngine) Load() error { - // If only custom templates should be loaded. - if (s.fs == nil || context.IsNoOpFS(s.fs)) && len(s.templateCache) > 0 { - return nil - } - - rootDirName := getRootDirName(s.fs) - - return walk(s.fs, "", func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - if info == nil || info.IsDir() { - return nil - } - - if s.extension != "" { - if !strings.HasSuffix(path, s.extension) { - return nil - } - } - - if s.rootDir == rootDirName { - path = strings.TrimPrefix(path, rootDirName) - path = strings.TrimPrefix(path, "/") - } - - contents, err := asset(s.fs, path) - if err != nil { - return fmt.Errorf("%s: %w", path, err) - } - - err = s.ParseTemplate(path, contents) - if err != nil { - return fmt.Errorf("%s: %v", path, err) - } - return nil - }) -} - -// ParseTemplate adds a custom template from text. -// This template parser does not support funcs per template directly. -// Two ways to add a function: -// Globally: Use `AddFunc` or pass them on `View` instead. -// Per Template: Use `Context.ViewData/View`. -func (s *AmberEngine) ParseTemplate(name string, contents []byte) error { - s.rmu.Lock() - defer s.rmu.Unlock() - - comp := amber.New() - comp.Options = s.Options - - err := comp.ParseData(contents, name) - if err != nil { - return err - } - - data, err := comp.CompileString() - if err != nil { - return err - } - - name = strings.TrimPrefix(name, "/") - - /* - New(...).Funcs(s.builtinFuncs): - This won't work on amber, it loads only amber.FuncMap which is global. - Relative code: - https://github.com/eknkc/amber/blob/cdade1c073850f4ffc70a829e31235ea6892853b/compiler.go#L771-L794 - */ - - tmpl := template.New(name).Funcs(amber.FuncMap) - _, err = tmpl.Parse(data) - if err == nil { - s.templateCache[name] = tmpl - } - - return err -} - -func (s *AmberEngine) executeTemplateBuf(name string, binding interface{}) (string, error) { - buf := s.bufPool.Get().(*bytes.Buffer) - buf.Reset() - - tmpl := s.fromCache(name) - if tmpl == nil { - s.bufPool.Put(buf) - return "", ErrNotExist{Name: name, IsLayout: false, Data: binding} - } - - err := tmpl.ExecuteTemplate(buf, name, binding) - result := strings.TrimSuffix(buf.String(), "\n") // on amber it adds a new line. - s.bufPool.Put(buf) - return result, err -} - -func (s *AmberEngine) fromCache(relativeName string) *template.Template { - if s.reload { - s.rmu.RLock() - defer s.rmu.RUnlock() - } - - if tmpl, ok := s.templateCache[relativeName]; ok { - return tmpl - } - - return nil -} - -// ExecuteWriter executes a template and writes its result to the w writer. -// layout here is useless. -func (s *AmberEngine) ExecuteWriter(w io.Writer, filename string, layout string, bindingData interface{}) error { - // re-parse the templates if reload is enabled. - if s.reload { - if err := s.Load(); err != nil { - return err - } - } - - if tmpl := s.fromCache(filename); tmpl != nil { - return tmpl.Execute(w, bindingData) - } - - return ErrNotExist{Name: filename, IsLayout: false, Data: bindingData} -} From 41326d4ddd493f72ccb73d4fba79f8abd9bb26fe Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Fri, 17 Mar 2023 12:42:19 +0200 Subject: [PATCH 06/63] update github ci --- .github/workflows/ci.yml | 6 +++--- README_PT_BR.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e75794c0..1bc66129e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,16 +17,16 @@ jobs: strategy: matrix: - go_version: [1.19.x] + go_version: [1.20.x] steps: - name: Set up Go 1.x - uses: actions/setup-go@v2 + uses: actions/setup-go@v4 with: go-version: ${{ matrix.go_version }} - name: Check out code into the Go module directory - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Test run: go test -v ./... diff --git a/README_PT_BR.md b/README_PT_BR.md index df94d769d..7564ffa3a 100644 --- a/README_PT_BR.md +++ b/README_PT_BR.md @@ -475,7 +475,7 @@ $ go get github.com/kataras/iris/v12@latest **Run** ```sh -$ go mod tidy -compat=1.19 # -compat="1.19" for windows. +$ go mod tidy -compat=1.20 # -compat="1.20" for windows. $ go run . ``` From 0954986a66a0feb8ab5850c80dcdd7b37fc01efd Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sat, 18 Mar 2023 15:43:18 +0200 Subject: [PATCH 07/63] add LoadKV method on Iris.Application.I18N instance --- HISTORY.md | 2 + .../embedded/locales/el-GR/other.ini | 4 +- .../embedded/locales/el-GR/user.ini | 2 +- .../embedded/locales/en-US/other.ini | 4 +- .../embedded/locales/en-US/user.ini | 2 +- _examples/i18n/template-embedded/main.go | 17 ++++- i18n/i18n.go | 21 +++++- i18n/internal/catalog.go | 1 + i18n/loader.go | 66 ++++++++++++++++++- 9 files changed, 108 insertions(+), 11 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 11405bbd3..21cfeac95 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -23,6 +23,8 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene Change applies to `master` branch. +- Add `LoadKV` method on `Iris.Application.I18N` instance. It should be used when no locale files are available. It loads locales via pure Go Map (or database decoded values). + - Remove [ace](https://github.com/eknkc/amber) template parser support, as it was discontinued by its author more than five years ago. # Sa, 11 March 2023 | v12.2.0 diff --git a/_examples/i18n/template-embedded/embedded/locales/el-GR/other.ini b/_examples/i18n/template-embedded/embedded/locales/el-GR/other.ini index 5954cdd35..8ebc6727c 100644 --- a/_examples/i18n/template-embedded/embedded/locales/el-GR/other.ini +++ b/_examples/i18n/template-embedded/embedded/locales/el-GR/other.ini @@ -4,7 +4,7 @@ User = Λογαριασμός [debug] Title = Μενού προγραμματιστή AccessLog = Πρόσβαση στο αρχείο καταγραφής -AccessLogClear = Καθαρισμός {{tr "debug.AccessLog"}} +AccessLogClear = Καθαρισμός {{ tr "debug.AccessLog" }} [user.connections] -Title = {{tr "nav.User"}} Συνδέσεις \ No newline at end of file +Title = {{ tr "nav.User" }} Συνδέσεις \ No newline at end of file diff --git a/_examples/i18n/template-embedded/embedded/locales/el-GR/user.ini b/_examples/i18n/template-embedded/embedded/locales/el-GR/user.ini index 0a110cdc6..3a6c6409d 100644 --- a/_examples/i18n/template-embedded/embedded/locales/el-GR/user.ini +++ b/_examples/i18n/template-embedded/embedded/locales/el-GR/user.ini @@ -1,4 +1,4 @@ [forms] member = μέλος -register = Γίνε {{uppercase (tr "forms.member") }} +register = Γίνε {{ uppercase (tr "forms.member") }} registered = εγγεγραμμένοι \ No newline at end of file diff --git a/_examples/i18n/template-embedded/embedded/locales/en-US/other.ini b/_examples/i18n/template-embedded/embedded/locales/en-US/other.ini index 31f1b1826..f8c753365 100644 --- a/_examples/i18n/template-embedded/embedded/locales/en-US/other.ini +++ b/_examples/i18n/template-embedded/embedded/locales/en-US/other.ini @@ -6,7 +6,7 @@ User = Account [debug] Title = Developer Menu AccessLog = Access Log -AccessLogClear = Clear {{tr "debug.AccessLog"}} +AccessLogClear = Clear {{ tr "debug.AccessLog" }} [user.connections] -Title = {{tr "nav.User"}} Connections \ No newline at end of file +Title = {{ tr "nav.User" }} Connections \ No newline at end of file diff --git a/_examples/i18n/template-embedded/embedded/locales/en-US/user.ini b/_examples/i18n/template-embedded/embedded/locales/en-US/user.ini index 09d3e3e4a..2498d029c 100644 --- a/_examples/i18n/template-embedded/embedded/locales/en-US/user.ini +++ b/_examples/i18n/template-embedded/embedded/locales/en-US/user.ini @@ -1,4 +1,4 @@ [forms] member = member -register = Become a {{uppercase (tr "forms.member") }} +register = Become a {{ uppercase (tr "forms.member") }} registered = registered \ No newline at end of file diff --git a/_examples/i18n/template-embedded/main.go b/_examples/i18n/template-embedded/main.go index bf8f83598..ff142ace2 100644 --- a/_examples/i18n/template-embedded/main.go +++ b/_examples/i18n/template-embedded/main.go @@ -13,6 +13,16 @@ var embeddedFS embed.FS func main() { app := newApp() + // http://localhost:8080 + // http://localhost:8080?lang=el + // http://localhost:8080?lang=el + // http://localhost:8080?lang=el-GR + // http://localhost:8080?lang=en + // http://localhost:8080?lang=en-US + // + // http://localhost:8080/title + // http://localhost:8080/title?lang=el-GR + // ... app.Listen(":8080") } @@ -30,11 +40,14 @@ func newApp() *iris.Application { // Instead of: // err := app.I18n.Load("./locales/*/*.ini", "en-US", "el-GR") - // Apply the below in order to build with embedded locales inside your executable binary. + // apply the below in order to build with embedded locales inside your executable binary. err := app.I18n.LoadFS(embeddedFS, "./embedded/locales/*/*.ini", "en-US", "el-GR") if err != nil { panic(err) - } + } // OR to load all languages by filename: + // app.I18n.LoadFS(embeddedFS, "./embedded/locales/*/*.ini") + // Then set the default language using: + // app.I18n.SetDefault("en-US") app.Get("/", func(ctx iris.Context) { text := ctx.Tr("forms.register") // en-US: prints "Become a MEMBER". diff --git a/i18n/i18n.go b/i18n/i18n.go index 514aec48c..b42a9867f 100644 --- a/i18n/i18n.go +++ b/i18n/i18n.go @@ -141,8 +141,8 @@ func (i *I18n) LoadAssets(assetNames func() []string, asset func(string) ([]byte return i.Reset(Assets(assetNames, asset, i.Loader), languages...) } -// LoadFS is a method shortcut to load files using `embed.FS` or `fs.FS` or -// `http.FileSystem` or `string` (local directory). +// LoadFS is a method shortcut to load files using +// an `embed.FS` or `fs.FS` or `http.FileSystem` value. // The "pattern" is a classic glob pattern. // // See `New` and `FS` package-level functions for more. @@ -156,6 +156,13 @@ func (i *I18n) LoadFS(fileSystem fs.FS, pattern string, languages ...string) err return i.Reset(loader, languages...) } +// LoadKV is a method shortcut to load locales from a map of specified languages. +// See `KV` package-level function for more. +func (i *I18n) LoadKV(langMap LangMap, languages ...string) error { + loader := KV(langMap, i.Loader) + return i.Reset(loader, languages...) +} + // Reset sets the locales loader and languages. // It is not meant to be used by users unless // a custom `Loader` must be used instead of the default one. @@ -300,6 +307,16 @@ func parsePath(m *Matcher, path string) int { return -1 } +func parseLanguageName(m *Matcher, name string) int { + if t, err := language.Parse(name); err == nil { + if _, index, conf := m.MatchOrAdd(t); conf > language.Low { + return index + } + } + + return -1 +} + func reverseStrings(s []string) []string { for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { s[i], s[j] = s[j], s[i] diff --git a/i18n/internal/catalog.go b/i18n/internal/catalog.go index 01e12b17a..26f551fc3 100644 --- a/i18n/internal/catalog.go +++ b/i18n/internal/catalog.go @@ -5,6 +5,7 @@ import ( "text/template" "github.com/kataras/iris/v12/context" + "golang.org/x/text/language" "golang.org/x/text/message" "golang.org/x/text/message/catalog" diff --git a/i18n/loader.go b/i18n/loader.go index e418e22b8..081e5e286 100644 --- a/i18n/loader.go +++ b/i18n/loader.go @@ -73,6 +73,70 @@ func FS(fileSystem fs.FS, pattern string, options LoaderConfig) (Loader, error) return load(assetNames, assetFunc, options), nil } +// LangMap key as language (e.g. "el-GR") and value as a map of key-value pairs (e.g. "hello": "Γειά"). +type LangMap = map[string]map[string]interface{} + +// KV is a loader which accepts a map of language(key) and the available key-value pairs. +// Example Code: +// +// m := i18n.LangMap{ +// "en-US": map[string]interface{}{ +// "hello": "Hello", +// }, +// "el-GR": map[string]interface{}{ +// "hello": "Γειά", +// }, +// } +// +// app := iris.New() +// [...] +// app.I18N.LoadKV(m) +// app.I18N.SetDefault("en-US") +func KV(langMap LangMap, opts ...LoaderConfig) Loader { + return func(m *Matcher) (Localizer, error) { + options := DefaultLoaderConfig + if len(opts) > 0 { + options = opts[0] + } + + languageIndexes := make([]int, 0, len(langMap)) + keyValuesMulti := make([]map[string]interface{}, 0, len(langMap)) + + for languageName, pairs := range langMap { + langIndex := parseLanguageName(m, languageName) // matches and adds the language tag to m.Languages. + languageIndexes = append(languageIndexes, langIndex) + keyValuesMulti = append(keyValuesMulti, pairs) + } + + cat, err := internal.NewCatalog(m.Languages, options) + if err != nil { + return nil, err + } + + for _, langIndex := range languageIndexes { + if langIndex == -1 { + // If loader has more languages than defined for use in New function, + // e.g. when New(KV(m), "en-US") contains el-GR and en-US but only "en-US" passed. + continue + } + + kv := keyValuesMulti[langIndex] + err := cat.Store(langIndex, kv) + if err != nil { + return nil, err + } + } + + if n := len(cat.Locales); n == 0 { + return nil, fmt.Errorf("locales not found in map") + } else if options.Strict && n < len(m.Languages) { + return nil, fmt.Errorf("locales expected to be %d but %d parsed", len(m.Languages), n) + } + + return cat, nil + } +} + // DefaultLoaderConfig represents the default loader configuration. var DefaultLoaderConfig = LoaderConfig{ Left: "{{", @@ -88,7 +152,7 @@ var DefaultLoaderConfig = LoaderConfig{ // and any Loader options. // It returns a valid `Loader` which loads and maps the locale files. // -// See `Glob`, `Assets` and `LoaderConfig` too. +// See `FS`, `Glob`, `Assets` and `LoaderConfig` too. func load(assetNames []string, asset func(string) ([]byte, error), options LoaderConfig) Loader { return func(m *Matcher) (Localizer, error) { languageFiles, err := m.ParseLanguageFiles(assetNames) From 34387a4a5c294ec80cf58d45c267f2b481a37461 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sun, 19 Mar 2023 16:31:14 +0200 Subject: [PATCH 08/63] New mvc.IgnoreEmbedded option to solve #2103 --- HISTORY.md | 30 +++++++++++++ README_ZH_HANS.md | 2 +- _examples/mvc/middleware/main.go | 2 +- mvc/controller.go | 73 +++++++++++++++++++++++++++++++- mvc/controller_method_parser.go | 24 +++++++++++ mvc/mvc.go | 7 +++ 6 files changed, 135 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 21cfeac95..f8d75312c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -23,6 +23,36 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene Change applies to `master` branch. +- Add `mvc.IgnoreEmbedded` option to handle [#2103](https://github.com/kataras/iris/issues/2103). Example Code: + +```go +func configure(m *mvc.Application) { + m.Router.Use(cacheHandler) + m.Handle(&exampleController{ + timeFormat: "Mon, Jan 02 2006 15:04:05", + }, mvc.IgnoreEmbedded /* BaseController.GetDoSomething will not be parsed at all */) +} + +type BaseController struct { + Ctx iris.Context +} + +func (c *BaseController) GetDoSomething(i interface{}) error { + return nil +} + +type exampleController struct { + BaseController + + timeFormat string +} + +func (c *exampleController) Get() string { + now := time.Now().Format(c.timeFormat) + return "last time executed without cache: " + now +} +``` + - Add `LoadKV` method on `Iris.Application.I18N` instance. It should be used when no locale files are available. It loads locales via pure Go Map (or database decoded values). - Remove [ace](https://github.com/eknkc/amber) template parser support, as it was discontinued by its author more than five years ago. diff --git a/README_ZH_HANS.md b/README_ZH_HANS.md index 6e6374a43..7bb889504 100644 --- a/README_ZH_HANS.md +++ b/README_ZH_HANS.md @@ -179,7 +179,7 @@ http://localhost:8080/books -[![run in the browser](https://img.shields.io/badge/Run-in%20the%20Browser-348798.svg?style=for-the-badge&logo=repl.it)](https://bit.ly/2YJeSZe) +[![run in the browser](https://img.shields.io/badge/Run-in%20the%20Browser-348798.svg?style=for-the-badge&logo=repl.it)](https://replit.com/@kataras/Iris-Hello-World-v1220?v=1) Iris 有完整且详尽的 **[使用文档](https://www.iris-go.com/#ebookDonateForm)** ,让您可以轻松地使用此框架。 diff --git a/_examples/mvc/middleware/main.go b/_examples/mvc/middleware/main.go index 6cd4e53c3..230079ab7 100644 --- a/_examples/mvc/middleware/main.go +++ b/_examples/mvc/middleware/main.go @@ -29,7 +29,7 @@ func configure(m *mvc.Application) { m.Router.Use(cacheHandler) m.Handle(&exampleController{ timeFormat: "Mon, Jan 02 2006 15:04:05", - }) + } /* ,mvc.IgnoreEmbedded --- Can be used to ignore any embedded struct method handlers */) } type exampleController struct { diff --git a/mvc/controller.go b/mvc/controller.go index 30d3d2842..98c9e7696 100644 --- a/mvc/controller.go +++ b/mvc/controller.go @@ -60,6 +60,15 @@ var ( _ AfterActivation = (*ControllerActivator)(nil) ) +// IgnoreEmbeddedControllers is a global variable which indicates whether +// the controller's method parser should skip converting embedded struct's methods to http handlers. +// +// If no global use is necessary, developers can do the same for individual controllers +// through the `IgnoreEmbedded` Controller Option on `mvc.Application.Handle` method. +// +// Defaults to false. +var IgnoreEmbeddedControllers = false + // ControllerActivator returns a new controller type info description. // Its functionality can be overridden by the end-dev. type ControllerActivator struct { @@ -78,6 +87,8 @@ type ControllerActivator struct { // End-devs can change some properties of the *Route on the `BeforeActivator` by using the // `GetRoute/GetRoutes(functionName)`. routes map[string][]*router.Route + + skipMethodNames []string // BeginHandlers is a slice of middleware for this controller. // These handlers will be prependend to each one of // the route that this controller will register(Handle/HandleMany/struct methods) @@ -114,7 +125,6 @@ func newControllerActivator(app *Application, controller interface{}) *Controlle } typ := reflect.TypeOf(controller) - c := &ControllerActivator{ // give access to the Router to the end-devs if they need it for some reason, // i.e register done handlers. @@ -132,6 +142,10 @@ func newControllerActivator(app *Application, controller interface{}) *Controlle routes: whatReservedMethods(typ), } + if IgnoreEmbeddedControllers { + c.SkipEmbeddedMethods() + } + return c } @@ -157,6 +171,43 @@ func whatReservedMethods(typ reflect.Type) map[string][]*router.Route { return routes } +func whatEmbeddedMethods(typ reflect.Type) []string { + var embeddedMethodsToIgnore []string + controllerType := typ + if controllerType.Kind() == reflect.Ptr { + controllerType = controllerType.Elem() + } + + for i := 0; i < controllerType.NumField(); i++ { + structField := controllerType.Field(i) + structType := structField.Type + + if !structField.Anonymous { + continue + } + + // var structValuePtr reflect.Value + + if structType.Kind() == reflect.Ptr { + // keep both ptr and value instances of the struct so we can ignore all of its methods. + structType = structType.Elem() + // structValuePtr = reflect.ValueOf(reflect.ValueOf(controller).Field(i)) + } + + if structType.Kind() != reflect.Struct { + continue + } + + newEmbeddedStructType := reflect.New(structField.Type).Type() + // let's take its methods and add to methods to ignore from the parent, the controller itself. + for j := 0; j < newEmbeddedStructType.NumMethod(); j++ { + embeddedMethodName := newEmbeddedStructType.Method(j).Name + embeddedMethodsToIgnore = append(embeddedMethodsToIgnore, embeddedMethodName) + } + } + return embeddedMethodsToIgnore +} + // Name returns the full name of the controller, its package name + the type name. // Can used at both `BeforeActivation` and `AfterActivation`. func (c *ControllerActivator) Name() string { @@ -168,6 +219,20 @@ func (c *ControllerActivator) RelName() string { return strings.TrimPrefix(c.fullName, "main.") } +// SkipMethods can be used to individually skip one or more controller's method handlers. +func (c *ControllerActivator) SkipMethods(methodNames ...string) { + c.skipMethodNames = append(c.skipMethodNames, methodNames...) +} + +// SkipEmbeddedMethods should be ran before controller parsing. +// It skips all embedded struct's methods conversation to http handlers. +// +// See https://github.com/kataras/iris/issues/2103 for more. +func (c *ControllerActivator) SkipEmbeddedMethods() { + methodsToIgnore := whatEmbeddedMethods(c.Type) + c.SkipMethods(methodsToIgnore...) +} + // Router is the standard Iris router's public API. // With this you can register middleware, view layouts, subdomains, serve static files // and even add custom standard iris handlers as normally. @@ -259,6 +324,12 @@ func (c *ControllerActivator) isReservedMethod(name string) bool { } } + for _, methodName := range c.skipMethodNames { + if methodName == name { + return true + } + } + return false } diff --git a/mvc/controller_method_parser.go b/mvc/controller_method_parser.go index 24e927265..dd8df5a73 100644 --- a/mvc/controller_method_parser.go +++ b/mvc/controller_method_parser.go @@ -29,6 +29,13 @@ func newMethodLexer(s string) *methodLexer { return l } +/* +var allowedCapitalWords = map[string]struct{}{ + "ID": {}, + "JSON": {}, +} +*/ + func (l *methodLexer) reset(s string) { l.cur = -1 var words []string @@ -36,14 +43,31 @@ func (l *methodLexer) reset(s string) { end := len(s) start := -1 + // outter: for i, n := 0, end; i < n; i++ { c := rune(s[i]) if unicode.IsUpper(c) { // it doesn't count the last uppercase if start != -1 { + /* + for allowedCapitalWord := range allowedCapitalWords { + capitalWordEnd := i + len(allowedCapitalWord) // takes last char too, e.g. ReadJSON, we need the JSON. + if len(s) >= capitalWordEnd { + word := s[i:capitalWordEnd] + if word == allowedCapitalWord { + words = append(words, word) + i = capitalWordEnd + start = i + continue outter + } + } + } + */ + end = i words = append(words, s[start:end]) } + start = i continue } diff --git a/mvc/mvc.go b/mvc/mvc.go index 9fd1a9810..bd96076d3 100644 --- a/mvc/mvc.go +++ b/mvc/mvc.go @@ -196,6 +196,13 @@ func (opt OptionFunc) Apply(c *ControllerActivator) { opt(c) } +// IgnoreEmbedded is an Option which can be used to ignore all embedded struct's method handlers. +// +// For global affect, set the `IgnoreEmbeddedControllers` package-level variable to true. +var IgnoreEmbedded OptionFunc = func(c *ControllerActivator) { + c.SkipEmbeddedMethods() +} + // Handle serves a controller for the current mvc application's Router. // It accept any custom struct which its functions will be transformed // to routes. From 3a00e785ea465fa2e847ba02082de895cb7212e8 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Mon, 20 Mar 2023 18:16:35 +0200 Subject: [PATCH 09/63] fix #2098 --- HISTORY.md | 2 ++ NOTICE | 8 ++++---- context/context.go | 19 +++++++++++++++---- go.mod | 7 ++++--- go.sum | 12 ++++++------ mvc/controller.go | 25 ++++++++++++++++++++++++- mvc/mvc.go | 3 ++- 7 files changed, 57 insertions(+), 19 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index f8d75312c..a5208b96c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -23,6 +23,8 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene Change applies to `master` branch. +- Replace [russross/blackfriday](github.com/russross/blackfriday/v2) with [gomarkdown](https://github.com/gomarkdown/markdown) as requested at [#2098](https://github.com/kataras/iris/issues/2098). + - Add `mvc.IgnoreEmbedded` option to handle [#2103](https://github.com/kataras/iris/issues/2103). Example Code: ```go diff --git a/NOTICE b/NOTICE index 44bfc0ff0..9815d87a3 100644 --- a/NOTICE +++ b/NOTICE @@ -19,10 +19,10 @@ Revision ID: 5fc50a00491616d5cd0cbce3abd8b699838e25ca 4e134eadfa bbolt a8af23b57f672fe https://github.com/etcd-io/bbolt f05637de531bba5 - aa00013364 - blackfriday d3b5b032dc8e892 https://github.com/russross/blackfriday - 7d31a5071b56e14 - c89f045135 + aa00013364 + markdown 2ced44d5b58482a https://github.com/gomarkdown/markdown + 9b77d1abad4c3d3 + 4b190880fe bluemonday 0a75d7616912ab9 https://github.com/microcosm-cc/bluemonday beb9cc6f7283ec1 917c61b135 diff --git a/context/context.go b/context/context.go index 624565030..7492e008a 100644 --- a/context/context.go +++ b/context/context.go @@ -30,11 +30,12 @@ import ( "github.com/Shopify/goreferrer" "github.com/fatih/structs" + "github.com/gomarkdown/markdown" + "github.com/gomarkdown/markdown/html" "github.com/iris-contrib/schema" "github.com/mailru/easyjson" "github.com/mailru/easyjson/jwriter" "github.com/microcosm-cc/bluemonday" - "github.com/russross/blackfriday/v2" "github.com/vmihailenco/msgpack/v5" "golang.org/x/net/publicsuffix" "golang.org/x/time/rate" @@ -4033,6 +4034,10 @@ type Markdown struct { // content-specific Sanitize bool OmitErrorHandler bool // See JSON.OmitErrorHandler. + // + // Library-specific. + // E.g. Flags: html.CommonFlags | html.HrefTargetBlank + RenderOptions html.RendererOptions } var ( @@ -4460,14 +4465,20 @@ func (ctx *Context) Problem(v interface{}, opts ...ProblemOptions) error { return ctx.writeJSON(v, &options.JSON) } +var sanitizer = bluemonday.UGCPolicy() + // WriteMarkdown parses the markdown to html and writes these contents to the writer. var WriteMarkdown = func(ctx *Context, markdownB []byte, options *Markdown) error { - buf := blackfriday.Run(markdownB) + out := markdown.NormalizeNewlines(markdownB) + + renderer := html.NewRenderer(options.RenderOptions) + doc := markdown.Parse(out, nil) + out = markdown.Render(doc, renderer) if options.Sanitize { - buf = bluemonday.UGCPolicy().SanitizeBytes(buf) + out = sanitizer.SanitizeBytes(out) } - _, err := ctx.Write(buf) + _, err := ctx.Write(out) return err } diff --git a/go.mod b/go.mod index b279310a1..57a7e2835 100644 --- a/go.mod +++ b/go.mod @@ -15,6 +15,7 @@ require ( github.com/fatih/structs v1.1.0 github.com/flosch/pongo2/v4 v4.0.2 github.com/golang/snappy v0.0.4 + github.com/gomarkdown/markdown v0.0.0-20230313173142-2ced44d5b584 github.com/google/uuid v1.3.0 github.com/gorilla/securecookie v1.1.1 github.com/iris-contrib/httpexpect/v2 v2.12.1 @@ -32,7 +33,6 @@ require ( github.com/mailru/easyjson v0.7.7 github.com/microcosm-cc/bluemonday v1.0.23 github.com/redis/go-redis/v9 v9.0.2 - github.com/russross/blackfriday/v2 v2.1.0 github.com/schollz/closestmatch v2.1.0+incompatible github.com/shirou/gopsutil/v3 v3.23.2 github.com/tdewolff/minify/v2 v2.12.5 @@ -78,14 +78,15 @@ require ( github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/nats-io/jwt/v2 v2.3.0 // indirect + github.com/nats-io/jwt/v2 v2.4.0 // indirect github.com/nats-io/nats.go v1.23.0 // indirect - github.com/nats-io/nkeys v0.3.0 // indirect + github.com/nats-io/nkeys v0.4.4 // indirect github.com/nats-io/nuid v1.0.1 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/pkg/errors v0.8.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sanity-io/litter v1.5.5 // indirect github.com/sergi/go-diff v1.0.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect diff --git a/go.sum b/go.sum index a4e63bb66..f3ce351fd 100644 --- a/go.sum +++ b/go.sum @@ -72,6 +72,8 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomarkdown/markdown v0.0.0-20230313173142-2ced44d5b584 h1:XaUmlCIi5hEY5GPUV6oXc5eytg9+FBH9/9fOKblHWEU= +github.com/gomarkdown/markdown v0.0.0-20230313173142-2ced44d5b584/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -149,13 +151,13 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OH github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/nats-io/jwt/v2 v2.3.0 h1:z2mA1a7tIf5ShggOFlR1oBPgd6hGqcDYsISxZByUzdI= -github.com/nats-io/jwt/v2 v2.3.0/go.mod h1:0tqz9Hlu6bCBFLWAASKhE5vUA4c24L9KPUUgvwumE/k= +github.com/nats-io/jwt/v2 v2.4.0 h1:1woVcq37qhNwJOeZ4ZoRy5NJU5bvbtGsIammf2GpuJQ= +github.com/nats-io/jwt/v2 v2.4.0/go.mod h1:24BeQtRwxRV8ruvC4CojXlx/WQ/VjuwlYiH+vu/+ibI= github.com/nats-io/nats-server/v2 v2.9.11 h1:4y5SwWvWI59V5mcqtuoqKq6L9NDUydOP3Ekwuwl8cZI= github.com/nats-io/nats.go v1.23.0 h1:lR28r7IX44WjYgdiKz9GmUeW0uh/m33uD3yEjLZ2cOE= github.com/nats-io/nats.go v1.23.0/go.mod h1:ki/Scsa23edbh8IRZbCuNXR9TDcbvfaSijKtaqQgw+Q= -github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8= -github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= +github.com/nats-io/nkeys v0.4.4 h1:xvBJ8d69TznjcQl9t6//Q5xXuVhyYiSos6RPtvQNTwA= +github.com/nats-io/nkeys v0.4.4/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= @@ -254,7 +256,6 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -264,7 +265,6 @@ golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= diff --git a/mvc/controller.go b/mvc/controller.go index 98c9e7696..46630a701 100644 --- a/mvc/controller.go +++ b/mvc/controller.go @@ -201,10 +201,30 @@ func whatEmbeddedMethods(typ reflect.Type) []string { newEmbeddedStructType := reflect.New(structField.Type).Type() // let's take its methods and add to methods to ignore from the parent, the controller itself. for j := 0; j < newEmbeddedStructType.NumMethod(); j++ { - embeddedMethodName := newEmbeddedStructType.Method(j).Name + embeddedMethod := newEmbeddedStructType.Method(j) + embeddedMethodName := embeddedMethod.Name + // An exception should happen if the controller itself overrides the embedded method, + // but Go (1.20) so far doesn't support this detection, as it handles the structure as one. + /* + shouldKeepBecauseParentOverrides := false + + if v, existsOnParent := typ.MethodByName(embeddedMethodName); existsOnParent { + + embeddedIndex := newEmbeddedStructType.Method(j).Index + controllerMethodIndex := v.Index + + if v.Type.In(0) == typ && embeddedIndex == controllerMethodIndex { + fmt.Printf("%s exists on parent = true, receiver = %s\n", v.Name, typ.String()) + shouldKeepBecauseParentOverrides = true + continue + } + } + */ + embeddedMethodsToIgnore = append(embeddedMethodsToIgnore, embeddedMethodName) } } + return embeddedMethodsToIgnore } @@ -227,6 +247,9 @@ func (c *ControllerActivator) SkipMethods(methodNames ...string) { // SkipEmbeddedMethods should be ran before controller parsing. // It skips all embedded struct's methods conversation to http handlers. // +// Note that even if the controller overrides the embedded methods +// they will be still ignored because Go doesn't support this detection so far. +// // See https://github.com/kataras/iris/issues/2103 for more. func (c *ControllerActivator) SkipEmbeddedMethods() { methodsToIgnore := whatEmbeddedMethods(c.Type) diff --git a/mvc/mvc.go b/mvc/mvc.go index bd96076d3..3ae2e80e6 100644 --- a/mvc/mvc.go +++ b/mvc/mvc.go @@ -197,7 +197,8 @@ func (opt OptionFunc) Apply(c *ControllerActivator) { } // IgnoreEmbedded is an Option which can be used to ignore all embedded struct's method handlers. -// +// Note that even if the controller overrides the embedded methods +// they will be still ignored because Go doesn't support this detection so far. // For global affect, set the `IgnoreEmbeddedControllers` package-level variable to true. var IgnoreEmbedded OptionFunc = func(c *ControllerActivator) { c.SkipEmbeddedMethods() From a574579d9c8868be8ecc51c917b133f8e6e37d65 Mon Sep 17 00:00:00 2001 From: Jiachen Date: Thu, 30 Mar 2023 00:47:32 +0800 Subject: [PATCH 10/63] Fix typo in comment (#2107) Signed-off-by: Jiachen --- _examples/mvc/error-handler-preflight/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_examples/mvc/error-handler-preflight/main.go b/_examples/mvc/error-handler-preflight/main.go index e25ab5e2d..71359c7b8 100644 --- a/_examples/mvc/error-handler-preflight/main.go +++ b/_examples/mvc/error-handler-preflight/main.go @@ -35,7 +35,7 @@ func (r *response) Preflight(ctx iris.Context) error { } if code := r.Code; code > 0 { - // You can call ctx.View or mvc.Vew{...}.Dispatch + // You can call ctx.View or mvc.View{...}.Dispatch // to render HTML on Code != 200 // but in order to not proceed with the response resulting // as JSON you MUST return the iris.ErrStopExecution error. From 1467a3c062a0c005e13a4eff5be5d94f4f26fcca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 19:00:27 +0300 Subject: [PATCH 11/63] Bump github.com/redis/go-redis/v9 from 9.0.2 to 9.0.3 (#2111) Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.0.2 to 9.0.3. - [Release notes](https://github.com/redis/go-redis/releases) - [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/go-redis/compare/v9.0.2...v9.0.3) --- updated-dependencies: - dependency-name: github.com/redis/go-redis/v9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 57a7e2835..825959d9d 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/mailgun/raymond/v2 v2.0.48 github.com/mailru/easyjson v0.7.7 github.com/microcosm-cc/bluemonday v1.0.23 - github.com/redis/go-redis/v9 v9.0.2 + github.com/redis/go-redis/v9 v9.0.3 github.com/schollz/closestmatch v2.1.0+incompatible github.com/shirou/gopsutil/v3 v3.23.2 github.com/tdewolff/minify/v2 v2.12.5 diff --git a/go.sum b/go.sum index f3ce351fd..dbe25c616 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= -github.com/bsm/ginkgo/v2 v2.5.0 h1:aOAnND1T40wEdAtkGSkvSICWeQ8L3UASX7YVCqQx+eQ= -github.com/bsm/gomega v1.20.0 h1:JhAwLmtRzXFTx2AkALSLa8ijZafntmhSoU63Ok18Uq8= +github.com/bsm/ginkgo/v2 v2.7.0 h1:ItPMPH90RbmZJt5GtkcNvIRuGEdwlBItdNVoyzaNQao= +github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= @@ -174,8 +174,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/redis/go-redis/v9 v9.0.2 h1:BA426Zqe/7r56kCcvxYLWe1mkaz71LKF77GwgFzSxfE= -github.com/redis/go-redis/v9 v9.0.2/go.mod h1:/xDTe9EF1LM61hek62Poq2nzQSGj0xSrEtEHbBQevps= +github.com/redis/go-redis/v9 v9.0.3 h1:+7mmR26M0IvyLxGZUHxu4GiBkJkVDid0Un+j4ScYu4k= +github.com/redis/go-redis/v9 v9.0.3/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= From de12934e338c5bf9189d5aac3268b17f817a82de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 19:00:44 +0300 Subject: [PATCH 12/63] Bump github.com/shirou/gopsutil/v3 from 3.23.2 to 3.23.3 (#2112) Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.2 to 3.23.3. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v3.23.2...v3.23.3) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 3 ++- go.sum | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 825959d9d..43b5f3098 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( github.com/microcosm-cc/bluemonday v1.0.23 github.com/redis/go-redis/v9 v9.0.3 github.com/schollz/closestmatch v2.1.0+incompatible - github.com/shirou/gopsutil/v3 v3.23.2 + github.com/shirou/gopsutil/v3 v3.23.3 github.com/tdewolff/minify/v2 v2.12.5 github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 @@ -89,6 +89,7 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sanity-io/litter v1.5.5 // indirect github.com/sergi/go-diff v1.0.0 // indirect + github.com/shoenig/go-m1cpu v0.1.4 // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/stretchr/testify v1.8.2 // indirect github.com/tdewolff/parse/v2 v2.6.5 // indirect diff --git a/go.sum b/go.sum index dbe25c616..ec87933d9 100644 --- a/go.sum +++ b/go.sum @@ -185,8 +185,12 @@ github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiy github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil/v3 v3.23.2 h1:PAWSuiAszn7IhPMBtXsbSCafej7PqUOvY6YywlQUExU= -github.com/shirou/gopsutil/v3 v3.23.2/go.mod h1:gv0aQw33GLo3pG8SiWKiQrbDzbRY1K80RyZJ7V4Th1M= +github.com/shirou/gopsutil/v3 v3.23.3 h1:Syt5vVZXUDXPEXpIBt5ziWsJ4LdSAAxF4l/xZeQgSEE= +github.com/shirou/gopsutil/v3 v3.23.3/go.mod h1:lSBNN6t3+D6W5e5nXTxc8KIMMVxAcS+6IJlffjRRlMU= +github.com/shoenig/go-m1cpu v0.1.4 h1:SZPIgRM2sEF9NJy50mRHu9PKGwxyyTTJIWvCtgVbozs= +github.com/shoenig/go-m1cpu v0.1.4/go.mod h1:Wwvst4LR89UxjeFtLRMrpgRiyY4xPsejnVZym39dbAQ= +github.com/shoenig/test v0.6.3 h1:GVXWJFk9PiOjN0KoJ7VrJGH6uLPnqxR7/fe3HUPfE0c= +github.com/shoenig/test v0.6.3/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -289,7 +293,6 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From 655a92261bf4318114abdd92778d672a4f9ff4d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Apr 2023 14:48:13 +0300 Subject: [PATCH 13/63] Bump golang.org/x/sys from 0.6.0 to 0.7.0 (#2113) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.6.0 to 0.7.0. - [Release notes](https://github.com/golang/sys/releases) - [Commits](https://github.com/golang/sys/compare/v0.6.0...v0.7.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 43b5f3098..422bd22b5 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( go.etcd.io/bbolt v1.3.7 golang.org/x/crypto v0.7.0 golang.org/x/net v0.8.0 - golang.org/x/sys v0.6.0 + golang.org/x/sys v0.7.0 golang.org/x/text v0.8.0 golang.org/x/time v0.3.0 google.golang.org/protobuf v1.30.0 diff --git a/go.sum b/go.sum index ec87933d9..aec6d268e 100644 --- a/go.sum +++ b/go.sum @@ -293,8 +293,9 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From 038d92c90170a9b1af1c95a28e02b664eefd8d27 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Apr 2023 15:45:22 +0300 Subject: [PATCH 14/63] Bump github.com/klauspost/compress from 1.16.3 to 1.16.4 (#2114) Bumps [github.com/klauspost/compress](https://github.com/klauspost/compress) from 1.16.3 to 1.16.4. - [Release notes](https://github.com/klauspost/compress/releases) - [Changelog](https://github.com/klauspost/compress/blob/master/.goreleaser.yml) - [Commits](https://github.com/klauspost/compress/compare/v1.16.3...v1.16.4) --- updated-dependencies: - dependency-name: github.com/klauspost/compress dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 422bd22b5..c5452e228 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/kataras/pio v0.0.11 github.com/kataras/sitemap v0.0.6 github.com/kataras/tunnel v0.0.4 - github.com/klauspost/compress v1.16.3 + github.com/klauspost/compress v1.16.4 github.com/mailgun/raymond/v2 v2.0.48 github.com/mailru/easyjson v0.7.7 github.com/microcosm-cc/bluemonday v1.0.23 diff --git a/go.sum b/go.sum index aec6d268e..283f68995 100644 --- a/go.sum +++ b/go.sum @@ -119,8 +119,8 @@ github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIR github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= -github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.4 h1:91KN02FnsOYhuunwU4ssRe8lc2JosWmizWa91B5v1PU= +github.com/klauspost/compress v1.16.4/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= From ea814e35a27e9d1e8074c88d6aa807d0973f4751 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 12:54:06 +0300 Subject: [PATCH 15/63] Bump golang.org/x/net from 0.8.0 to 0.9.0 (#2115) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.8.0 to 0.9.0. - [Release notes](https://github.com/golang/net/releases) - [Commits](https://github.com/golang/net/compare/v0.8.0...v0.9.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index c5452e228..cac262a23 100644 --- a/go.mod +++ b/go.mod @@ -40,9 +40,9 @@ require ( github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 golang.org/x/crypto v0.7.0 - golang.org/x/net v0.8.0 + golang.org/x/net v0.9.0 golang.org/x/sys v0.7.0 - golang.org/x/text v0.8.0 + golang.org/x/text v0.9.0 golang.org/x/time v0.3.0 google.golang.org/protobuf v1.30.0 gopkg.in/ini.v1 v1.67.0 diff --git a/go.sum b/go.sum index 283f68995..33f405b1f 100644 --- a/go.sum +++ b/go.sum @@ -270,8 +270,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -301,8 +301,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From eff3f2d06999a2a4a17660486d44aba8c50a7e86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 12:54:20 +0300 Subject: [PATCH 16/63] Bump golang.org/x/text from 0.8.0 to 0.9.0 (#2116) Bumps [golang.org/x/text](https://github.com/golang/text) from 0.8.0 to 0.9.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.8.0...v0.9.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> From 67e81ce7d4e6c6d340b836311af5903f9df28cb4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 12:56:09 +0300 Subject: [PATCH 17/63] Bump golang.org/x/crypto from 0.7.0 to 0.8.0 (#2118) Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.7.0 to 0.8.0. - [Release notes](https://github.com/golang/crypto/releases) - [Commits](https://github.com/golang/crypto/compare/v0.7.0...v0.8.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cac262a23..b9f27f3db 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 - golang.org/x/crypto v0.7.0 + golang.org/x/crypto v0.8.0 golang.org/x/net v0.9.0 golang.org/x/sys v0.7.0 golang.org/x/text v0.9.0 diff --git a/go.sum b/go.sum index 33f405b1f..c1a292fbd 100644 --- a/go.sum +++ b/go.sum @@ -260,8 +260,8 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= From 1ee6e83ae6298f7b4bd19cea58c73e2c345750d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Apr 2023 23:45:51 +0300 Subject: [PATCH 18/63] Bump github.com/klauspost/compress from 1.16.4 to 1.16.5 (#2123) Bumps [github.com/klauspost/compress](https://github.com/klauspost/compress) from 1.16.4 to 1.16.5. - [Release notes](https://github.com/klauspost/compress/releases) - [Changelog](https://github.com/klauspost/compress/blob/master/.goreleaser.yml) - [Commits](https://github.com/klauspost/compress/compare/v1.16.4...v1.16.5) --- updated-dependencies: - dependency-name: github.com/klauspost/compress dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b9f27f3db..57548823d 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/kataras/pio v0.0.11 github.com/kataras/sitemap v0.0.6 github.com/kataras/tunnel v0.0.4 - github.com/klauspost/compress v1.16.4 + github.com/klauspost/compress v1.16.5 github.com/mailgun/raymond/v2 v2.0.48 github.com/mailru/easyjson v0.7.7 github.com/microcosm-cc/bluemonday v1.0.23 diff --git a/go.sum b/go.sum index c1a292fbd..dd0cdab2c 100644 --- a/go.sum +++ b/go.sum @@ -119,8 +119,8 @@ github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIR github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.16.4 h1:91KN02FnsOYhuunwU4ssRe8lc2JosWmizWa91B5v1PU= -github.com/klauspost/compress v1.16.4/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= +github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= From d2f24fab90a3b0adda9ba12fb54bb559566a0781 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Wed, 19 Apr 2023 23:56:55 +0300 Subject: [PATCH 19/63] fix an issue on accesslog when response and request recorder and minifier were enabled --- HISTORY.md | 4 +++- middleware/accesslog/accesslog.go | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index a5208b96c..9203a1370 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -21,7 +21,9 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene # Next -Change applies to `master` branch. +Changes apply to `master` branch. + +- Fix [iris-premium#17](https://github.com/kataras/iris-premium/issues/17). - Replace [russross/blackfriday](github.com/russross/blackfriday/v2) with [gomarkdown](https://github.com/gomarkdown/markdown) as requested at [#2098](https://github.com/kataras/iris/issues/2098). diff --git a/middleware/accesslog/accesslog.go b/middleware/accesslog/accesslog.go index 1320718cb..155f58c42 100644 --- a/middleware/accesslog/accesslog.go +++ b/middleware/accesslog/accesslog.go @@ -836,20 +836,27 @@ func (ac *AccessLog) after(ctx *context.Context, lat time.Duration, method, path } if ac.shouldReadResponseBody() { - responseData := ctx.Recorder().Body() - responseBodyLength := len(responseData) + actualResponseData := ctx.Recorder().Body() + responseBodyLength := len(actualResponseData) + if ac.BytesSentBody { bytesSent = responseBodyLength } if ac.ResponseBody && responseBodyLength > 0 { if ac.BodyMinify { + // Copy response data as minifier now can change the back slice, + // fixes: https://github.com/kataras/iris-premium/issues/17. + responseData := make([]byte, len(actualResponseData)) + copy(responseData, actualResponseData) + if minified, err := ctx.Application().Minifier().Bytes(ctx.GetContentType(), responseData); err == nil { responseBody = string(minified) + responseBodyLength = len(responseBody) } } if responseBody == "" { - responseBody = string(responseData) + responseBody = string(actualResponseData) } } From 58c9c7d0cb55941be949a999d64899f5c5d6cc8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 15:54:02 +0300 Subject: [PATCH 20/63] Bump github.com/shirou/gopsutil/v3 from 3.23.3 to 3.23.4 (#2126) Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.3 to 3.23.4. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v3.23.3...v3.23.4) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 57548823d..8e67f02c2 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( github.com/microcosm-cc/bluemonday v1.0.23 github.com/redis/go-redis/v9 v9.0.3 github.com/schollz/closestmatch v2.1.0+incompatible - github.com/shirou/gopsutil/v3 v3.23.3 + github.com/shirou/gopsutil/v3 v3.23.4 github.com/tdewolff/minify/v2 v2.12.5 github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 @@ -89,7 +89,7 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sanity-io/litter v1.5.5 // indirect github.com/sergi/go-diff v1.0.0 // indirect - github.com/shoenig/go-m1cpu v0.1.4 // indirect + github.com/shoenig/go-m1cpu v0.1.5 // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/stretchr/testify v1.8.2 // indirect github.com/tdewolff/parse/v2 v2.6.5 // indirect diff --git a/go.sum b/go.sum index dd0cdab2c..742b6a34b 100644 --- a/go.sum +++ b/go.sum @@ -185,10 +185,10 @@ github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiy github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil/v3 v3.23.3 h1:Syt5vVZXUDXPEXpIBt5ziWsJ4LdSAAxF4l/xZeQgSEE= -github.com/shirou/gopsutil/v3 v3.23.3/go.mod h1:lSBNN6t3+D6W5e5nXTxc8KIMMVxAcS+6IJlffjRRlMU= -github.com/shoenig/go-m1cpu v0.1.4 h1:SZPIgRM2sEF9NJy50mRHu9PKGwxyyTTJIWvCtgVbozs= -github.com/shoenig/go-m1cpu v0.1.4/go.mod h1:Wwvst4LR89UxjeFtLRMrpgRiyY4xPsejnVZym39dbAQ= +github.com/shirou/gopsutil/v3 v3.23.4 h1:hZwmDxZs7Ewt75DV81r4pFMqbq+di2cbt9FsQBqLD2o= +github.com/shirou/gopsutil/v3 v3.23.4/go.mod h1:ZcGxyfzAMRevhUR2+cfhXDH6gQdFYE/t8j1nsU4mPI8= +github.com/shoenig/go-m1cpu v0.1.5 h1:LF57Z/Fpb/WdGLjt2HZilNnmZOxg/q2bSKTQhgbrLrQ= +github.com/shoenig/go-m1cpu v0.1.5/go.mod h1:Wwvst4LR89UxjeFtLRMrpgRiyY4xPsejnVZym39dbAQ= github.com/shoenig/test v0.6.3 h1:GVXWJFk9PiOjN0KoJ7VrJGH6uLPnqxR7/fe3HUPfE0c= github.com/shoenig/test v0.6.3/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= @@ -293,7 +293,6 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From 12101dea1ad62703e4d4c1df9bbde5bcd3a4c420 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 May 2023 11:27:46 +0300 Subject: [PATCH 21/63] Bump github.com/redis/go-redis/v9 from 9.0.3 to 9.0.4 (#2127) Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.0.3 to 9.0.4. - [Release notes](https://github.com/redis/go-redis/releases) - [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/go-redis/compare/v9.0.3...v9.0.4) --- updated-dependencies: - dependency-name: github.com/redis/go-redis/v9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8e67f02c2..341750df3 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/mailgun/raymond/v2 v2.0.48 github.com/mailru/easyjson v0.7.7 github.com/microcosm-cc/bluemonday v1.0.23 - github.com/redis/go-redis/v9 v9.0.3 + github.com/redis/go-redis/v9 v9.0.4 github.com/schollz/closestmatch v2.1.0+incompatible github.com/shirou/gopsutil/v3 v3.23.4 github.com/tdewolff/minify/v2 v2.12.5 diff --git a/go.sum b/go.sum index 742b6a34b..1f8fff48c 100644 --- a/go.sum +++ b/go.sum @@ -174,8 +174,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/redis/go-redis/v9 v9.0.3 h1:+7mmR26M0IvyLxGZUHxu4GiBkJkVDid0Un+j4ScYu4k= -github.com/redis/go-redis/v9 v9.0.3/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= +github.com/redis/go-redis/v9 v9.0.4 h1:FC82T+CHJ/Q/PdyLW++GeCO+Ol59Y4T7R4jbgjvktgc= +github.com/redis/go-redis/v9 v9.0.4/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= From 29b7a862f9d7b3402d79bc2fbb9355a9281e5c01 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 7 May 2023 00:34:40 +0300 Subject: [PATCH 22/63] Bump golang.org/x/sys from 0.7.0 to 0.8.0 (#2128) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.7.0 to 0.8.0. - [Commits](https://github.com/golang/sys/compare/v0.7.0...v0.8.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 341750df3..739451e09 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( go.etcd.io/bbolt v1.3.7 golang.org/x/crypto v0.8.0 golang.org/x/net v0.9.0 - golang.org/x/sys v0.7.0 + golang.org/x/sys v0.8.0 golang.org/x/text v0.9.0 golang.org/x/time v0.3.0 google.golang.org/protobuf v1.30.0 diff --git a/go.sum b/go.sum index 1f8fff48c..b4fb6a766 100644 --- a/go.sum +++ b/go.sum @@ -293,8 +293,9 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From 58103e8394864d4c413ee0aeab8c57e8c066fe87 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 May 2023 00:37:57 +0300 Subject: [PATCH 23/63] Bump golang.org/x/net from 0.9.0 to 0.10.0 (#2130) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.9.0 to 0.10.0. - [Commits](https://github.com/golang/net/compare/v0.9.0...v0.10.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 739451e09..863c84272 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 golang.org/x/crypto v0.8.0 - golang.org/x/net v0.9.0 + golang.org/x/net v0.10.0 golang.org/x/sys v0.8.0 golang.org/x/text v0.9.0 golang.org/x/time v0.3.0 diff --git a/go.sum b/go.sum index b4fb6a766..d07d8f6a0 100644 --- a/go.sum +++ b/go.sum @@ -270,8 +270,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 67736edc155639cbd466dbda46b5ebb028539422 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 May 2023 02:00:20 +0300 Subject: [PATCH 24/63] Bump golang.org/x/crypto from 0.8.0 to 0.9.0 (#2133) Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.8.0 to 0.9.0. - [Commits](https://github.com/golang/crypto/compare/v0.8.0...v0.9.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 863c84272..a624ce6a4 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 - golang.org/x/crypto v0.8.0 + golang.org/x/crypto v0.9.0 golang.org/x/net v0.10.0 golang.org/x/sys v0.8.0 golang.org/x/text v0.9.0 diff --git a/go.sum b/go.sum index d07d8f6a0..9588c6332 100644 --- a/go.sum +++ b/go.sum @@ -260,8 +260,8 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= -golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= From e05582b8e0559c330c029ab38f3e129dc3bc2fb4 Mon Sep 17 00:00:00 2001 From: LeanDeR <34670582+auxpd@users.noreply.github.com> Date: Fri, 12 May 2023 07:01:57 +0800 Subject: [PATCH 25/63] fix(context.CookieAllowReclaim): Fix the issue with the context.CookieAllowReclaim method not working as expected when deleting cookies (#2136) When deleting cookies, if the cookie is the first element and there is no semicolon before the string, it prevents the matching of this cookie. Closes #2134 --- context/context.go | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/context/context.go b/context/context.go index 7492e008a..626a89b6c 100644 --- a/context/context.go +++ b/context/context.go @@ -5518,29 +5518,13 @@ func CookieAllowReclaim(cookieNames ...string) CookieOption { // perform upsert on request cookies or is it too much and not worth the cost? ctx.Request().AddCookie(c) case OpCookieDel: - header := ctx.Request().Header - - if cookiesLine := header.Get("Cookie"); cookiesLine != "" { - if cookies := strings.Split(cookiesLine, "; "); len(cookies) > 1 { - // more than one cookie here. - // select that one and remove it. - name := sanitizeCookieName(c.Name) - - for _, nameValue := range cookies { - if strings.HasPrefix(nameValue, name) { - cookiesLine = strings.Replace(cookiesLine, "; "+nameValue, "", 1) - // current cookiesLine: myapp_session_id=5ccf4e89-8d0e-4ed6-9f4c-6746d7c5e2ee; key1=value1 - // found nameValue: key1=value1 - // new cookiesLine: myapp_session_id=5ccf4e89-8d0e-4ed6-9f4c-6746d7c5e2ee - header.Set("Cookie", cookiesLine) - break - } - } - return + cookies := ctx.Request().Cookies() + ctx.Request().Header.Del("Cookie") + for i, v := range cookies { + if v.Name != c.Name { + ctx.Request().AddCookie(cookies[i]) } } - - header.Del("Cookie") } } } From 858136eafb4291b912b114dda76907ae32be8154 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 May 2023 15:05:43 +0300 Subject: [PATCH 26/63] Bump github.com/microcosm-cc/bluemonday from 1.0.23 to 1.0.24 (#2137) Bumps [github.com/microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday) from 1.0.23 to 1.0.24. - [Release notes](https://github.com/microcosm-cc/bluemonday/releases) - [Commits](https://github.com/microcosm-cc/bluemonday/compare/v1.0.23...v1.0.24) --- updated-dependencies: - dependency-name: github.com/microcosm-cc/bluemonday dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a624ce6a4..2db54e290 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/klauspost/compress v1.16.5 github.com/mailgun/raymond/v2 v2.0.48 github.com/mailru/easyjson v0.7.7 - github.com/microcosm-cc/bluemonday v1.0.23 + github.com/microcosm-cc/bluemonday v1.0.24 github.com/redis/go-redis/v9 v9.0.4 github.com/schollz/closestmatch v2.1.0+incompatible github.com/shirou/gopsutil/v3 v3.23.4 diff --git a/go.sum b/go.sum index 9588c6332..2d07c4c65 100644 --- a/go.sum +++ b/go.sum @@ -139,8 +139,8 @@ github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPn github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mediocregopher/radix/v3 v3.8.1 h1:rOkHflVuulFKlwsLY01/M2cM2tWCjDoETcMqKbAWu1M= github.com/mediocregopher/radix/v3 v3.8.1/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= -github.com/microcosm-cc/bluemonday v1.0.23 h1:SMZe2IGa0NuHvnVNAZ+6B38gsTbi5e4sViiWJyDDqFY= -github.com/microcosm-cc/bluemonday v1.0.23/go.mod h1:mN70sk7UkkF8TUr2IGBpNN0jAgStuPzlK76QuruE/z4= +github.com/microcosm-cc/bluemonday v1.0.24 h1:NGQoPtwGVcbGkKfvyYk1yRqknzBuoMiUrO6R7uFTPlw= +github.com/microcosm-cc/bluemonday v1.0.24/go.mod h1:ArQySAMps0790cHSkdPEJ7bGkF2VePWH773hsJNSHf8= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= From 98ef7cadcbad5dc764d1a41ed5fae9e6fd2dd991 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 May 2023 15:54:11 +0300 Subject: [PATCH 27/63] Bump github.com/redis/go-redis/v9 from 9.0.4 to 9.0.5 (#2142) Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.0.4 to 9.0.5. - [Release notes](https://github.com/redis/go-redis/releases) - [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/go-redis/compare/v9.0.4...v9.0.5) --- updated-dependencies: - dependency-name: github.com/redis/go-redis/v9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2db54e290..c1fa0d268 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/mailgun/raymond/v2 v2.0.48 github.com/mailru/easyjson v0.7.7 github.com/microcosm-cc/bluemonday v1.0.24 - github.com/redis/go-redis/v9 v9.0.4 + github.com/redis/go-redis/v9 v9.0.5 github.com/schollz/closestmatch v2.1.0+incompatible github.com/shirou/gopsutil/v3 v3.23.4 github.com/tdewolff/minify/v2 v2.12.5 diff --git a/go.sum b/go.sum index 2d07c4c65..b591d2388 100644 --- a/go.sum +++ b/go.sum @@ -174,8 +174,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/redis/go-redis/v9 v9.0.4 h1:FC82T+CHJ/Q/PdyLW++GeCO+Ol59Y4T7R4jbgjvktgc= -github.com/redis/go-redis/v9 v9.0.4/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= +github.com/redis/go-redis/v9 v9.0.5 h1:CuQcn5HIEeK7BgElubPP8CGtE0KakrnbBSTLjathl5o= +github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= From ea83e2b143c14da17c76c7137671e3076c984b0f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 May 2023 15:54:23 +0300 Subject: [PATCH 28/63] Bump github.com/tdewolff/minify/v2 from 2.12.5 to 2.12.6 (#2143) Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.12.5 to 2.12.6. - [Release notes](https://github.com/tdewolff/minify/releases) - [Commits](https://github.com/tdewolff/minify/compare/v2.12.5...v2.12.6) --- updated-dependencies: - dependency-name: github.com/tdewolff/minify/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index c1fa0d268..39e8fba57 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/redis/go-redis/v9 v9.0.5 github.com/schollz/closestmatch v2.1.0+incompatible github.com/shirou/gopsutil/v3 v3.23.4 - github.com/tdewolff/minify/v2 v2.12.5 + github.com/tdewolff/minify/v2 v2.12.6 github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 @@ -92,7 +92,7 @@ require ( github.com/shoenig/go-m1cpu v0.1.5 // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/stretchr/testify v1.8.2 // indirect - github.com/tdewolff/parse/v2 v2.6.5 // indirect + github.com/tdewolff/parse/v2 v2.6.6 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect diff --git a/go.sum b/go.sum index b591d2388..b33d66882 100644 --- a/go.sum +++ b/go.sum @@ -217,12 +217,13 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8= -github.com/tdewolff/minify/v2 v2.12.5 h1:s2KDBt/D/3ayE3gcqQF8VIgTmYgkx+btuLvVAeePzZM= -github.com/tdewolff/minify/v2 v2.12.5/go.mod h1:i8QXtVyL7Ddwc4I5gqzvgBqKlTMgMNTbiXaPO4Iqg+A= -github.com/tdewolff/parse/v2 v2.6.5 h1:lYvWBk55GkqKl0JJenGpmrgu/cPHQQ6/Mm1hBGswoGQ= -github.com/tdewolff/parse/v2 v2.6.5/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs= -github.com/tdewolff/test v1.0.7 h1:8Vs0142DmPFW/bQeHRP3MV19m1gvndjUb1sn8yy74LM= +github.com/tdewolff/minify/v2 v2.12.6 h1:kw5FU0ErJyd7fs+TMojIlBvLyEjsN93wP1n8NUOs320= +github.com/tdewolff/minify/v2 v2.12.6/go.mod h1:ZRKTheiOGyLSK8hOZWWv+YoJAECzDivNgAlVYDHp/Ws= +github.com/tdewolff/parse/v2 v2.6.6 h1:Yld+0CrKUJaCV78DL1G2nk3C9lKrxyRTux5aaK/AkDo= +github.com/tdewolff/parse/v2 v2.6.6/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs= github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= +github.com/tdewolff/test v1.0.9 h1:SswqJCmeN4B+9gEAi/5uqT0qpi1y2/2O47V/1hhGZT0= +github.com/tdewolff/test v1.0.9/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= @@ -293,6 +294,7 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= From 333a2c32b5b1823817502f7e738a04f12ae5622b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 May 2023 15:54:33 +0300 Subject: [PATCH 29/63] Bump github.com/BurntSushi/toml from 1.2.1 to 1.3.0 (#2145) Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 1.2.1 to 1.3.0. - [Release notes](https://github.com/BurntSushi/toml/releases) - [Commits](https://github.com/BurntSushi/toml/compare/v1.2.1...v1.3.0) --- updated-dependencies: - dependency-name: github.com/BurntSushi/toml dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 39e8fba57..af8de12ad 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 retract [v12.0.0, v12.1.8] // Retract older versions as only latest is to be depended upon. Please update to @latest require ( - github.com/BurntSushi/toml v1.2.1 + github.com/BurntSushi/toml v1.3.0 github.com/CloudyKit/jet/v6 v6.2.0 github.com/Joker/jade v1.1.3 github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 diff --git a/go.sum b/go.sum index b33d66882..58c47eeb3 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= -github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.0 h1:Ws8e5YmnrGEHzZEzg0YvK/7COGYtTC5PbaH9oSSbgfA= +github.com/BurntSushi/toml v1.3.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 h1:sR+/8Yb4slttB4vD+b9btVEnWgL3Q00OBTzVT8B9C0c= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= github.com/CloudyKit/jet/v6 v6.2.0 h1:EpcZ6SR9n28BUGtNJSvlBqf90IpjeFr36Tizxhn/oME= From 461720b842024c10b7f54fb9709b201f61938a1d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Jun 2023 15:39:06 +0300 Subject: [PATCH 30/63] Bump github.com/shirou/gopsutil/v3 from 3.23.4 to 3.23.5 (#2146) Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.4 to 3.23.5. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v3.23.4...v3.23.5) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 8 ++++---- go.sum | 21 ++++++++++----------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index af8de12ad..697bef5b7 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( github.com/microcosm-cc/bluemonday v1.0.24 github.com/redis/go-redis/v9 v9.0.5 github.com/schollz/closestmatch v2.1.0+incompatible - github.com/shirou/gopsutil/v3 v3.23.4 + github.com/shirou/gopsutil/v3 v3.23.5 github.com/tdewolff/minify/v2 v2.12.6 github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 @@ -89,9 +89,9 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sanity-io/litter v1.5.5 // indirect github.com/sergi/go-diff v1.0.0 // indirect - github.com/shoenig/go-m1cpu v0.1.5 // indirect + github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/sirupsen/logrus v1.8.1 // indirect - github.com/stretchr/testify v1.8.2 // indirect + github.com/stretchr/testify v1.8.3 // indirect github.com/tdewolff/parse/v2 v2.6.6 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect @@ -103,7 +103,7 @@ require ( github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect github.com/yudai/gojsondiff v1.0.0 // indirect github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect - github.com/yusufpapurcu/wmi v1.2.2 // indirect + github.com/yusufpapurcu/wmi v1.2.3 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect moul.io/http2curl/v2 v2.3.0 // indirect ) diff --git a/go.sum b/go.sum index 58c47eeb3..a4259f506 100644 --- a/go.sum +++ b/go.sum @@ -185,12 +185,12 @@ github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiy github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil/v3 v3.23.4 h1:hZwmDxZs7Ewt75DV81r4pFMqbq+di2cbt9FsQBqLD2o= -github.com/shirou/gopsutil/v3 v3.23.4/go.mod h1:ZcGxyfzAMRevhUR2+cfhXDH6gQdFYE/t8j1nsU4mPI8= -github.com/shoenig/go-m1cpu v0.1.5 h1:LF57Z/Fpb/WdGLjt2HZilNnmZOxg/q2bSKTQhgbrLrQ= -github.com/shoenig/go-m1cpu v0.1.5/go.mod h1:Wwvst4LR89UxjeFtLRMrpgRiyY4xPsejnVZym39dbAQ= -github.com/shoenig/test v0.6.3 h1:GVXWJFk9PiOjN0KoJ7VrJGH6uLPnqxR7/fe3HUPfE0c= -github.com/shoenig/test v0.6.3/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= +github.com/shirou/gopsutil/v3 v3.23.5 h1:5SgDCeQ0KW0S4N0znjeM/eFHXXOKyv2dVNgRq/c9P6Y= +github.com/shirou/gopsutil/v3 v3.23.5/go.mod h1:Ng3Maa27Q2KARVJ0SPZF5NdrQSC3XHKP8IIWrHgMeLY= +github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= +github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= +github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -214,8 +214,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8= github.com/tdewolff/minify/v2 v2.12.6 h1:kw5FU0ErJyd7fs+TMojIlBvLyEjsN93wP1n8NUOs320= github.com/tdewolff/minify/v2 v2.12.6/go.mod h1:ZRKTheiOGyLSK8hOZWWv+YoJAECzDivNgAlVYDHp/Ws= @@ -253,8 +253,8 @@ github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDf github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= -github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= +github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -295,7 +295,6 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From b8b96474a09881fedbcd9ae30ed3246314161324 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Mon, 5 Jun 2023 23:34:50 +0300 Subject: [PATCH 31/63] fix #2147 --- core/router/handler.go | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/core/router/handler.go b/core/router/handler.go index 87eaf9dbb..34c449312 100644 --- a/core/router/handler.go +++ b/core/router/handler.go @@ -65,12 +65,28 @@ var _ HTTPErrorHandler = (*routerHandler)(nil) // NewDefaultHandler returns the handler which is responsible // to map the request with a route (aka mux implementation). func NewDefaultHandler(config context.ConfigurationReadOnly, logger *golog.Logger) RequestHandler { + var ( + disablePathCorrection bool + disablePathCorrectionRedirection bool + fireMethodNotAllowed bool + enablePathIntelligence bool + forceLowercaseRouting bool + ) + + if config != nil { // #2147 + disablePathCorrection = config.GetDisablePathCorrection() + disablePathCorrectionRedirection = config.GetDisablePathCorrectionRedirection() + fireMethodNotAllowed = config.GetFireMethodNotAllowed() + enablePathIntelligence = config.GetEnablePathIntelligence() + forceLowercaseRouting = config.GetForceLowercaseRouting() + } + return &routerHandler{ - disablePathCorrection: config.GetDisablePathCorrection(), - disablePathCorrectionRedirection: config.GetDisablePathCorrectionRedirection(), - fireMethodNotAllowed: config.GetFireMethodNotAllowed(), - enablePathIntelligence: config.GetEnablePathIntelligence(), - forceLowercaseRouting: config.GetForceLowercaseRouting(), + disablePathCorrection: disablePathCorrection, + disablePathCorrectionRedirection: disablePathCorrectionRedirection, + fireMethodNotAllowed: fireMethodNotAllowed, + enablePathIntelligence: enablePathIntelligence, + forceLowercaseRouting: forceLowercaseRouting, logger: logger, } } From 00dac4644344cae73b46eb59ca1c3c6d3b4a1db9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 10 Jun 2023 19:13:11 +0300 Subject: [PATCH 32/63] Bump github.com/BurntSushi/toml from 1.3.0 to 1.3.2 (#2149) Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 1.3.0 to 1.3.2. - [Release notes](https://github.com/BurntSushi/toml/releases) - [Commits](https://github.com/BurntSushi/toml/compare/v1.3.0...v1.3.2) --- updated-dependencies: - dependency-name: github.com/BurntSushi/toml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 697bef5b7..76e917fa6 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 retract [v12.0.0, v12.1.8] // Retract older versions as only latest is to be depended upon. Please update to @latest require ( - github.com/BurntSushi/toml v1.3.0 + github.com/BurntSushi/toml v1.3.2 github.com/CloudyKit/jet/v6 v6.2.0 github.com/Joker/jade v1.1.3 github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 diff --git a/go.sum b/go.sum index a4259f506..4d6c39c3c 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.3.0 h1:Ws8e5YmnrGEHzZEzg0YvK/7COGYtTC5PbaH9oSSbgfA= -github.com/BurntSushi/toml v1.3.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 h1:sR+/8Yb4slttB4vD+b9btVEnWgL3Q00OBTzVT8B9C0c= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= github.com/CloudyKit/jet/v6 v6.2.0 h1:EpcZ6SR9n28BUGtNJSvlBqf90IpjeFr36Tizxhn/oME= From 4cef25b1f67bdaef1584d0c909c774bc477b2063 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Jun 2023 16:59:36 +0300 Subject: [PATCH 33/63] Bump golang.org/x/text from 0.9.0 to 0.10.0 (#2150) Bumps [golang.org/x/text](https://github.com/golang/text) from 0.9.0 to 0.10.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.9.0...v0.10.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 76e917fa6..5ffb30e9e 100644 --- a/go.mod +++ b/go.mod @@ -42,7 +42,7 @@ require ( golang.org/x/crypto v0.9.0 golang.org/x/net v0.10.0 golang.org/x/sys v0.8.0 - golang.org/x/text v0.9.0 + golang.org/x/text v0.10.0 golang.org/x/time v0.3.0 google.golang.org/protobuf v1.30.0 gopkg.in/ini.v1 v1.67.0 diff --git a/go.sum b/go.sum index 4d6c39c3c..fb1faa5ae 100644 --- a/go.sum +++ b/go.sum @@ -302,8 +302,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= +golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 5e925add97cdc8081c76bb3680236efecfb1453f Mon Sep 17 00:00:00 2001 From: Saif Aljanahi <31359390+1saifj@users.noreply.github.com> Date: Tue, 13 Jun 2023 17:01:52 +0300 Subject: [PATCH 34/63] Added example how to use ulule-limiter with Iris web framework (#2152) * Added example how to use ulule-limiter with Iris web framework * format main.go Signed-off-by: Gerasimos (Makis) Maropoulos --------- Signed-off-by: Gerasimos (Makis) Maropoulos Co-authored-by: Gerasimos (Makis) Maropoulos --- .../{ => rate-middleware}/main.go | 0 .../request-ratelimit/ulule-limiter/main.go | 68 +++++++++++++++++++ 2 files changed, 68 insertions(+) rename _examples/request-ratelimit/{ => rate-middleware}/main.go (100%) create mode 100644 _examples/request-ratelimit/ulule-limiter/main.go diff --git a/_examples/request-ratelimit/main.go b/_examples/request-ratelimit/rate-middleware/main.go similarity index 100% rename from _examples/request-ratelimit/main.go rename to _examples/request-ratelimit/rate-middleware/main.go diff --git a/_examples/request-ratelimit/ulule-limiter/main.go b/_examples/request-ratelimit/ulule-limiter/main.go new file mode 100644 index 000000000..661c84b85 --- /dev/null +++ b/_examples/request-ratelimit/ulule-limiter/main.go @@ -0,0 +1,68 @@ +package main + +import ( + "log" + "net/http" + "strconv" + "time" + + "github.com/kataras/iris/v12" + + "github.com/ulule/limiter/v3" + "github.com/ulule/limiter/v3/drivers/store/memory" +) + +func main() { + app := iris.New() + app.Get("/hello", IPRateLimit(), helloWorldHandler) // 3. Use middleware + app.Run(iris.Addr(":8080")) +} + +func helloWorldHandler(ctx iris.Context) { + err := ctx.StopWithJSON(iris.StatusOK, iris.Map{ + "message": "Hello World!", + }) + if err != nil { + return + } +} + +func IPRateLimit() iris.Handler { + // 1. Configure + rate := limiter.Rate{ + Period: 2 * time.Second, + Limit: 1, + } + store := memory.NewStore() + ipRateLimiter := limiter.New(store, rate) + + // 2. Return middleware handler + return func(ctx iris.Context) { + ip := ctx.RemoteAddr() + limiterCtx, err := ipRateLimiter.Get(ctx.Request().Context(), ip) + if err != nil { + log.Printf("IPRateLimit - ipRateLimiter.Get - err: %v, %s on %s", err, ip, ctx.Request().URL) + ctx.StatusCode(http.StatusInternalServerError) + ctx.JSON(iris.Map{ + "success": false, + "message": err, + }) + return + } + + ctx.Header("X-RateLimit-Limit", strconv.FormatInt(limiterCtx.Limit, 10)) + ctx.Header("X-RateLimit-Remaining", strconv.FormatInt(limiterCtx.Remaining, 10)) + ctx.Header("X-RateLimit-Reset", strconv.FormatInt(limiterCtx.Reset, 10)) + + if limiterCtx.Reached { + log.Printf("Too Many Requests from %s on %s", ip, ctx.Request().URL) + ctx.StatusCode(http.StatusTooManyRequests) + ctx.JSON(iris.Map{ + "success": false, + "message": "Too Many Requests on " + ctx.Request().URL.String(), + }) + return + } + ctx.Next() + } +} From 9d633904f1540b3fe0cfb43729c6dde4ebe4fc94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Jun 2023 16:29:24 +0300 Subject: [PATCH 35/63] Bump golang.org/x/sys from 0.8.0 to 0.9.0 (#2151) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.8.0 to 0.9.0. - [Commits](https://github.com/golang/sys/compare/v0.8.0...v0.9.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 5ffb30e9e..1f483ad61 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( go.etcd.io/bbolt v1.3.7 golang.org/x/crypto v0.9.0 golang.org/x/net v0.10.0 - golang.org/x/sys v0.8.0 + golang.org/x/sys v0.9.0 golang.org/x/text v0.10.0 golang.org/x/time v0.3.0 google.golang.org/protobuf v1.30.0 diff --git a/go.sum b/go.sum index fb1faa5ae..646cc3fb4 100644 --- a/go.sum +++ b/go.sum @@ -295,8 +295,9 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From 8a8b1284a30a5d10641a51c52e7b74e6b69b10b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Jun 2023 16:29:36 +0300 Subject: [PATCH 36/63] Bump golang.org/x/crypto from 0.9.0 to 0.10.0 (#2153) Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.9.0 to 0.10.0. - [Commits](https://github.com/golang/crypto/compare/v0.9.0...v0.10.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1f483ad61..0a8d3034b 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 - golang.org/x/crypto v0.9.0 + golang.org/x/crypto v0.10.0 golang.org/x/net v0.10.0 golang.org/x/sys v0.9.0 golang.org/x/text v0.10.0 diff --git a/go.sum b/go.sum index 646cc3fb4..e81b1ff0c 100644 --- a/go.sum +++ b/go.sum @@ -261,8 +261,8 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= From ee61c5b75979603db10198582975c9c6ba1523e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Jun 2023 16:29:46 +0300 Subject: [PATCH 37/63] Bump github.com/klauspost/compress from 1.16.5 to 1.16.6 (#2154) Bumps [github.com/klauspost/compress](https://github.com/klauspost/compress) from 1.16.5 to 1.16.6. - [Release notes](https://github.com/klauspost/compress/releases) - [Changelog](https://github.com/klauspost/compress/blob/master/.goreleaser.yml) - [Commits](https://github.com/klauspost/compress/compare/v1.16.5...v1.16.6) --- updated-dependencies: - dependency-name: github.com/klauspost/compress dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0a8d3034b..fbf029e4a 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/kataras/pio v0.0.11 github.com/kataras/sitemap v0.0.6 github.com/kataras/tunnel v0.0.4 - github.com/klauspost/compress v1.16.5 + github.com/klauspost/compress v1.16.6 github.com/mailgun/raymond/v2 v2.0.48 github.com/mailru/easyjson v0.7.7 github.com/microcosm-cc/bluemonday v1.0.24 diff --git a/go.sum b/go.sum index e81b1ff0c..b47b9ddc5 100644 --- a/go.sum +++ b/go.sum @@ -119,8 +119,8 @@ github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIR github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= -github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.6 h1:91SKEy4K37vkp255cJ8QesJhjyRO0hn9i9G0GoUwLsk= +github.com/klauspost/compress v1.16.6/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= From 31163ed4dbb6618358362ab1443231861bd5923a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Jun 2023 16:30:54 +0300 Subject: [PATCH 38/63] Bump golang.org/x/net from 0.10.0 to 0.11.0 (#2155) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.10.0 to 0.11.0. - [Commits](https://github.com/golang/net/compare/v0.10.0...v0.11.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index fbf029e4a..a5ef3f362 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 golang.org/x/crypto v0.10.0 - golang.org/x/net v0.10.0 + golang.org/x/net v0.11.0 golang.org/x/sys v0.9.0 golang.org/x/text v0.10.0 golang.org/x/time v0.3.0 diff --git a/go.sum b/go.sum index b47b9ddc5..5a3b8f34e 100644 --- a/go.sum +++ b/go.sum @@ -271,8 +271,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= +golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 7fb00911d449b9228c804fd26643cbe58aaa8792 Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Thu, 15 Jun 2023 07:34:37 +0800 Subject: [PATCH 39/63] hero: optimize *binding'String For faster execution, use strconv.Itoa rather than fmt.Sprintf to convert an integer to string, remove if statement in loop. --- hero/binding.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hero/binding.go b/hero/binding.go index fbe48fe35..de1af4c1d 100644 --- a/hero/binding.go +++ b/hero/binding.go @@ -4,6 +4,7 @@ import ( "fmt" "reflect" "sort" + "strconv" "github.com/kataras/iris/v12/context" ) @@ -43,15 +44,14 @@ func newStructFieldInput(f reflect.StructField) *Input { // String returns the string representation of a binding. func (b *binding) String() string { - index := fmt.Sprintf("%d", b.Input.Index) + var index string if len(b.Input.StructFieldIndex) > 0 { - for j, i := range b.Input.StructFieldIndex { - if j == 0 { - index = fmt.Sprintf("%d", i) - continue - } + index = strconv.Itoa(b.Input.StructFieldIndex[0]) + for _, i := range b.Input.StructFieldIndex[1:] { index += fmt.Sprintf(".%d", i) } + } else { + index = strconv.Itoa(b.Input.Index) } return fmt.Sprintf("[%s:%s] maps to [%s]", index, b.Input.Type.String(), b.Dependency) From 57f302652401775e0e828fe360a6ac0397639ace Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Jun 2023 05:39:32 +0300 Subject: [PATCH 40/63] Bump github.com/tdewolff/minify/v2 from 2.12.6 to 2.12.7 (#2159) Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.12.6 to 2.12.7. - [Release notes](https://github.com/tdewolff/minify/releases) - [Commits](https://github.com/tdewolff/minify/compare/v2.12.6...v2.12.7) --- updated-dependencies: - dependency-name: github.com/tdewolff/minify/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a5ef3f362..a90df61bf 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/redis/go-redis/v9 v9.0.5 github.com/schollz/closestmatch v2.1.0+incompatible github.com/shirou/gopsutil/v3 v3.23.5 - github.com/tdewolff/minify/v2 v2.12.6 + github.com/tdewolff/minify/v2 v2.12.7 github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 diff --git a/go.sum b/go.sum index 5a3b8f34e..33c90c545 100644 --- a/go.sum +++ b/go.sum @@ -217,8 +217,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8= -github.com/tdewolff/minify/v2 v2.12.6 h1:kw5FU0ErJyd7fs+TMojIlBvLyEjsN93wP1n8NUOs320= -github.com/tdewolff/minify/v2 v2.12.6/go.mod h1:ZRKTheiOGyLSK8hOZWWv+YoJAECzDivNgAlVYDHp/Ws= +github.com/tdewolff/minify/v2 v2.12.7 h1:pBzz2tAfz5VghOXiQIsSta6srhmTeinQPjRDHWoumCA= +github.com/tdewolff/minify/v2 v2.12.7/go.mod h1:ZRKTheiOGyLSK8hOZWWv+YoJAECzDivNgAlVYDHp/Ws= github.com/tdewolff/parse/v2 v2.6.6 h1:Yld+0CrKUJaCV78DL1G2nk3C9lKrxyRTux5aaK/AkDo= github.com/tdewolff/parse/v2 v2.6.6/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs= github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= From 00eb4854fdd56c2520d94abb675e0ac1d8e767fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 12:56:55 +0300 Subject: [PATCH 41/63] Bump github.com/kataras/pio from 0.0.11 to 0.0.12 (#2162) Bumps [github.com/kataras/pio](https://github.com/kataras/pio) from 0.0.11 to 0.0.12. - [Release notes](https://github.com/kataras/pio/releases) - [Commits](https://github.com/kataras/pio/compare/v0.0.11...v0.0.12) --- updated-dependencies: - dependency-name: github.com/kataras/pio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a90df61bf..c3ea29e43 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/kataras/golog v0.1.8 github.com/kataras/jwt v0.1.8 github.com/kataras/neffos v0.0.21 - github.com/kataras/pio v0.0.11 + github.com/kataras/pio v0.0.12 github.com/kataras/sitemap v0.0.6 github.com/kataras/tunnel v0.0.4 github.com/klauspost/compress v1.16.6 diff --git a/go.sum b/go.sum index 33c90c545..c24ea962b 100644 --- a/go.sum +++ b/go.sum @@ -112,8 +112,8 @@ github.com/kataras/jwt v0.1.8 h1:u71baOsYD22HWeSOg32tCHbczPjdCk7V4MMeJqTtmGk= github.com/kataras/jwt v0.1.8/go.mod h1:Q5j2IkcIHnfwy+oNY3TVWuEBJNw0ADgCcXK9CaZwV4o= github.com/kataras/neffos v0.0.21 h1:UwN/F44jlqdtgFI29y3VhA7IlJ4JbK3UjCbTDg1pYoo= github.com/kataras/neffos v0.0.21/go.mod h1:FeGka8lu8cjD2H+0OpBvW8c6xXawy3fj5VX6xcIJ1Fg= -github.com/kataras/pio v0.0.11 h1:kqreJ5KOEXGMwHAWHDwIl+mjfNCPhAwZPa8gK7MKlyw= -github.com/kataras/pio v0.0.11/go.mod h1:38hH6SWH6m4DKSYmRhlrCJ5WItwWgCVrTNU62XZyUvI= +github.com/kataras/pio v0.0.12 h1:o52SfVYauS3J5X08fNjlGS5arXHjW/ItLkyLcKjoH6w= +github.com/kataras/pio v0.0.12/go.mod h1:ODK/8XBhhQ5WqrAhKy+9lTPS7sBf6O3KcLhc9klfRcY= github.com/kataras/sitemap v0.0.6 h1:w71CRMMKYMJh6LR2wTgnk5hSgjVNB9KL60n5e2KHvLY= github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIRwuj5jA4= github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= From d7199af4b2dfcd9dba046f5e8561832978256a23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 12:57:06 +0300 Subject: [PATCH 42/63] Bump github.com/kataras/golog from 0.1.8 to 0.1.9 (#2163) Bumps [github.com/kataras/golog](https://github.com/kataras/golog) from 0.1.8 to 0.1.9. - [Release notes](https://github.com/kataras/golog/releases) - [Changelog](https://github.com/kataras/golog/blob/master/HISTORY.md) - [Commits](https://github.com/kataras/golog/compare/v0.1.8...v0.1.9) --- updated-dependencies: - dependency-name: github.com/kataras/golog dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c3ea29e43..df8e7dd5f 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/iris-contrib/schema v0.0.6 github.com/json-iterator/go v1.1.12 github.com/kataras/blocks v0.0.7 - github.com/kataras/golog v0.1.8 + github.com/kataras/golog v0.1.9 github.com/kataras/jwt v0.1.8 github.com/kataras/neffos v0.0.21 github.com/kataras/pio v0.0.12 diff --git a/go.sum b/go.sum index c24ea962b..ab4b1e984 100644 --- a/go.sum +++ b/go.sum @@ -106,8 +106,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kataras/blocks v0.0.7 h1:cF3RDY/vxnSRezc7vLFlQFTYXG/yAr1o7WImJuZbzC4= github.com/kataras/blocks v0.0.7/go.mod h1:UJIU97CluDo0f+zEjbnbkeMRlvYORtmc1304EeyXf4I= -github.com/kataras/golog v0.1.8 h1:isP8th4PJH2SrbkciKnylaND9xoTtfxv++NB+DF0l9g= -github.com/kataras/golog v0.1.8/go.mod h1:rGPAin4hYROfk1qT9wZP6VY2rsb4zzc37QpdPjdkqVw= +github.com/kataras/golog v0.1.9 h1:vLvSDpP7kihFGKFAvBSofYo7qZNULYSHOH2D7rPTKJk= +github.com/kataras/golog v0.1.9/go.mod h1:jlpk/bOaYCyqDqH18pgDHdaJab72yBE6i0O3s30hpWY= github.com/kataras/jwt v0.1.8 h1:u71baOsYD22HWeSOg32tCHbczPjdCk7V4MMeJqTtmGk= github.com/kataras/jwt v0.1.8/go.mod h1:Q5j2IkcIHnfwy+oNY3TVWuEBJNw0ADgCcXK9CaZwV4o= github.com/kataras/neffos v0.0.21 h1:UwN/F44jlqdtgFI29y3VhA7IlJ4JbK3UjCbTDg1pYoo= From 52a83ae6b4e77badd4a60133a9c06e24035e5089 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Jun 2023 14:24:01 +0300 Subject: [PATCH 43/63] Bump google.golang.org/protobuf from 1.30.0 to 1.31.0 (#2166) Bumps google.golang.org/protobuf from 1.30.0 to 1.31.0. --- updated-dependencies: - dependency-name: google.golang.org/protobuf dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index df8e7dd5f..3363c807f 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( golang.org/x/sys v0.9.0 golang.org/x/text v0.10.0 golang.org/x/time v0.3.0 - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.31.0 gopkg.in/ini.v1 v1.67.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index ab4b1e984..9b36c597a 100644 --- a/go.sum +++ b/go.sum @@ -318,8 +318,8 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1N golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From bde46850e69ce2cbdd1cc59bff99a4618771a4c6 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Thu, 29 Jun 2023 04:36:07 +0300 Subject: [PATCH 44/63] README: minor --- README.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index dde82ada1..37f70f66d 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,23 @@ -

News

+ -# Iris Web Framework +# Iris Web Framework [![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=master&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![view examples](https://img.shields.io/badge/examples%20-285-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/master/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![donate](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) - - Iris is a fast, simple yet fully featured and very efficient web framework for Go. It provides a beautifully expressive and easy to use foundation for your next website or API. +Learn what [others saying about Iris](https://www.iris-go.com/#review) and **[star](https://github.com/kataras/iris/stargazers)** this open-source project to support its potentials. + +[![](https://iris-go.com/images/reviews.gif)](https://iris-go.com/testimonials/) + +[![Benchmarks: Jul 18, 2020 at 10:46am (UTC)](https://iris-go.com/images/benchmarks.svg)](https://github.com/kataras/server-benchmarks) + ```go package main @@ -199,12 +203,6 @@ Some of the features Iris offers: * Testing Suite * And the most important... you get fast answers and support from the 1st day until now - that's six full years! -Learn what [others saying about Iris](https://www.iris-go.com/#review) and **[star](https://github.com/kataras/iris/stargazers)** this open-source project to support its potentials. - -[![](https://iris-go.com/images/reviews.gif)](https://iris-go.com/testimonials/) - -[![Benchmarks: Jul 18, 2020 at 10:46am (UTC)](https://iris-go.com/images/benchmarks.svg)](https://github.com/kataras/server-benchmarks) - ## 👑 Supporters With your help, we can improve Open Source web development for everyone! From 1852236d99205ce272fee0c85ddcdf0679f0b0f6 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Thu, 29 Jun 2023 04:55:09 +0300 Subject: [PATCH 45/63] README: update supporters --- README.md | 203 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 117 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index 37f70f66d..d0455bb67 100644 --- a/README.md +++ b/README.md @@ -209,27 +209,27 @@ With your help, we can improve Open Source web development for everyone!

github - lensesio getsentry + lensesio thepunterbot + EliYip + geordee + dph0899 + keymanye + marek-kuticka draFWM gf3 - simpleittools - Remydeme - janwebdev - Serissa4000 - dloprodu - pesquive - solohiroshi - thiennguyen93 - walter-wang trading-peter AlbinoGeek basilarchia sumjoe + simpleittools xiaozhuai + Remydeme celsosz + linxcoder TechMaster + janwebdev altafino jakoubek alekperos @@ -243,36 +243,44 @@ With your help, we can improve Open Source web development for everyone! lexrus li3p madhu72 + mubariz-ahmed se77en vincent-li Cesar DavidShaw - stgrosshh - rodrigoghm - Didainius - DmarshalTU - IwateKyle - Little-YangYang - Major2828 - MatejLach sascha11110 derReineke Sirisap22 primadi agoncecelia - hobysmith - clacroix - boomhut - coderperu - cshum - ixalender - mubariz-ahmed - dtrifonov - iantuan - ichenhe + saz59 + shadowfiga + siriushaha + skurtz97 srinivasganti syrm tuhao1020 + wahyuief + xvalen + xytis + ElNovi + KKP4 + Lernakow + ernestocolombo + francisstephan + pixelheresy + rcapraro + soiestad + thanasolykos + DanielKirkwood + aprinslo1 + ukitzmann + colinf + kyoukhana + spazzymoto + ArishSultan + ehayun + kukaki oshirokazuhide t6tg AnatolyUA @@ -282,17 +290,33 @@ With your help, we can improve Open Source web development for everyone! Hongjian0619 JoeD Jude-X + Kartoffelbot KevinZhouRafael + hobysmith + th31nitiate + stgrosshh + rodrigoghm + Didainius + DmarshalTU + IwateKyle + Little-YangYang + Major2828 + MatejLach + clacroix + amritpal042 + boomhut + coderperu + cshum + dtrifonov + iantuan + ichenhe KrishManohar Laotanling + njeff3 + ixalender Longf99999 MihaiPopescu1985 NA - Neulhan - NguyenPhuoc - SamuelNeves - Scorpio69t - TianJIANG icibiri jfloresremar jingtianfeng @@ -301,79 +325,72 @@ With your help, we can improve Open Source web development for everyone! lfbos lpintes macropas - Ubun1 - XinYoungCN marcmmx mark2b miguel-devs + Neulhan mihado mmckeen75 + NguyenPhuoc narven odas0r - YukinaMochizuki - a112121788 + Oka00 + RainerGevers + Ramblestsad + SamuelNeves + Scorpio69t + Serissa4000 + TianJIANG + Ubun1 olaf-lexemo pitexplore pr123 rsousacode sankethpb - saz59 - shadowfiga - siriushaha - th31nitiate - skurtz97 + XinYoungCN + YukinaMochizuki + a112121788 acdias + aeonsthorn agent3bood alessandromarotta algoflows + angelaahhu annieruci antoniejiao + artman328 b2cbd baoch254 bastengao bjoroen blackHoleNgc1277 - wahyuief - xvalen - xytis - ElNovi - KKP4 - Lernakow - aprinslo1 - Oka00 - RainerGevers bunnycodego carlos-enginner civicwar cnzhangquan + danlanxiaohei + dfaugusto + dkzhang + dloprodu donam-givita ec0629 - francisstephan edwindna2 ekofedriyanto fenriz07 ffelipelimao - pixelheresy - thanasolykos frenchmajesty gastropulgite geGao123 - ukitzmann - colinf + globalflea gnosthi goten002 guanzi008 - kyoukhana - spazzymoto - ArishSultan - ehayun - kukaki - Ramblestsad hdezoscar93 hieungm - hieunm39 + hieunmg homerious hzxd + iysaleh jackptoke jeremiahyan joelywz @@ -396,16 +413,22 @@ With your help, we can improve Open Source web development for everyone! maxgozou mizzlespot mnievesco + mo3lyana motogo mtrense mukunhao mulyawansentosa nasoma + ngseiyu nikharsaxena + nronzel + onlysumitg ozfive paulxu21 + pesquive phil535 pitt134 + pookiepats qiepeipei qiuzhanghua rapita @@ -421,14 +444,33 @@ With your help, we can improve Open Source web development for everyone! sbenimeli sebyno seun-otosho + solohiroshi su1gen sukiejosh svirmi + thiennguyen93 unixedia vadgun + valsorym vguhesan + vpiduri + vrocadev + netbaalzovf + oliverjosefzimmer vuhoanglam + walter-wang wixregiga + talebisinan + valkuere + CSRaghunandan + lfaynman + ArturWierzbicki + GeorgeFourikis + L-M-Sherlock + Supersherm5 + aaxx + crashCoder + derekslenk yesudeep ymonk yonson2 @@ -437,63 +479,52 @@ With your help, we can improve Open Source web development for everyone! - BelmonduS martinjanda + claudemuller martinlindhe mdamschen - netbaalzovf - oliverjosefzimmer - valkuere - lfaynman - ArturWierzbicki - Supersherm5 - aaxx - crashCoder - derekslenk dochoaj + edsongley evillgenius75 gog200921 - mauricedcastro - mwiater - sj671 - statik - supersherm5 - thejones - CSRaghunandan - GeorgeFourikis - L-M-Sherlock - claudemuller - edsongley - vcruzato evan grassshrimp hazmi-e205 jtgoral ky2s lauweliam + mauricedcastro + mwiater + sj671 letmestudy mblandr midhubalan + statik + supersherm5 + thejones ndimorle rosales-stephanie shyyawn + vcruzato wangbl11 wofka72 - juanxme xsokev oleang michalsz Curtman SridarDhandapani - nguyentamvinhlong opusmagna b4zz4r bobmcallan fangli galois-tnp geoshan + juanxme + nguyentamvinhlong tejzpr theantichris tuxaanand raphael-brand + willypuzzle HieuLsw carlosmoran092 yangxianglong From 6810a4c32d7704accf3340118efaf08ceab0d726 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sat, 1 Jul 2023 16:49:57 +0300 Subject: [PATCH 46/63] middleware/README: add link to the new PG middleware to the list --- middleware/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/middleware/README.md b/middleware/README.md index 2f11609e7..197c67621 100644 --- a/middleware/README.md +++ b/middleware/README.md @@ -22,6 +22,7 @@ Most of the experimental handlers are ported to work with _iris_'s handler form, | Middleware | Description | Example | | -----------|--------|-------------| +| [pg](https://github.com/iris-contrib/middleware/tree/master/pg) | Middleware that provides easy and type-safe access to PostgreSQL database | [iris-contrib/middleware/pg/_examples](https://github.com/iris-contrib/middleware/tree/master/pg/_examples) | | [jwt](https://github.com/iris-contrib/middleware/tree/master/jwt) | Middleware checks for a JWT on the `Authorization` header on incoming requests and decodes it | [iris-contrib/middleware/jwt/_example](https://github.com/iris-contrib/middleware/tree/master/jwt/_example) | | [cors](https://github.com/iris-contrib/middleware/tree/master/cors) | HTTP Access Control | [iris-contrib/middleware/cors/_example](https://github.com/iris-contrib/middleware/tree/master/cors/_example) | | [secure](https://github.com/iris-contrib/middleware/tree/master/secure) | Middleware that implements a few quick security wins | [iris-contrib/middleware/secure/_example](https://github.com/iris-contrib/middleware/tree/master/secure/_example/main.go) | From 007528459dafaf9a492503371aa5e93f065c704c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 03:44:45 +0300 Subject: [PATCH 47/63] Bump github.com/shirou/gopsutil/v3 from 3.23.5 to 3.23.6 (#2168) Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.5 to 3.23.6. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v3.23.5...v3.23.6) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 3363c807f..8a317fba3 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( github.com/microcosm-cc/bluemonday v1.0.24 github.com/redis/go-redis/v9 v9.0.5 github.com/schollz/closestmatch v2.1.0+incompatible - github.com/shirou/gopsutil/v3 v3.23.5 + github.com/shirou/gopsutil/v3 v3.23.6 github.com/tdewolff/minify/v2 v2.12.7 github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 @@ -91,7 +91,7 @@ require ( github.com/sergi/go-diff v1.0.0 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/sirupsen/logrus v1.8.1 // indirect - github.com/stretchr/testify v1.8.3 // indirect + github.com/stretchr/testify v1.8.4 // indirect github.com/tdewolff/parse/v2 v2.6.6 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect diff --git a/go.sum b/go.sum index 9b36c597a..a1be4c492 100644 --- a/go.sum +++ b/go.sum @@ -185,8 +185,8 @@ github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiy github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil/v3 v3.23.5 h1:5SgDCeQ0KW0S4N0znjeM/eFHXXOKyv2dVNgRq/c9P6Y= -github.com/shirou/gopsutil/v3 v3.23.5/go.mod h1:Ng3Maa27Q2KARVJ0SPZF5NdrQSC3XHKP8IIWrHgMeLY= +github.com/shirou/gopsutil/v3 v3.23.6 h1:5y46WPI9QBKBbK7EEccUPNXpJpNrvPuTD0O2zHEHT08= +github.com/shirou/gopsutil/v3 v3.23.6/go.mod h1:j7QX50DrXYggrpN30W0Mo+I4/8U2UUIQrnrhqUeWrAU= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= @@ -214,8 +214,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8= github.com/tdewolff/minify/v2 v2.12.7 h1:pBzz2tAfz5VghOXiQIsSta6srhmTeinQPjRDHWoumCA= github.com/tdewolff/minify/v2 v2.12.7/go.mod h1:ZRKTheiOGyLSK8hOZWWv+YoJAECzDivNgAlVYDHp/Ws= @@ -295,7 +295,6 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From d4ac1b4430520e8318a6bf4464767aa2ba382cd7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 03:45:08 +0300 Subject: [PATCH 48/63] Bump github.com/klauspost/compress from 1.16.6 to 1.16.7 (#2169) Bumps [github.com/klauspost/compress](https://github.com/klauspost/compress) from 1.16.6 to 1.16.7. - [Release notes](https://github.com/klauspost/compress/releases) - [Changelog](https://github.com/klauspost/compress/blob/master/.goreleaser.yml) - [Commits](https://github.com/klauspost/compress/compare/v1.16.6...v1.16.7) --- updated-dependencies: - dependency-name: github.com/klauspost/compress dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8a317fba3..c8a3e8fe8 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/kataras/pio v0.0.12 github.com/kataras/sitemap v0.0.6 github.com/kataras/tunnel v0.0.4 - github.com/klauspost/compress v1.16.6 + github.com/klauspost/compress v1.16.7 github.com/mailgun/raymond/v2 v2.0.48 github.com/mailru/easyjson v0.7.7 github.com/microcosm-cc/bluemonday v1.0.24 diff --git a/go.sum b/go.sum index a1be4c492..6a39dc0a0 100644 --- a/go.sum +++ b/go.sum @@ -119,8 +119,8 @@ github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIR github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.16.6 h1:91SKEy4K37vkp255cJ8QesJhjyRO0hn9i9G0GoUwLsk= -github.com/klauspost/compress v1.16.6/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= From 834e4481ec487fb8a7e03a3cddee858f5f06a10f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 03:46:05 +0300 Subject: [PATCH 49/63] Bump golang.org/x/sys from 0.9.0 to 0.10.0 (#2170) Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.9.0 to 0.10.0. - [Commits](https://github.com/golang/sys/compare/v0.9.0...v0.10.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index c8a3e8fe8..efbe11c98 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( go.etcd.io/bbolt v1.3.7 golang.org/x/crypto v0.10.0 golang.org/x/net v0.11.0 - golang.org/x/sys v0.9.0 + golang.org/x/sys v0.10.0 golang.org/x/text v0.10.0 golang.org/x/time v0.3.0 google.golang.org/protobuf v1.31.0 diff --git a/go.sum b/go.sum index 6a39dc0a0..d35425039 100644 --- a/go.sum +++ b/go.sum @@ -295,8 +295,9 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From aa16edb6bb5deb4551607a8df2a3b0c330189000 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 03:47:08 +0300 Subject: [PATCH 50/63] Bump golang.org/x/text from 0.10.0 to 0.11.0 (#2171) Bumps [golang.org/x/text](https://github.com/golang/text) from 0.10.0 to 0.11.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.10.0...v0.11.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index efbe11c98..abebbd360 100644 --- a/go.mod +++ b/go.mod @@ -42,7 +42,7 @@ require ( golang.org/x/crypto v0.10.0 golang.org/x/net v0.11.0 golang.org/x/sys v0.10.0 - golang.org/x/text v0.10.0 + golang.org/x/text v0.11.0 golang.org/x/time v0.3.0 google.golang.org/protobuf v1.31.0 gopkg.in/ini.v1 v1.67.0 diff --git a/go.sum b/go.sum index d35425039..dea8987d2 100644 --- a/go.sum +++ b/go.sum @@ -303,8 +303,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 06047c2ec0a12159858f7362972aecd04e2d1282 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 03:47:39 +0300 Subject: [PATCH 51/63] Bump google.golang.org/grpc (#2172) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.51.0 to 1.53.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.51.0...v1.53.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../go.mod | 4 +- .../go.sum | 64 +++---------------- 2 files changed, 12 insertions(+), 56 deletions(-) diff --git a/_examples/mvc/grpc-compatible-bidirectional-stream/go.mod b/_examples/mvc/grpc-compatible-bidirectional-stream/go.mod index 1aa8293a3..d82694e42 100644 --- a/_examples/mvc/grpc-compatible-bidirectional-stream/go.mod +++ b/_examples/mvc/grpc-compatible-bidirectional-stream/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/golang/protobuf v1.5.2 github.com/kataras/iris/v12 v12.2.0-beta7 - google.golang.org/grpc v1.51.0 + google.golang.org/grpc v1.53.0 google.golang.org/protobuf v1.28.1 ) @@ -64,7 +64,7 @@ require ( golang.org/x/text v0.7.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect + google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/_examples/mvc/grpc-compatible-bidirectional-stream/go.sum b/_examples/mvc/grpc-compatible-bidirectional-stream/go.sum index 5cae3d177..9df8c24d2 100644 --- a/_examples/mvc/grpc-compatible-bidirectional-stream/go.sum +++ b/_examples/mvc/grpc-compatible-bidirectional-stream/go.sum @@ -1,5 +1,3 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 h1:sR+/8Yb4slttB4vD+b9btVEnWgL3Q00OBTzVT8B9C0c= @@ -19,9 +17,7 @@ github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuP github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -30,8 +26,6 @@ github.com/djherbis/atime v1.1.0/go.mod h1:28OF6Y8s3NQWwacXc5eZTsEsiMzp7LF8MbXE+ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0Hw= @@ -43,27 +37,13 @@ github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.1.0 h1:7RFti/xnNkMJnrK7D1yQ/iCIB5OrrY/54/H930kIbHA= github.com/gobwas/ws v1.1.0/go.mod h1:nzvNcVha5eUziGrbxFCo6qFIojQHjJV5cLYIbezhfL0= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= @@ -130,7 +110,6 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= @@ -173,20 +152,17 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f h1:Ax0t5p6N38Ga0dThY21weqDEyz2oklo4IvDkpigvkD8= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -207,10 +183,6 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -218,24 +190,10 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w= +google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc= +google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= @@ -250,6 +208,4 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= moul.io/http2curl v1.0.0 h1:6XwpyZOYsgZJrU8exnG87ncVkU1FVCcTRpwzOkTDUi8= From 757e7fe61beffac3fdde980f6fdfe5e136035ded Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 03:47:47 +0300 Subject: [PATCH 52/63] Bump golang.org/x/net from 0.11.0 to 0.12.0 (#2173) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.11.0 to 0.12.0. - [Commits](https://github.com/golang/net/compare/v0.11.0...v0.12.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index abebbd360..2af1470ff 100644 --- a/go.mod +++ b/go.mod @@ -39,8 +39,8 @@ require ( github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 - golang.org/x/crypto v0.10.0 - golang.org/x/net v0.11.0 + golang.org/x/crypto v0.11.0 + golang.org/x/net v0.12.0 golang.org/x/sys v0.10.0 golang.org/x/text v0.11.0 golang.org/x/time v0.3.0 diff --git a/go.sum b/go.sum index dea8987d2..d53d3a833 100644 --- a/go.sum +++ b/go.sum @@ -261,8 +261,8 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= @@ -271,8 +271,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 6add1ba49b173f25e5a294a14f027bcaa4d97f64 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sat, 8 Jul 2023 02:08:18 +0300 Subject: [PATCH 53/63] fix #2158 and more --- _examples/auth/basicauth/basic/main_test.go | 6 +- _examples/bootstrapper/main_test.go | 8 +- _examples/cookies/basic/main_test.go | 4 +- _examples/cookies/options/main_test.go | 4 +- _examples/cookies/securecookie/main_test.go | 4 +- .../basic/middleware/main_test.go | 6 +- _examples/file-server/basic/main_test.go | 4 +- .../main_test.go | 2 +- .../embedding-files-into-app/main_test.go | 2 +- .../main_test.go | 2 +- _examples/file-server/subdomain/main_test.go | 2 +- _examples/i18n/basic/main_test.go | 24 ++-- _examples/i18n/template-embedded/main_test.go | 8 +- _examples/i18n/template/main_test.go | 8 +- _examples/logging/json-logger/main_test.go | 2 +- .../mvc/authenticated-controller/main_test.go | 6 +- _examples/mvc/error-handler-http/main_test.go | 4 +- _examples/mvc/grpc-compatible/main_test.go | 2 +- _examples/mvc/hello-world/main_test.go | 6 +- .../mvc/versioned-controller/main_test.go | 12 +- _examples/request-body/read-body/main_test.go | 10 +- .../read-custom-per-type/main_test.go | 2 +- .../read-custom-via-unmarshaler/main_test.go | 2 +- .../request-body/read-params/main_test.go | 2 +- _examples/request-body/read-url/main_test.go | 2 +- _examples/request-body/read-xml/main_test.go | 2 +- _examples/request-body/read-yaml/main_test.go | 2 +- .../content-negotiation/main_test.go | 14 +- _examples/routing/basic/main_test.go | 28 ++-- .../routing/conditional-chain/main_test.go | 4 +- _examples/routing/custom-wrapper/main_test.go | 2 +- .../same-pattern-different-func/main_test.go | 6 +- .../use-global/main_test.go | 2 +- .../http-errors/reset-body/main_test.go | 2 +- _examples/routing/main_test.go | 10 +- _examples/routing/remove-handler/main_test.go | 2 +- _examples/routing/sitemap/main_test.go | 2 +- _examples/routing/subdomains/www/main_test.go | 2 +- .../share-funcs/main_test.go | 6 +- .../share-services/main_test.go | 2 +- _examples/sessions/securecookie/main_test.go | 10 +- _examples/testing/httptest/main_test.go | 6 +- _examples/view/quicktemplate/main_test.go | 4 +- apps/switch_hosts_test.go | 4 +- apps/switch_options_test.go | 2 +- cache/browser_test.go | 16 +-- cache/cache_test.go | 26 ++-- core/handlerconv/from_std_test.go | 6 +- core/host/proxy_test.go | 6 +- core/host/supervisor_test.go | 2 +- core/router/api_builder.go | 51 +------- core/router/api_builder_benchmark_test.go | 2 +- core/router/handler_execution_rules_test.go | 4 +- core/router/route_register_rule_test.go | 12 +- core/router/router_handlers_order_test.go | 28 ++-- core/router/router_test.go | 18 +-- core/router/router_wildcard_root_test.go | 2 +- core/router/status_test.go | 30 ++--- hero/binding.go | 4 +- hero/container_test.go | 4 +- hero/dependency.go | 120 ++++++++++++++++-- hero/dependency_source.go | 14 +- hero/func_result_test.go | 42 +++--- hero/handler_test.go | 38 +++--- hero/reflect.go | 33 +++++ hero/struct.go | 2 + hero/struct_test.go | 12 +- middleware/basicauth/basicauth_test.go | 28 ++-- middleware/jwt/jwt_test.go | 6 +- .../methodoverride/methodoverride_test.go | 16 +-- middleware/requestid/requestid_test.go | 6 +- mvc/controller_handle_test.go | 24 ++-- mvc/controller_method_result_test.go | 36 +++--- mvc/controller_overlap_test.go | 14 +- mvc/controller_test.go | 100 +++++++-------- sessions/sessions_test.go | 14 +- versioning/deprecation_test.go | 2 +- versioning/group_test.go | 14 +- versioning/version_test.go | 32 ++--- 79 files changed, 547 insertions(+), 463 deletions(-) diff --git a/_examples/auth/basicauth/basic/main_test.go b/_examples/auth/basicauth/basic/main_test.go index e3f27486c..1cce493a6 100644 --- a/_examples/auth/basicauth/basic/main_test.go +++ b/_examples/auth/basicauth/basic/main_test.go @@ -17,11 +17,11 @@ func TestBasicAuth(t *testing.T) { // with valid basic auth e.GET("/admin").WithBasicAuth("myusername", "mypassword").Expect(). - Status(httptest.StatusOK).Body().Equal("/admin myusername:mypassword") + Status(httptest.StatusOK).Body().IsEqual("/admin myusername:mypassword") e.GET("/admin/profile").WithBasicAuth("myusername", "mypassword").Expect(). - Status(httptest.StatusOK).Body().Equal("/admin/profile myusername:mypassword") + Status(httptest.StatusOK).Body().IsEqual("/admin/profile myusername:mypassword") e.GET("/admin/settings").WithBasicAuth("myusername", "mypassword").Expect(). - Status(httptest.StatusOK).Body().Equal("/admin/settings myusername:mypassword") + Status(httptest.StatusOK).Body().IsEqual("/admin/settings myusername:mypassword") // with invalid basic auth e.GET("/admin/settings").WithBasicAuth("invalidusername", "invalidpassword"). diff --git a/_examples/bootstrapper/main_test.go b/_examples/bootstrapper/main_test.go index 959c04eb2..df05c65f3 100644 --- a/_examples/bootstrapper/main_test.go +++ b/_examples/bootstrapper/main_test.go @@ -14,11 +14,11 @@ func TestApp(t *testing.T) { // test our routes e.GET("/").Expect().Status(httptest.StatusOK) e.GET("/follower/42").Expect().Status(httptest.StatusOK). - Body().Equal("from /follower/{id:int64} with ID: 42") + Body().IsEqual("from /follower/{id:int64} with ID: 42") e.GET("/following/52").Expect().Status(httptest.StatusOK). - Body().Equal("from /following/{id:int64} with ID: 52") + Body().IsEqual("from /following/{id:int64} with ID: 52") e.GET("/like/64").Expect().Status(httptest.StatusOK). - Body().Equal("from /like/{id:int64} with ID: 64") + Body().IsEqual("from /like/{id:int64} with ID: 64") // test not found e.GET("/notfound").Expect().Status(httptest.StatusNotFound) @@ -28,5 +28,5 @@ func TestApp(t *testing.T) { "message": "", } e.GET("/anotfoundwithjson").WithQuery("json", nil). - Expect().Status(httptest.StatusNotFound).JSON().Equal(expectedErr) + Expect().Status(httptest.StatusNotFound).JSON().IsEqual(expectedErr) } diff --git a/_examples/cookies/basic/main_test.go b/_examples/cookies/basic/main_test.go index 8dd994670..bd82d9c39 100644 --- a/_examples/cookies/basic/main_test.go +++ b/_examples/cookies/basic/main_test.go @@ -20,7 +20,7 @@ func TestCookiesBasic(t *testing.T) { // Test retrieve a Cookie. t2 := e.GET(fmt.Sprintf("/cookies/%s", cookieName)).Expect().Status(httptest.StatusOK) - t2.Body().Equal(cookieValue) + t2.Body().IsEqual(cookieValue) // Test remove a Cookie. t3 := e.DELETE(fmt.Sprintf("/cookies/%s", cookieName)).Expect().Status(httptest.StatusOK) @@ -28,5 +28,5 @@ func TestCookiesBasic(t *testing.T) { t4 := e.GET(fmt.Sprintf("/cookies/%s", cookieName)).Expect().Status(httptest.StatusOK) t4.Cookies().Empty() - t4.Body().Empty() + t4.Body().IsEmpty() } diff --git a/_examples/cookies/options/main_test.go b/_examples/cookies/options/main_test.go index 7f064d466..5a543832c 100644 --- a/_examples/cookies/options/main_test.go +++ b/_examples/cookies/options/main_test.go @@ -20,7 +20,7 @@ func TestCookieOptions(t *testing.T) { // Test retrieve a Cookie. t2 := e.GET(fmt.Sprintf("/get/%s", cookieName)).Expect().Status(httptest.StatusOK) - t2.Body().Equal(cookieValue) + t2.Body().IsEqual(cookieValue) // Test remove a Cookie. t3 := e.GET(fmt.Sprintf("/remove/%s", cookieName)).Expect().Status(httptest.StatusOK) @@ -28,5 +28,5 @@ func TestCookieOptions(t *testing.T) { t4 := e.GET(fmt.Sprintf("/get/%s", cookieName)).Expect().Status(httptest.StatusOK) t4.Cookies().Empty() - t4.Body().Empty() + t4.Body().IsEmpty() } diff --git a/_examples/cookies/securecookie/main_test.go b/_examples/cookies/securecookie/main_test.go index 0754c9bd1..bd8b682f7 100644 --- a/_examples/cookies/securecookie/main_test.go +++ b/_examples/cookies/securecookie/main_test.go @@ -22,7 +22,7 @@ func TestSecureCookie(t *testing.T) { // Test retrieve a Cookie. t2 := e.GET(fmt.Sprintf("/cookies/%s", cookieName)).Expect().Status(httptest.StatusOK) - t2.Body().Equal(cookieValue) + t2.Body().IsEqual(cookieValue) // Test remove a Cookie. t3 := e.GET(fmt.Sprintf("/cookies/remove/%s", cookieName)).Expect().Status(httptest.StatusOK) @@ -30,5 +30,5 @@ func TestSecureCookie(t *testing.T) { t4 := e.GET(fmt.Sprintf("/cookies/%s", cookieName)).Expect().Status(httptest.StatusOK) t4.Cookies().Empty() - t4.Body().Empty() + t4.Body().IsEmpty() } diff --git a/_examples/dependency-injection/basic/middleware/main_test.go b/_examples/dependency-injection/basic/middleware/main_test.go index eb90c87b5..fdacc32dd 100644 --- a/_examples/dependency-injection/basic/middleware/main_test.go +++ b/_examples/dependency-injection/basic/middleware/main_test.go @@ -12,14 +12,14 @@ func TestDependencyInjectionBasic_Middleware(t *testing.T) { e := httptest.New(t, app) e.POST("/42").WithJSON(testInput{Email: "my_email"}).Expect(). Status(httptest.StatusOK). - JSON().Equal(testOutput{ID: 42, Name: "my_email"}) + JSON().IsEqual(testOutput{ID: 42, Name: "my_email"}) // it should stop the execution at the middleware and return the middleware's status code, // because the error is `ErrStopExecution`. e.POST("/42").WithJSON(testInput{Email: "invalid"}).Expect(). - Status(httptest.StatusAccepted).Body().Empty() + Status(httptest.StatusAccepted).Body().IsEmpty() // it should stop the execution at the middleware and return the error's text. e.POST("/42").WithJSON(testInput{Email: "error"}).Expect(). - Status(httptest.StatusConflict).Body().Equal("my_error") + Status(httptest.StatusConflict).Body().IsEqual("my_error") } diff --git a/_examples/file-server/basic/main_test.go b/_examples/file-server/basic/main_test.go index a27067bb0..cdd6b46b2 100644 --- a/_examples/file-server/basic/main_test.go +++ b/_examples/file-server/basic/main_test.go @@ -89,7 +89,7 @@ func TestFileServerBasic(t *testing.T) { e.GET(url).Expect(). Status(httptest.StatusOK). ContentType(u.contentType(), app.ConfigurationReadOnly().GetCharset()). - Body().Equal(contents) + Body().IsEqual(contents) } } @@ -109,6 +109,6 @@ func TestHandleDirDot(t *testing.T) { e.GET(url).Expect(). Status(httptest.StatusOK). ContentType(u.contentType(), app.ConfigurationReadOnly().GetCharset()). - Body().Equal(contents) + Body().IsEqual(contents) } } diff --git a/_examples/file-server/embedding-files-into-app-bindata/main_test.go b/_examples/file-server/embedding-files-into-app-bindata/main_test.go index c8dcf3fd0..fc546e557 100644 --- a/_examples/file-server/embedding-files-into-app-bindata/main_test.go +++ b/_examples/file-server/embedding-files-into-app-bindata/main_test.go @@ -89,6 +89,6 @@ func TestEmbeddingFilesIntoApp(t *testing.T) { e.GET(url).Expect(). Status(httptest.StatusOK). ContentType(u.contentType()). - Body().Equal(contents) + Body().IsEqual(contents) } } diff --git a/_examples/file-server/embedding-files-into-app/main_test.go b/_examples/file-server/embedding-files-into-app/main_test.go index ee3f62834..ee3978906 100644 --- a/_examples/file-server/embedding-files-into-app/main_test.go +++ b/_examples/file-server/embedding-files-into-app/main_test.go @@ -84,6 +84,6 @@ func TestEmbeddingFilesIntoApp(t *testing.T) { e.GET(url).Expect(). Status(httptest.StatusOK). ContentType(u.contentType()). - Body().Equal(contents) + Body().IsEqual(contents) } } diff --git a/_examples/file-server/single-page-application/embedded-single-page-application/main_test.go b/_examples/file-server/single-page-application/embedded-single-page-application/main_test.go index d1b641472..c1302d1e2 100644 --- a/_examples/file-server/single-page-application/embedded-single-page-application/main_test.go +++ b/_examples/file-server/single-page-application/embedded-single-page-application/main_test.go @@ -77,7 +77,7 @@ func TestSPAEmbedded(t *testing.T) { e.GET(url).Expect(). Status(httptest.StatusOK). ContentType(u.contentType(), app.ConfigurationReadOnly().GetCharset()). - Body().Equal(contents) + Body().IsEqual(contents) } e.GET("/index.html").Expect().Status(httptest.StatusNotFound) // only root is served. diff --git a/_examples/file-server/subdomain/main_test.go b/_examples/file-server/subdomain/main_test.go index 8674dd39b..ea0504ccf 100644 --- a/_examples/file-server/subdomain/main_test.go +++ b/_examples/file-server/subdomain/main_test.go @@ -76,6 +76,6 @@ func TestFileServerSubdomainBasic(t *testing.T) { e.GET(url).WithURL(host).Expect(). Status(httptest.StatusOK). ContentType(u.contentType(), app.ConfigurationReadOnly().GetCharset()). - Body().Equal(contents) + Body().IsEqual(contents) } } diff --git a/_examples/i18n/basic/main_test.go b/_examples/i18n/basic/main_test.go index 73f86d1d2..f25c4e2ce 100644 --- a/_examples/i18n/basic/main_test.go +++ b/_examples/i18n/basic/main_test.go @@ -40,49 +40,49 @@ func TestI18n(t *testing.T) { e := httptest.New(t, app) // default should be en-US. - e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal(tests["en-US"]) + e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual(tests["en-US"]) for lang, body := range tests { e.GET("/").WithQueryString("lang=" + lang).Expect().Status(httptest.StatusOK). - Body().Equal(body) + Body().IsEqual(body) // test lowercase. e.GET("/").WithQueryString("lang=" + strings.ToLower(lang)).Expect().Status(httptest.StatusOK). - Body().Equal(body) + Body().IsEqual(body) // test first part (e.g. en instead of en-US). langFirstPart := strings.Split(lang, "-")[0] e.GET("/").WithQueryString("lang=" + langFirstPart).Expect().Status(httptest.StatusOK). - Body().Equal(body) + Body().IsEqual(body) // test accept-language header prefix (i18n wrapper). e.GET("/"+lang).WithHeader("Accept-Language", lang).Expect().Status(httptest.StatusOK). - Body().Equal(body) + Body().IsEqual(body) // test path prefix (i18n router wrapper). e.GET("/" + lang).Expect().Status(httptest.StatusOK). - Body().Equal(body) + Body().IsEqual(body) // test path prefix with first part. e.GET("/" + langFirstPart).Expect().Status(httptest.StatusOK). - Body().Equal(body) + Body().IsEqual(body) } e.GET("/other").WithQueryString("lang=el-GR").Expect().Status(httptest.StatusOK). - Body().Equal(elgrMulti) + Body().IsEqual(elgrMulti) e.GET("/other").WithQueryString("lang=en-US").Expect().Status(httptest.StatusOK). - Body().Equal(enusMulti) + Body().IsEqual(enusMulti) // test path prefix (i18n router wrapper). e.GET("/el-gr/other").Expect().Status(httptest.StatusOK). - Body().Equal(elgrMulti) + Body().IsEqual(elgrMulti) e.GET("/en/other").Expect().Status(httptest.StatusOK). - Body().Equal(enusMulti) + Body().IsEqual(enusMulti) e.GET("/el-GRtemplates").Expect().Status(httptest.StatusNotFound) e.GET("/el-templates").Expect().Status(httptest.StatusNotFound) e.GET("/el/templates").Expect().Status(httptest.StatusOK).Body().Contains(elGR).Contains(zhCN) - e.GET("/not-matched").WithQuery("lang", "en-gb").Expect().Status(httptest.StatusOK).Body().Equal("user language input: en-gb: matched as: en-US: not found key: not_found_key: args: [some values 42]") + e.GET("/not-matched").WithQuery("lang", "en-gb").Expect().Status(httptest.StatusOK).Body().IsEqual("user language input: en-gb: matched as: en-US: not found key: not_found_key: args: [some values 42]") } diff --git a/_examples/i18n/template-embedded/main_test.go b/_examples/i18n/template-embedded/main_test.go index 3aa2788be..b23e24799 100644 --- a/_examples/i18n/template-embedded/main_test.go +++ b/_examples/i18n/template-embedded/main_test.go @@ -11,11 +11,11 @@ func TestI18nLoaderFuncMap(t *testing.T) { e := httptest.New(t, app) e.GET("/").Expect().Status(httptest.StatusOK). - Body().Equal("Become a MEMBER") + Body().IsEqual("Become a MEMBER") e.GET("/title").Expect().Status(httptest.StatusOK). - Body().Equal("Account Connections") + Body().IsEqual("Account Connections") e.GET("/").WithHeader("Accept-Language", "el").Expect().Status(httptest.StatusOK). - Body().Equal("Γίνε ΜΈΛΟΣ") + Body().IsEqual("Γίνε ΜΈΛΟΣ") e.GET("/title").WithHeader("Accept-Language", "el").Expect().Status(httptest.StatusOK). - Body().Equal("Λογαριασμός Συνδέσεις") + Body().IsEqual("Λογαριασμός Συνδέσεις") } diff --git a/_examples/i18n/template/main_test.go b/_examples/i18n/template/main_test.go index 3aa2788be..b23e24799 100644 --- a/_examples/i18n/template/main_test.go +++ b/_examples/i18n/template/main_test.go @@ -11,11 +11,11 @@ func TestI18nLoaderFuncMap(t *testing.T) { e := httptest.New(t, app) e.GET("/").Expect().Status(httptest.StatusOK). - Body().Equal("Become a MEMBER") + Body().IsEqual("Become a MEMBER") e.GET("/title").Expect().Status(httptest.StatusOK). - Body().Equal("Account Connections") + Body().IsEqual("Account Connections") e.GET("/").WithHeader("Accept-Language", "el").Expect().Status(httptest.StatusOK). - Body().Equal("Γίνε ΜΈΛΟΣ") + Body().IsEqual("Γίνε ΜΈΛΟΣ") e.GET("/title").WithHeader("Accept-Language", "el").Expect().Status(httptest.StatusOK). - Body().Equal("Λογαριασμός Συνδέσεις") + Body().IsEqual("Λογαριασμός Συνδέσεις") } diff --git a/_examples/logging/json-logger/main_test.go b/_examples/logging/json-logger/main_test.go index 7997fcf98..74c66cb38 100644 --- a/_examples/logging/json-logger/main_test.go +++ b/_examples/logging/json-logger/main_test.go @@ -36,7 +36,7 @@ func TestJSONLogger(t *testing.T) { wg.Add(iters) for i := 0; i < iters; i++ { go func() { - e.GET("/ping").Expect().Status(httptest.StatusOK).Body().Equal("pong") + e.GET("/ping").Expect().Status(httptest.StatusOK).Body().IsEqual("pong") wg.Done() }() } diff --git a/_examples/mvc/authenticated-controller/main_test.go b/_examples/mvc/authenticated-controller/main_test.go index df47e18ec..a65a9956c 100644 --- a/_examples/mvc/authenticated-controller/main_test.go +++ b/_examples/mvc/authenticated-controller/main_test.go @@ -11,14 +11,14 @@ func TestMVCOverlapping(t *testing.T) { e := httptest.New(t, app, httptest.URL("http://example.com")) // unauthenticated. - e.GET("/user").Expect().Status(httptest.StatusOK).Body().Equal("custom action to redirect on authentication page") + e.GET("/user").Expect().Status(httptest.StatusOK).Body().IsEqual("custom action to redirect on authentication page") // login. e.POST("/user/login").Expect().Status(httptest.StatusOK) // authenticated. - e.GET("/user").Expect().Status(httptest.StatusOK).Body().Equal(`UserController.Get: The Authenticated type + e.GET("/user").Expect().Status(httptest.StatusOK).Body().IsEqual(`UserController.Get: The Authenticated type can be used to secure a controller's method too.`) // logout. e.POST("/user/logout").Expect().Status(httptest.StatusOK) // unauthenticated. - e.GET("/user").Expect().Status(httptest.StatusOK).Body().Equal("custom action to redirect on authentication page") + e.GET("/user").Expect().Status(httptest.StatusOK).Body().IsEqual("custom action to redirect on authentication page") } diff --git a/_examples/mvc/error-handler-http/main_test.go b/_examples/mvc/error-handler-http/main_test.go index 7a1010913..f1cd4fe27 100644 --- a/_examples/mvc/error-handler-http/main_test.go +++ b/_examples/mvc/error-handler-http/main_test.go @@ -15,6 +15,6 @@ func TestControllerHandleHTTPError(t *testing.T) { app := newApp() e := httptest.New(t, app) - e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal(expectedIndex) - e.GET("/a_notefound").Expect().Status(httptest.StatusNotFound).ContentType("text/html").Body().Equal(expectedNotFound) + e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual(expectedIndex) + e.GET("/a_notefound").Expect().Status(httptest.StatusNotFound).ContentType("text/html").Body().IsEqual(expectedNotFound) } diff --git a/_examples/mvc/grpc-compatible/main_test.go b/_examples/mvc/grpc-compatible/main_test.go index f937b9d99..e525519b7 100644 --- a/_examples/mvc/grpc-compatible/main_test.go +++ b/_examples/mvc/grpc-compatible/main_test.go @@ -12,5 +12,5 @@ func TestGRPCCompatible(t *testing.T) { e := httptest.New(t, app) e.POST("/helloworld.Greeter/SayHello").WithJSON(map[string]string{"name": "makis"}).Expect(). Status(httptest.StatusOK). - JSON().Equal(map[string]string{"message": "Hello makis"}) + JSON().IsEqual(map[string]string{"message": "Hello makis"}) } diff --git a/_examples/mvc/hello-world/main_test.go b/_examples/mvc/hello-world/main_test.go index 5fe2d3680..22c1df91b 100644 --- a/_examples/mvc/hello-world/main_test.go +++ b/_examples/mvc/hello-world/main_test.go @@ -10,14 +10,14 @@ func TestMVCHelloWorld(t *testing.T) { e := httptest.New(t, newApp()) e.GET("/").Expect().Status(httptest.StatusOK). - ContentType("text/html", "utf-8").Body().Equal("

Welcome

") + ContentType("text/html", "utf-8").Body().IsEqual("

Welcome

") e.GET("/ping").Expect().Status(httptest.StatusOK). - Body().Equal("pong") + Body().IsEqual("pong") e.GET("/hello").Expect().Status(httptest.StatusOK). JSON().Object().Value("message").Equal("Hello Iris!") e.GET("/custom_path").Expect().Status(httptest.StatusOK). - Body().Equal("hello from the custom handler without following the naming guide") + Body().IsEqual("hello from the custom handler without following the naming guide") } diff --git a/_examples/mvc/versioned-controller/main_test.go b/_examples/mvc/versioned-controller/main_test.go index 33cedd42d..a79061040 100644 --- a/_examples/mvc/versioned-controller/main_test.go +++ b/_examples/mvc/versioned-controller/main_test.go @@ -13,21 +13,21 @@ func TestVersionedController(t *testing.T) { e := httptest.New(t, app) e.GET("/data").WithHeader(versioning.AcceptVersionHeaderKey, "1.0.0").Expect(). - Status(iris.StatusOK).Body().Equal("data (v1.x)") + Status(iris.StatusOK).Body().IsEqual("data (v1.x)") e.GET("/data").WithHeader(versioning.AcceptVersionHeaderKey, "2.3.0").Expect(). - Status(iris.StatusOK).Body().Equal("data (v2.x)") + Status(iris.StatusOK).Body().IsEqual("data (v2.x)") e.GET("/data").WithHeader(versioning.AcceptVersionHeaderKey, "3.1.0").Expect(). - Status(iris.StatusOK).Body().Equal("data (v3.x)") + Status(iris.StatusOK).Body().IsEqual("data (v3.x)") // Test invalid version or no version at all. e.GET("/data").WithHeader(versioning.AcceptVersionHeaderKey, "4.0.0").Expect(). - Status(iris.StatusOK).Body().Equal("data") + Status(iris.StatusOK).Body().IsEqual("data") e.GET("/data").Expect(). - Status(iris.StatusOK).Body().Equal("data") + Status(iris.StatusOK).Body().IsEqual("data") // Test Deprecated (v1) ex := e.GET("/data").WithHeader(versioning.AcceptVersionHeaderKey, "1.0.0").Expect() - ex.Status(iris.StatusOK).Body().Equal("data (v1.x)") + ex.Status(iris.StatusOK).Body().IsEqual("data (v1.x)") ex.Header("X-API-Warn").Equal(opts.WarnMessage) expectedDateStr := opts.DeprecationDate.Format(app.ConfigurationReadOnly().GetTimeFormat()) ex.Header("X-API-Deprecation-Date").Equal(expectedDateStr) diff --git a/_examples/request-body/read-body/main_test.go b/_examples/request-body/read-body/main_test.go index 25101b6de..6ab790657 100644 --- a/_examples/request-body/read-body/main_test.go +++ b/_examples/request-body/read-body/main_test.go @@ -20,31 +20,31 @@ func TestReadBodyAndNegotiate(t *testing.T) { // Test send JSON and receive JSON. e.POST("/").WithJSON(expectedPayload).Expect().Status(httptest.StatusOK). - JSON().Equal(expectedPayload) + JSON().IsEqual(expectedPayload) // Test send Form and receive XML. e.POST("/").WithForm(expectedPayload). WithHeader("Accept", "application/xml"). Expect().Status(httptest.StatusOK). - Body().Equal(expectedXMLPayload) + Body().IsEqual(expectedXMLPayload) // Test send URL Query and receive MessagePack. e.POST("/").WithQuery("message", expectedPayload.Message). WithHeader("Accept", "application/msgpack"). Expect().Status(httptest.StatusOK).ContentType("application/msgpack"). - Body().Equal(expectedMsgPackPayload) + Body().IsEqual(expectedMsgPackPayload) // Test send MessagePack and receive MessagePack. e.POST("/").WithBytes([]byte(expectedMsgPackPayload)). WithHeader("Content-Type", "application/msgpack"). WithHeader("Accept", "application/msgpack"). Expect().Status(httptest.StatusOK). - ContentType("application/msgpack").Body().Equal(expectedMsgPackPayload) + ContentType("application/msgpack").Body().IsEqual(expectedMsgPackPayload) // Test send YAML and receive YAML. e.POST("/").WithBytes([]byte(expectedYAMLPayload)). WithHeader("Content-Type", "application/x-yaml"). WithHeader("Accept", "application/x-yaml"). Expect().Status(httptest.StatusOK). - ContentType("application/x-yaml").Body().Equal(expectedYAMLPayload) + ContentType("application/x-yaml").Body().IsEqual(expectedYAMLPayload) } diff --git a/_examples/request-body/read-custom-per-type/main_test.go b/_examples/request-body/read-custom-per-type/main_test.go index 70b96c04a..448367cdf 100644 --- a/_examples/request-body/read-custom-per-type/main_test.go +++ b/_examples/request-body/read-custom-per-type/main_test.go @@ -13,5 +13,5 @@ func TestReadCustomPerType(t *testing.T) { expectedResponse := `Received: main.config{Addr:"localhost:8080", ServerName:"Iris"}` e.POST("/").WithText("addr: localhost:8080\nserverName: Iris").Expect(). - Status(httptest.StatusOK).Body().Equal(expectedResponse) + Status(httptest.StatusOK).Body().IsEqual(expectedResponse) } diff --git a/_examples/request-body/read-custom-via-unmarshaler/main_test.go b/_examples/request-body/read-custom-via-unmarshaler/main_test.go index 75efdd768..9359f042b 100644 --- a/_examples/request-body/read-custom-via-unmarshaler/main_test.go +++ b/_examples/request-body/read-custom-via-unmarshaler/main_test.go @@ -13,5 +13,5 @@ func TestReadCustomViaUnmarshaler(t *testing.T) { expectedResponse := `Received: main.config{Addr:"localhost:8080", ServerName:"Iris"}` e.POST("/").WithText("addr: localhost:8080\nserverName: Iris").Expect(). - Status(httptest.StatusOK).Body().Equal(expectedResponse) + Status(httptest.StatusOK).Body().IsEqual(expectedResponse) } diff --git a/_examples/request-body/read-params/main_test.go b/_examples/request-body/read-params/main_test.go index 23293423b..debfee580 100644 --- a/_examples/request-body/read-params/main_test.go +++ b/_examples/request-body/read-params/main_test.go @@ -12,5 +12,5 @@ func TestReadParams(t *testing.T) { e := httptest.New(t, app) expectedBody := `myParams: main.myParams{Name:"kataras", Age:27, Tail:[]string{"iris", "web", "framework"}}` - e.GET("/kataras/27/iris/web/framework").Expect().Status(httptest.StatusOK).Body().Equal(expectedBody) + e.GET("/kataras/27/iris/web/framework").Expect().Status(httptest.StatusOK).Body().IsEqual(expectedBody) } diff --git a/_examples/request-body/read-url/main_test.go b/_examples/request-body/read-url/main_test.go index 211069004..ffb6232fb 100644 --- a/_examples/request-body/read-url/main_test.go +++ b/_examples/request-body/read-url/main_test.go @@ -12,5 +12,5 @@ func TestReadURL(t *testing.T) { e := httptest.New(t, app) expectedBody := `myURL: main.myURL{Name:"kataras", Age:27, Tail:[]string{"iris", "web", "framework"}}` - e.GET("/iris/web/framework").WithQuery("name", "kataras").WithQuery("age", 27).Expect().Status(httptest.StatusOK).Body().Equal(expectedBody) + e.GET("/iris/web/framework").WithQuery("name", "kataras").WithQuery("age", 27).Expect().Status(httptest.StatusOK).Body().IsEqual(expectedBody) } diff --git a/_examples/request-body/read-xml/main_test.go b/_examples/request-body/read-xml/main_test.go index 3fa36b315..1cce03e2b 100644 --- a/_examples/request-body/read-xml/main_test.go +++ b/_examples/request-body/read-xml/main_test.go @@ -14,5 +14,5 @@ func TestReadXML(t *testing.T) { send := `Description of this person, the body of this inner element.` e.POST("/").WithText(send).Expect(). - Status(httptest.StatusOK).Body().Equal(expectedResponse) + Status(httptest.StatusOK).Body().IsEqual(expectedResponse) } diff --git a/_examples/request-body/read-yaml/main_test.go b/_examples/request-body/read-yaml/main_test.go index 644ba5589..971e4e5d4 100644 --- a/_examples/request-body/read-yaml/main_test.go +++ b/_examples/request-body/read-yaml/main_test.go @@ -20,5 +20,5 @@ comments: > Billsmer @ 338-4338.` e.POST("/").WithHeader("Content-Type", "application/x-yaml").WithBytes([]byte(send)).Expect(). - Status(httptest.StatusOK).Body().Equal(expectedResponse) + Status(httptest.StatusOK).Body().IsEqual(expectedResponse) } diff --git a/_examples/response-writer/content-negotiation/main_test.go b/_examples/response-writer/content-negotiation/main_test.go index acb5bf9d6..c4794e5e8 100644 --- a/_examples/response-writer/content-negotiation/main_test.go +++ b/_examples/response-writer/content-negotiation/main_test.go @@ -28,33 +28,33 @@ func TestContentNegotiation(t *testing.T) { e.GET("/resource").WithHeader("Accept", "application/json"). Expect().Status(httptest.StatusOK). ContentType("application/json", "utf-8"). - JSON().Equal(expectedJSONResponse) + JSON().IsEqual(expectedJSONResponse) e.GET("/resource").WithHeader("Accept", "application/xml").WithHeader("Accept-Charset", "iso-8859-7"). Expect().Status(httptest.StatusOK). ContentType("application/xml", "iso-8859-7"). - Body().Equal(string(expectedXMLResponse)) + Body().IsEqual(string(expectedXMLResponse)) e.GET("/resource2").WithHeader("Accept", "application/json"). Expect().Status(httptest.StatusOK). ContentType("application/json", "utf-8"). - JSON().Equal(expectedJSONResponse) + JSON().IsEqual(expectedJSONResponse) e.GET("/resource2").WithHeader("Accept", "application/xml"). Expect().Status(httptest.StatusOK). ContentType("application/xml", "utf-8"). - Body().Equal(string(expectedXMLResponse)) + Body().IsEqual(string(expectedXMLResponse)) e.GET("/resource2").WithHeader("Accept", "text/html"). Expect().Status(httptest.StatusOK). ContentType("text/html", "utf-8"). - Body().Equal(expectedHTMLResponse) + Body().IsEqual(expectedHTMLResponse) e.GET("/resource3").WithHeader("Accept", "application/json"). Expect().Status(httptest.StatusOK). ContentType("application/json", "utf-8"). - JSON().Equal(expectedJSONResponse) + JSON().IsEqual(expectedJSONResponse) e.GET("/resource3").WithHeader("Accept", "application/xml"). Expect().Status(httptest.StatusOK). ContentType("application/xml", "utf-8"). - Body().Equal(string(expectedXMLResponse)) + Body().IsEqual(string(expectedXMLResponse)) // test html with "gzip" encoding algorithm. rawGzipResponse := e.GET("/resource3").WithHeader("Accept", "text/html"). diff --git a/_examples/routing/basic/main_test.go b/_examples/routing/basic/main_test.go index 5756fb3d6..577c4ab84 100644 --- a/_examples/routing/basic/main_test.go +++ b/_examples/routing/basic/main_test.go @@ -50,39 +50,39 @@ func TestRoutingBasic(t *testing.T) { e := httptest.New(t, app) e.GET("/anotfound").Expect().Status(httptest.StatusNotFound). - Body().Equal(expectedNotFoundResponse) + Body().IsEqual(expectedNotFoundResponse) e.GET("/").Expect().Status(httptest.StatusOK). - Body().Equal(expectedIndexResponse) + Body().IsEqual(expectedIndexResponse) e.GET("/home").Expect().Status(httptest.StatusOK). - Body().Equal(expectedHomeResponse) + Body().IsEqual(expectedHomeResponse) e.GET("/u/some/path/here").Expect().Status(httptest.StatusOK). - Body().Equal(expectedUpathResponse) + Body().IsEqual(expectedUpathResponse) e.GET("/u/abcd123").Expect().Status(httptest.StatusOK). - Body().Equal(expectedUStringResponse) + Body().IsEqual(expectedUStringResponse) e.GET("/u/-1").Expect().Status(httptest.StatusOK). - Body().Equal(expectedUIntResponse) + Body().IsEqual(expectedUIntResponse) e.GET("/u/42").Expect().Status(httptest.StatusOK). - Body().Equal(expectedUUintResponse) + Body().IsEqual(expectedUUintResponse) e.GET("/u/abcd").Expect().Status(httptest.StatusOK). - Body().Equal(expectedUAlphabeticalResponse) + Body().IsEqual(expectedUAlphabeticalResponse) e.GET("/api/users/42").Expect().Status(httptest.StatusOK). - JSON().Equal(expectedAPIUsersIndexResponse) + JSON().IsEqual(expectedAPIUsersIndexResponse) e.GET("/admin").Expect().Status(httptest.StatusOK). - Body().Equal(expectedAdminIndexResponse) + Body().IsEqual(expectedAdminIndexResponse) e.Request("GET", "/").WithURL("http://v1.example.com").Expect().Status(httptest.StatusOK). - Body().Equal(expectedSubdomainV1IndexResponse) + Body().IsEqual(expectedSubdomainV1IndexResponse) e.Request("GET", "/api/users").WithURL("http://v1.example.com").Expect().Status(httptest.StatusOK). - Body().Equal(expectedSubdomainV1APIUsersIndexResponse) + Body().IsEqual(expectedSubdomainV1APIUsersIndexResponse) e.Request("GET", "/api/users/42").WithURL("http://v1.example.com").Expect().Status(httptest.StatusOK). - Body().Equal(expectedSubdomainV1APIUsersIndexWithParamResponse) + Body().IsEqual(expectedSubdomainV1APIUsersIndexWithParamResponse) e.Request("GET", "/").WithURL("http://any-subdomain-here.example.com").Expect().Status(httptest.StatusOK). - Body().Equal(expectedSubdomainWildcardIndexResponse) + Body().IsEqual(expectedSubdomainWildcardIndexResponse) } diff --git a/_examples/routing/conditional-chain/main_test.go b/_examples/routing/conditional-chain/main_test.go index ca0bb139f..0d2a05424 100644 --- a/_examples/routing/conditional-chain/main_test.go +++ b/_examples/routing/conditional-chain/main_test.go @@ -11,7 +11,7 @@ func TestNewConditionalHandler(t *testing.T) { e := httptest.New(t, app) e.GET("/api/v1/users").Expect().Status(httptest.StatusOK). - Body().Equal("requested: /api/v1/users") + Body().IsEqual("requested: /api/v1/users") e.GET("/api/v1/users").WithQuery("admin", "true").Expect().Status(httptest.StatusOK). - Body().Equal("Admin\n

Hello Admin


requested: /api/v1/users") + Body().IsEqual("Admin\n

Hello Admin


requested: /api/v1/users") } diff --git a/_examples/routing/custom-wrapper/main_test.go b/_examples/routing/custom-wrapper/main_test.go index 638cab5b3..40de3fdf1 100644 --- a/_examples/routing/custom-wrapper/main_test.go +++ b/_examples/routing/custom-wrapper/main_test.go @@ -54,7 +54,7 @@ func TestCustomWrapper(t *testing.T) { e.GET(url).Expect(). Status(httptest.StatusOK). - Body().Equal(contents) + Body().IsEqual(contents) } e.GET("/other/something").Expect().Status(httptest.StatusOK) diff --git a/_examples/routing/dynamic-path/same-pattern-different-func/main_test.go b/_examples/routing/dynamic-path/same-pattern-different-func/main_test.go index 1e99dd6c2..c98a93d56 100644 --- a/_examples/routing/dynamic-path/same-pattern-different-func/main_test.go +++ b/_examples/routing/dynamic-path/same-pattern-different-func/main_test.go @@ -35,7 +35,7 @@ func TestSameParameterTypeDifferentMacroFunctions(t *testing.T) { } ) - e.GET("/").Expect().Status(httptest.StatusOK).JSON().Equal(expectedIndex) - e.GET("/api/random.html").Expect().Status(httptest.StatusOK).JSON().Equal(expectedHTMLPage) - e.GET("/api/random.zip").Expect().Status(httptest.StatusOK).JSON().Equal(expectedZipName) + e.GET("/").Expect().Status(httptest.StatusOK).JSON().IsEqual(expectedIndex) + e.GET("/api/random.html").Expect().Status(httptest.StatusOK).JSON().IsEqual(expectedHTMLPage) + e.GET("/api/random.zip").Expect().Status(httptest.StatusOK).JSON().IsEqual(expectedZipName) } diff --git a/_examples/routing/dynamic-path/same-pattern-different-func/use-global/main_test.go b/_examples/routing/dynamic-path/same-pattern-different-func/use-global/main_test.go index 6cc2cc58e..835765a83 100644 --- a/_examples/routing/dynamic-path/same-pattern-different-func/use-global/main_test.go +++ b/_examples/routing/dynamic-path/same-pattern-different-func/use-global/main_test.go @@ -20,6 +20,6 @@ func TestSamePatternDifferentFuncUseGlobal(t *testing.T) { for path, mainBody := range tests { result := fmt.Sprintf(expectedResultFmt, mainBody, path[1:]) - e.GET(path).Expect().Status(httptest.StatusOK).Body().Equal(result) + e.GET(path).Expect().Status(httptest.StatusOK).Body().IsEqual(result) } } diff --git a/_examples/routing/http-errors/reset-body/main_test.go b/_examples/routing/http-errors/reset-body/main_test.go index 3218213e1..6add7c12e 100644 --- a/_examples/routing/http-errors/reset-body/main_test.go +++ b/_examples/routing/http-errors/reset-body/main_test.go @@ -10,5 +10,5 @@ func TestResetCompressionAndFireError(t *testing.T) { // #1569 app := newApp() e := httptest.New(t, app) - e.GET("/").Expect().Status(httptest.StatusBadRequest).Body().Equal("custom error") + e.GET("/").Expect().Status(httptest.StatusBadRequest).Body().IsEqual("custom error") } diff --git a/_examples/routing/main_test.go b/_examples/routing/main_test.go index 93db302d0..cf12c9fef 100644 --- a/_examples/routing/main_test.go +++ b/_examples/routing/main_test.go @@ -116,26 +116,26 @@ func TestRouting(t *testing.T) { if tt.subdomain != "" { et.WithURL("http://" + tt.subdomain + ".localhost:8080") } - et.Expect().Status(tt.status).Body().Equal(tt.expectedBody) + et.Expect().Status(tt.status).Body().IsEqual(tt.expectedBody) } // test POST "/" limit data and post data return // test with small body - e.POST("/").WithBytes([]byte("ok")).Expect().Status(httptest.StatusOK).Body().Equal("ok") + e.POST("/").WithBytes([]byte("ok")).Expect().Status(httptest.StatusOK).Body().IsEqual("ok") // test with equal to max body size limit bsent := make([]byte, maxBodySize, maxBodySize) e.POST("/").WithBytes(bsent).Expect().Status(httptest.StatusOK).Body().Length().Equal(len(bsent)) // test with larger body sent and wait for the custom response largerBSent := make([]byte, maxBodySize+1, maxBodySize+1) - e.POST("/").WithBytes(largerBSent).Expect().Status(httptest.StatusBadRequest).Body().Equal("http: request body too large") + e.POST("/").WithBytes(largerBSent).Expect().Status(httptest.StatusBadRequest).Body().IsEqual("http: request body too large") // test the post value (both post and put) and headers. e.PUT("/postvalue").WithFormField("name", "test_put"). WithHeader("headername", "headervalue_put").Expect(). - Status(httptest.StatusOK).Body().Equal("Hello test_put | headervalue_put") + Status(httptest.StatusOK).Body().IsEqual("Hello test_put | headervalue_put") e.POST("/postvalue").WithFormField("name", "test_post"). WithHeader("headername", "headervalue_post").Expect(). - Status(httptest.StatusOK).Body().Equal("Hello test_post | headervalue_post") + Status(httptest.StatusOK).Body().IsEqual("Hello test_post | headervalue_post") } diff --git a/_examples/routing/remove-handler/main_test.go b/_examples/routing/remove-handler/main_test.go index fa80d1771..b9978345d 100644 --- a/_examples/routing/remove-handler/main_test.go +++ b/_examples/routing/remove-handler/main_test.go @@ -10,5 +10,5 @@ func TestSimpleRouteRemoveHandler(t *testing.T) { app := newApp() e := httptest.New(t, app) - e.GET("/api/users").Expect().Status(httptest.StatusOK).Body().Equal("OK") + e.GET("/api/users").Expect().Status(httptest.StatusOK).Body().IsEqual("OK") } diff --git a/_examples/routing/sitemap/main_test.go b/_examples/routing/sitemap/main_test.go index 432fc9a5b..9ec53af1e 100644 --- a/_examples/routing/sitemap/main_test.go +++ b/_examples/routing/sitemap/main_test.go @@ -14,5 +14,5 @@ func TestSitemap(t *testing.T) { app.Configure(iris.WithSitemap(startURL)) e := httptest.New(t, app) - e.GET("/sitemap.xml").Expect().Status(httptest.StatusOK).Body().Equal(expectedFullSitemapXML) + e.GET("/sitemap.xml").Expect().Status(httptest.StatusOK).Body().IsEqual(expectedFullSitemapXML) } diff --git a/_examples/routing/subdomains/www/main_test.go b/_examples/routing/subdomains/www/main_test.go index 10686065f..7fd4c95da 100644 --- a/_examples/routing/subdomains/www/main_test.go +++ b/_examples/routing/subdomains/www/main_test.go @@ -52,6 +52,6 @@ func TestSubdomainWWW(t *testing.T) { req.Expect(). Status(httptest.StatusOK). - Body().Equal(test.response()) + Body().IsEqual(test.response()) } } diff --git a/_examples/routing/writing-a-middleware/share-funcs/main_test.go b/_examples/routing/writing-a-middleware/share-funcs/main_test.go index a6057d935..2dbc261d3 100644 --- a/_examples/routing/writing-a-middleware/share-funcs/main_test.go +++ b/_examples/routing/writing-a-middleware/share-funcs/main_test.go @@ -10,7 +10,7 @@ func TestShareFuncs(t *testing.T) { app := newApp() e := httptest.New(t, app) - e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal("Hello, Gophers!") - e.GET("/2").Expect().Status(httptest.StatusOK).Body().Equal("Hello, Gophers [2]!") - e.GET("/3").Expect().Status(httptest.StatusOK).Body().Equal("OK, job was executed.\nSee the command prompt.") + e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual("Hello, Gophers!") + e.GET("/2").Expect().Status(httptest.StatusOK).Body().IsEqual("Hello, Gophers [2]!") + e.GET("/3").Expect().Status(httptest.StatusOK).Body().IsEqual("OK, job was executed.\nSee the command prompt.") } diff --git a/_examples/routing/writing-a-middleware/share-services/main_test.go b/_examples/routing/writing-a-middleware/share-services/main_test.go index a5b5e137d..e4024c314 100644 --- a/_examples/routing/writing-a-middleware/share-services/main_test.go +++ b/_examples/routing/writing-a-middleware/share-services/main_test.go @@ -10,5 +10,5 @@ func TestShareServices(t *testing.T) { app := newApp() e := httptest.New(t, app) - e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal("Hello, Gophers!") + e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual("Hello, Gophers!") } diff --git a/_examples/sessions/securecookie/main_test.go b/_examples/sessions/securecookie/main_test.go index 6b0304b18..43af58db6 100644 --- a/_examples/sessions/securecookie/main_test.go +++ b/_examples/sessions/securecookie/main_test.go @@ -14,14 +14,14 @@ func TestSessionsEncodeDecode(t *testing.T) { es := e.GET("/set").Expect() es.Status(iris.StatusOK) es.Cookies().NotEmpty() - es.Body().Equal("All ok session set to: iris [isNew=true]") + es.Body().IsEqual("All ok session set to: iris [isNew=true]") - e.GET("/get").Expect().Status(iris.StatusOK).Body().Equal("The username on the /set was: iris") + e.GET("/get").Expect().Status(iris.StatusOK).Body().IsEqual("The username on the /set was: iris") // delete and re-get e.GET("/delete").Expect().Status(iris.StatusOK) - e.GET("/get").Expect().Status(iris.StatusOK).Body().Equal("The username on the /set was: ") + e.GET("/get").Expect().Status(iris.StatusOK).Body().IsEqual("The username on the /set was: ") // set, clear and re-get - e.GET("/set").Expect().Body().Equal("All ok session set to: iris [isNew=false]") + e.GET("/set").Expect().Body().IsEqual("All ok session set to: iris [isNew=false]") e.GET("/clear").Expect().Status(iris.StatusOK) - e.GET("/get").Expect().Status(iris.StatusOK).Body().Equal("The username on the /set was: ") + e.GET("/get").Expect().Status(iris.StatusOK).Body().IsEqual("The username on the /set was: ") } diff --git a/_examples/testing/httptest/main_test.go b/_examples/testing/httptest/main_test.go index 1846541d6..bc39a0dd8 100644 --- a/_examples/testing/httptest/main_test.go +++ b/_examples/testing/httptest/main_test.go @@ -19,11 +19,11 @@ func TestNewApp(t *testing.T) { // with valid basic auth e.GET("/admin").WithBasicAuth("myusername", "mypassword").Expect(). - Status(httptest.StatusOK).Body().Equal("/admin myusername:mypassword") + Status(httptest.StatusOK).Body().IsEqual("/admin myusername:mypassword") e.GET("/admin/profile").WithBasicAuth("myusername", "mypassword").Expect(). - Status(httptest.StatusOK).Body().Equal("/admin/profile myusername:mypassword") + Status(httptest.StatusOK).Body().IsEqual("/admin/profile myusername:mypassword") e.GET("/admin/settings").WithBasicAuth("myusername", "mypassword").Expect(). - Status(httptest.StatusOK).Body().Equal("/admin/settings myusername:mypassword") + Status(httptest.StatusOK).Body().IsEqual("/admin/settings myusername:mypassword") // with invalid basic auth e.GET("/admin/settings").WithBasicAuth("invalidusername", "invalidpassword"). diff --git a/_examples/view/quicktemplate/main_test.go b/_examples/view/quicktemplate/main_test.go index 5fcf94118..147db84bf 100644 --- a/_examples/view/quicktemplate/main_test.go +++ b/_examples/view/quicktemplate/main_test.go @@ -42,6 +42,6 @@ func TestResponseWriterQuicktemplate(t *testing.T) { e := httptest.New(t, app) - e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal(expectedIndexRawBody) - e.GET("/" + name).Expect().Status(httptest.StatusOK).Body().Equal(expectedHelloRawBody) + e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual(expectedIndexRawBody) + e.GET("/" + name).Expect().Status(httptest.StatusOK).Body().IsEqual(expectedHelloRawBody) } diff --git a/apps/switch_hosts_test.go b/apps/switch_hosts_test.go index da9cc1f7d..92f16509c 100644 --- a/apps/switch_hosts_test.go +++ b/apps/switch_hosts_test.go @@ -108,7 +108,7 @@ func TestSwitchHosts(t *testing.T) { body = "Switcher: Bad Gateway" } - e.GET(requestPath).WithURL(URL).Expect().Status(statusCode).Body().Equal(body) + e.GET(requestPath).WithURL(URL).Expect().Status(statusCode).Body().IsEqual(body) } } } @@ -204,7 +204,7 @@ func TestSwitchHostsRedirect(t *testing.T) { } } - e.GET(requestPath).WithURL(requestURL).Expect().Status(statusCode).Body().Equal(body) + e.GET(requestPath).WithURL(requestURL).Expect().Status(statusCode).Body().IsEqual(body) } } } diff --git a/apps/switch_options_test.go b/apps/switch_options_test.go index d398a2a69..e9b86edab 100644 --- a/apps/switch_options_test.go +++ b/apps/switch_options_test.go @@ -33,6 +33,6 @@ func TestSetHost(t *testing.T) { for _, tt := range tests { ex := tt.Expect().Status(iris.StatusOK) ex.Header("Server").Equal(rootApp.String()) - ex.Body().Equal(forceHost) + ex.Body().IsEqual(forceHost) } } diff --git a/cache/browser_test.go b/cache/browser_test.go index 7b0eac2e8..2be243809 100644 --- a/cache/browser_test.go +++ b/cache/browser_test.go @@ -22,7 +22,7 @@ func TestNoCache(t *testing.T) { e := httptest.New(t, app) r := e.GET("/").Expect().Status(httptest.StatusOK) - r.Body().Equal("no_cache") + r.Body().IsEqual("no_cache") r.Header(context.CacheControlHeaderKey).Equal(cache.CacheControlHeaderValue) r.Header(cache.PragmaHeaderKey).Equal(cache.PragmaNoCacheHeaderValue) r.Header(cache.ExpiresHeaderKey).Equal(cache.ExpiresNeverHeaderValue) @@ -42,7 +42,7 @@ func TestStaticCache(t *testing.T) { // tests e := httptest.New(t, app) r := e.GET("/").Expect().Status(httptest.StatusOK) - r.Body().Equal("static_cache") + r.Body().IsEqual("static_cache") r.Header(cache.ExpiresHeaderKey).Equal(expectedTime.Add(cacheDur).Format(app.ConfigurationReadOnly().GetTimeFormat())) cacheControlHeaderValue := "public, max-age=" + strconv.Itoa(int(cacheDur.Seconds())) @@ -64,15 +64,15 @@ func TestCache304(t *testing.T) { insideCacheTimef := time.Now().Add(-expiresEvery).UTC().Format(app.ConfigurationReadOnly().GetTimeFormat()) r := e.GET("/").WithHeader(context.IfModifiedSinceHeaderKey, insideCacheTimef).Expect().Status(httptest.StatusNotModified) r.Headers().NotContainsKey(context.ContentTypeHeaderKey).NotContainsKey(context.ContentLengthHeaderKey).NotContainsKey("ETag") - r.Body().Equal("") + r.Body().IsEqual("") // continue to the handler itself. cacheInvalidatedTimef := time.Now().Add(expiresEvery).UTC().Format(app.ConfigurationReadOnly().GetTimeFormat()) // after ~5seconds. r = e.GET("/").WithHeader(context.LastModifiedHeaderKey, cacheInvalidatedTimef).Expect().Status(httptest.StatusOK) - r.Body().Equal("send") + r.Body().IsEqual("send") // now without header, it should continue to the handler itself as well. r = e.GET("/").Expect().Status(httptest.StatusOK) - r.Body().Equal("send") + r.Body().IsEqual("send") } func TestETag(t *testing.T) { @@ -91,12 +91,12 @@ func TestETag(t *testing.T) { r := e.GET("/").Expect().Status(httptest.StatusOK) r.Header("ETag").Equal("/") // test if header set. - r.Body().Equal("_") + r.Body().IsEqual("_") e.GET("/").WithHeader("ETag", "/").WithHeader("If-None-Match", "/").Expect(). - Status(httptest.StatusNotModified).Body().Equal("") // browser is responsible, no the test engine. + Status(httptest.StatusNotModified).Body().IsEqual("") // browser is responsible, no the test engine. r = e.GET("/").Expect().Status(httptest.StatusOK) r.Header("ETag").Equal("/") // test if header set. - r.Body().Equal("__") + r.Body().IsEqual("__") } diff --git a/cache/cache_test.go b/cache/cache_test.go index f80f15b3d..619ad5982 100644 --- a/cache/cache_test.go +++ b/cache/cache_test.go @@ -33,9 +33,9 @@ func (h *testError) Error() string { } func runTest(e *httpexpect.Expect, path string, counterPtr *uint32, expectedBodyStr string, nocache string) error { - e.GET(path).Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) + e.GET(path).Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) time.Sleep(cacheDuration / 5) // lets wait for a while, cache should be saved and ready - e.GET(path).Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) + e.GET(path).Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) counter := atomic.LoadUint32(counterPtr) if counter > 1 { // n should be 1 because it doesn't changed after the first call @@ -44,10 +44,10 @@ func runTest(e *httpexpect.Expect, path string, counterPtr *uint32, expectedBody time.Sleep(cacheDuration) // cache should be cleared now - e.GET(path).Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) + e.GET(path).Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) time.Sleep(cacheDuration / 5) // let's call again , the cache should be saved - e.GET(path).Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) + e.GET(path).Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) counter = atomic.LoadUint32(counterPtr) if counter != 2 { return &testError{2, counter} @@ -55,8 +55,8 @@ func runTest(e *httpexpect.Expect, path string, counterPtr *uint32, expectedBody // we have cache response saved for the path, we have some time more here, but here // we will make the requestS with some of the deniers options - e.GET(path).WithHeader("max-age", "0").Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) - e.GET(path).WithHeader("Authorization", "basic or anything").Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) + e.GET(path).WithHeader("max-age", "0").Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) + e.GET(path).WithHeader("Authorization", "basic or anything").Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) counter = atomic.LoadUint32(counterPtr) if counter != 4 { return &testError{4, counter} @@ -69,19 +69,19 @@ func runTest(e *httpexpect.Expect, path string, counterPtr *uint32, expectedBody time.Sleep(cacheDuration) // cache should be cleared now, this should work because we are not in the "nocache" path - e.GET("/").Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) // counter = 5 + e.GET("/").Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) // counter = 5 time.Sleep(cacheDuration / 5) // let's call the "nocache", the expiration is not passed so but the "nocache" // route's path has the cache.NoCache so it should be not cached and the counter should be ++ - e.GET(nocache).Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) // counter should be 6 + e.GET(nocache).Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) // counter should be 6 counter = atomic.LoadUint32(counterPtr) if counter != 6 { // 4 before, 5 with the first call to store the cache, and six with the no cache, again original handler executation return &testError{6, counter} } // let's call again the path the expiration is not passed so it should be cached - e.GET(path).Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) + e.GET(path).Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) counter = atomic.LoadUint32(counterPtr) if counter != 6 { return &testError{6, counter} @@ -195,17 +195,17 @@ func TestCacheValidator(t *testing.T) { e := httptest.New(t, app) // execute from cache the next time - e.GET("/valid").Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) + e.GET("/valid").Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) time.Sleep(cacheDuration / 5) // lets wait for a while, cache should be saved and ready - e.GET("/valid").Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) + e.GET("/valid").Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) counter := atomic.LoadUint32(&n) if counter > 1 { // n should be 1 because it doesn't changed after the first call t.Fatalf("%s: %v", t.Name(), &testError{1, counter}) } // don't execute from cache, execute the original, counter should ++ here - e.GET("/invalid").Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) // counter = 2 - e.GET("/invalid2").Expect().Status(http.StatusOK).Body().Equal(expectedBodyStr) // counter = 3 + e.GET("/invalid").Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) // counter = 2 + e.GET("/invalid2").Expect().Status(http.StatusOK).Body().IsEqual(expectedBodyStr) // counter = 3 counter = atomic.LoadUint32(&n) if counter != 3 { diff --git a/core/handlerconv/from_std_test.go b/core/handlerconv/from_std_test.go index c024f244f..8f739744b 100644 --- a/core/handlerconv/from_std_test.go +++ b/core/handlerconv/from_std_test.go @@ -32,10 +32,10 @@ func TestFromStd(t *testing.T) { e := httptest.New(t, app) e.GET("/handler"). - Expect().Status(iris.StatusOK).Body().Equal(expected) + Expect().Status(iris.StatusOK).Body().IsEqual(expected) e.GET("/func"). - Expect().Status(iris.StatusOK).Body().Equal(expected) + Expect().Status(iris.StatusOK).Body().IsEqual(expected) } func TestFromStdWithNext(t *testing.T) { @@ -67,5 +67,5 @@ func TestFromStdWithNext(t *testing.T) { Expect().Status(iris.StatusForbidden) e.GET("/handlerwithnext").WithBasicAuth(basicauth, basicauth). - Expect().Status(iris.StatusOK).Body().Equal(passed) + Expect().Status(iris.StatusOK).Body().IsEqual(passed) } diff --git a/core/host/proxy_test.go b/core/host/proxy_test.go index f1659bcf3..4b8ba34fb 100644 --- a/core/host/proxy_test.go +++ b/core/host/proxy_test.go @@ -68,7 +68,7 @@ func TestProxy(t *testing.T) { go app.Run(iris.Listener(httptest.NewLocalTLSListener(l)), iris.WithoutStartupLog) // nolint:errcheck e := httptest.NewInsecure(t, httptest.URL("http://"+listener.Addr().String())) - e.GET("/").Expect().Status(iris.StatusOK).Body().Equal(expectedIndex) - e.GET("/about").Expect().Status(iris.StatusOK).Body().Equal(expectedAbout) - e.GET("/notfound").Expect().Status(iris.StatusNotFound).Body().Equal(unexpectedRoute) + e.GET("/").Expect().Status(iris.StatusOK).Body().IsEqual(expectedIndex) + e.GET("/about").Expect().Status(iris.StatusOK).Body().IsEqual(expectedAbout) + e.GET("/notfound").Expect().Status(iris.StatusNotFound).Body().IsEqual(unexpectedRoute) } diff --git a/core/host/supervisor_test.go b/core/host/supervisor_test.go index f683060da..c8b3f82b2 100644 --- a/core/host/supervisor_test.go +++ b/core/host/supervisor_test.go @@ -93,7 +93,7 @@ func testSupervisor(t *testing.T, creator func(*http.Server, []func(TaskHost)) * // http testsing and various calls // no need for time sleep because the following will take some time by theirselves tester := newTester(t, "http://"+addr, mux) - tester.Request("GET", "/").Expect().Status(http.StatusOK).Body().Equal(expectedBody) + tester.Request("GET", "/").Expect().Status(http.StatusOK).Body().IsEqual(expectedBody) // WARNING: Data Race here because we try to read the logs // but it's "safe" here. diff --git a/core/router/api_builder.go b/core/router/api_builder.go index 5ceac69bb..5b306abb8 100644 --- a/core/router/api_builder.go +++ b/core/router/api_builder.go @@ -6,9 +6,7 @@ import ( "net/http" "os" "path" - "path/filepath" "reflect" - "runtime" "strings" "time" @@ -722,7 +720,7 @@ func (api *APIBuilder) createRoutes(errorCode int, methods []string, relativePat } } - filename, line := getCaller() + filename, line := hero.GetCaller() fullpath := api.relativePath + relativePath // for now, keep the last "/" if any, "/xyz/" if len(handlers) == 0 { @@ -1706,50 +1704,3 @@ func (api *APIBuilder) Layout(tmplLayoutFile string) Party { return api } - -// https://golang.org/doc/go1.9#callersframes -func getCaller() (string, int) { - var pcs [32]uintptr - n := runtime.Callers(1, pcs[:]) - frames := runtime.CallersFrames(pcs[:n]) - wd, _ := os.Getwd() - - var ( - frame runtime.Frame - more = true - ) - - for { - if !more { - break - } - - frame, more = frames.Next() - file := filepath.ToSlash(frame.File) - // fmt.Printf("%s:%d | %s\n", file, frame.Line, frame.Function) - - if strings.Contains(file, "go/src/runtime/") { - continue - } - - if !strings.Contains(file, "_test.go") { - if strings.Contains(file, "/kataras/iris") && - !strings.Contains(file, "kataras/iris/_examples") && - !strings.Contains(file, "kataras/iris/middleware") && - !strings.Contains(file, "iris-contrib/examples") { - continue - } - } - - if relFile, err := filepath.Rel(wd, file); err == nil { - if !strings.HasPrefix(relFile, "..") { - // Only if it's relative to this path, not parent. - file = "./" + filepath.ToSlash(relFile) - } - } - - return file, frame.Line - } - - return "???", 0 -} diff --git a/core/router/api_builder_benchmark_test.go b/core/router/api_builder_benchmark_test.go index d9b8015ad..ce2f94f73 100644 --- a/core/router/api_builder_benchmark_test.go +++ b/core/router/api_builder_benchmark_test.go @@ -72,7 +72,7 @@ func genPaths(routesLength, minCharLength, maxCharLength int) []string { // // GOCACHE=off && go test -run=XXX -bench=BenchmarkAPIBuilder$ -benchtime=10s func BenchmarkAPIBuilder(b *testing.B) { - rand.Seed(time.Now().Unix()) + rand.New(rand.NewSource(time.Now().Unix())) noOpHandler := func(ctx *context.Context) {} handlersPerRoute := make(context.Handlers, 12) diff --git a/core/router/handler_execution_rules_test.go b/core/router/handler_execution_rules_test.go index ae65a8005..7f43a49f8 100644 --- a/core/router/handler_execution_rules_test.go +++ b/core/router/handler_execution_rules_test.go @@ -14,7 +14,7 @@ var ( testExecutionResponse = func(t *testing.T, app *iris.Application, path string) { e := httptest.New(t, app) - e.GET(path).Expect().Status(httptest.StatusOK).Body().Equal(finalExecutionRulesResponse) + e.GET(path).Expect().Status(httptest.StatusOK).Body().IsEqual(finalExecutionRulesResponse) } ) @@ -87,5 +87,5 @@ func TestRouterExecutionRulesShouldNotModifyTheCallersHandlerAndChildrenCanReset testExecutionResponse(t, app, "/") e := httptest.New(t, app) - e.GET("/c").Expect().Status(httptest.StatusOK).Body().Equal("4") // the "should not" should not be written. + e.GET("/c").Expect().Status(httptest.StatusOK).Body().IsEqual("4") // the "should not" should not be written. } diff --git a/core/router/route_register_rule_test.go b/core/router/route_register_rule_test.go index 8beb27cb4..9fd8ce1aa 100644 --- a/core/router/route_register_rule_test.go +++ b/core/router/route_register_rule_test.go @@ -57,9 +57,9 @@ func testRegisterRule(e *httptest.Expect, expectedGetBody string) { for _, method := range router.AllMethods { tt := e.Request(method, "/v1").Expect().Status(httptest.StatusOK).Body() if method == iris.MethodGet { - tt.Equal(expectedGetBody) + tt.IsEqual(expectedGetBody) } else { - tt.Equal("[any] " + method) + tt.IsEqual("[any] " + method) } } } @@ -111,8 +111,8 @@ func TestRegisterRuleOverlap(t *testing.T) { e := httptest.New(t, app) - e.GET("/users").Expect().Status(httptest.StatusOK).Body().Equal("data") - e.GET("/users/p1").Expect().Status(httptest.StatusUnauthorized).Body().Equal("Unauthorized") - e.GET("/users/p2").Expect().Status(httptest.StatusUnauthorized).Body().Equal("no access") - e.GET("/users/p3").Expect().Status(httptest.StatusOK).Body().Equal("p3 data") + e.GET("/users").Expect().Status(httptest.StatusOK).Body().IsEqual("data") + e.GET("/users/p1").Expect().Status(httptest.StatusUnauthorized).Body().IsEqual("Unauthorized") + e.GET("/users/p2").Expect().Status(httptest.StatusUnauthorized).Body().IsEqual("no access") + e.GET("/users/p3").Expect().Status(httptest.StatusOK).Body().IsEqual("p3 data") } diff --git a/core/router/router_handlers_order_test.go b/core/router/router_handlers_order_test.go index 0c9c96ffb..9d1bbc089 100644 --- a/core/router/router_handlers_order_test.go +++ b/core/router/router_handlers_order_test.go @@ -68,7 +68,7 @@ var ( t.Helper() e := httptest.New(t, app) - e.GET(path).Expect().Status(httptest.StatusOK).Body().Equal(finalResponse) + e.GET(path).Expect().Status(httptest.StatusOK).Body().IsEqual(finalResponse) } ) @@ -169,7 +169,7 @@ func TestUseRouterStopExecution(t *testing.T) { app.Get("/", writeHandler("index")) e := httptest.New(t, app) - e.GET("/").Expect().Status(iris.StatusOK).Body().Equal("stop") + e.GET("/").Expect().Status(iris.StatusOK).Body().IsEqual("stop") app = iris.New() app.OnErrorCode(iris.StatusForbidden, func(ctx iris.Context) { @@ -183,7 +183,7 @@ func TestUseRouterStopExecution(t *testing.T) { app.Get("/", writeHandler("index")) e = httptest.New(t, app) - e.GET("/").Expect().Status(iris.StatusForbidden).Body().Equal("err: custom error") + e.GET("/").Expect().Status(iris.StatusForbidden).Body().IsEqual("err: custom error") } func TestUseRouterParentDisallow(t *testing.T) { @@ -226,9 +226,9 @@ func TestUseRouterParentDisallow(t *testing.T) { }) e := httptest.New(t, app) - e.GET("/index").Expect().Status(iris.StatusOK).Body().Equal(expectedResponse) - e.GET("/").Expect().Status(iris.StatusOK).Body().Equal(expectedResponse) - e.GET("/user").Expect().Status(iris.StatusOK).Body().Equal(expectedResponse) + e.GET("/index").Expect().Status(iris.StatusOK).Body().IsEqual(expectedResponse) + e.GET("/").Expect().Status(iris.StatusOK).Body().IsEqual(expectedResponse) + e.GET("/user").Expect().Status(iris.StatusOK).Body().IsEqual(expectedResponse) } func TestUseRouterSubdomains(t *testing.T) { @@ -270,21 +270,21 @@ func TestUseRouterSubdomains(t *testing.T) { }) e := httptest.New(t, app, httptest.URL("http://example.com")) - e.GET("/notfound").Expect().Status(iris.StatusOK).Body().Equal("always_") + e.GET("/notfound").Expect().Status(iris.StatusOK).Body().IsEqual("always_") e.GET("/").WithURL("http://admin.example.com").Expect().Status(iris.StatusOK).Body(). - Equal("always_admin always_admin") + IsEqual("always_admin always_admin") e.GET("/").WithURL("http://control.admin.example.com").Expect().Status(iris.StatusOK).Body(). - Equal("always_admin always_control admin always_control admin") + IsEqual("always_admin always_control admin always_control admin") // It has a route, and use router just proceeds to the router. e.GET("/").WithURL("http://old.example.com").Expect().Status(iris.StatusOK).Body(). - Equal("chat") + IsEqual("chat") // this is not a registered path, should fire 404, the UseRouter does not write // anything to the response writer, so the router has control over it. e.GET("/notfound").WithURL("http://old.example.com").Expect().Status(iris.StatusNotFound).Body(). - Equal("Not Found") + IsEqual("Not Found") } func TestUseWrapOrder(t *testing.T) { @@ -359,8 +359,8 @@ func TestUseWrapOrder(t *testing.T) { app.Get("/", handler) e := httptest.New(t, app) - e.GET("/NotFound").Expect().Status(iris.StatusNotFound).Body().Equal(expectedNotFoundBody) - e.GET("/").Expect().Status(iris.StatusOK).Body().Equal(expectedBody) + e.GET("/NotFound").Expect().Status(iris.StatusNotFound).Body().IsEqual(expectedNotFoundBody) + e.GET("/").Expect().Status(iris.StatusOK).Body().IsEqual(expectedBody) } func TestResumeExecution(t *testing.T) { @@ -414,5 +414,5 @@ func TestResumeExecution(t *testing.T) { app.Get("/", before, handler, after) e := httptest.New(t, app) - e.GET("/").Expect().Status(iris.StatusOK).Body().Equal(expectedBody) + e.GET("/").Expect().Status(iris.StatusOK).Body().IsEqual(expectedBody) } diff --git a/core/router/router_test.go b/core/router/router_test.go index 73008385e..d1d43ceb4 100644 --- a/core/router/router_test.go +++ b/core/router/router_test.go @@ -69,9 +69,9 @@ func TestLowercaseRouting(t *testing.T) { e := httptest.New(t, app) for _, tt := range tests { s := strings.ToLower(tt) - e.GET(tt).Expect().Status(httptest.StatusOK).Body().Equal(s) - e.GET(s).Expect().Status(httptest.StatusOK).Body().Equal(s) - e.GET(strings.ToUpper(tt)).Expect().Status(httptest.StatusOK).Body().Equal(s) + e.GET(tt).Expect().Status(httptest.StatusOK).Body().IsEqual(s) + e.GET(s).Expect().Status(httptest.StatusOK).Body().IsEqual(s) + e.GET(strings.ToUpper(tt)).Expect().Status(httptest.StatusOK).Body().IsEqual(s) } } @@ -156,7 +156,7 @@ func TestRouterWrapperOrder(t *testing.T) { app.Get("/", func(ctx iris.Context) {}) // to not append the not found one. e := httptest.New(t, app) - e.GET("/").Expect().Status(iris.StatusOK).Body().Equal(expectedOrderStr) + e.GET("/").Expect().Status(iris.StatusOK).Body().IsEqual(expectedOrderStr) } } @@ -190,9 +190,9 @@ func TestNewSubdomainPartyRedirectHandler(t *testing.T) { } e := httptest.New(t, app) - e.GET("/").WithURL("http://mydomain.com").Expect().Status(iris.StatusOK).Body().Equal("root index") - e.GET("/").WithURL("http://test.mydomain.com").Expect().Status(iris.StatusOK).Body().Equal("test index") - e.GET("/").WithURL("http://testold.mydomain.com").Expect().Status(iris.StatusOK).Body().Equal("test index") - e.GET("/").WithURL("http://testold.mydomain.com/notfound").Expect().Status(iris.StatusNotFound).Body().Equal("test 404") - e.GET("/").WithURL("http://leveled.testold.mydomain.com").Expect().Status(iris.StatusOK).Body().Equal("leveled.testold this can be fired") + e.GET("/").WithURL("http://mydomain.com").Expect().Status(iris.StatusOK).Body().IsEqual("root index") + e.GET("/").WithURL("http://test.mydomain.com").Expect().Status(iris.StatusOK).Body().IsEqual("test index") + e.GET("/").WithURL("http://testold.mydomain.com").Expect().Status(iris.StatusOK).Body().IsEqual("test index") + e.GET("/").WithURL("http://testold.mydomain.com/notfound").Expect().Status(iris.StatusNotFound).Body().IsEqual("test 404") + e.GET("/").WithURL("http://leveled.testold.mydomain.com").Expect().Status(iris.StatusOK).Body().IsEqual("leveled.testold this can be fired") } diff --git a/core/router/router_wildcard_root_test.go b/core/router/router_wildcard_root_test.go index c6f943053..07642d052 100644 --- a/core/router/router_wildcard_root_test.go +++ b/core/router/router_wildcard_root_test.go @@ -192,7 +192,7 @@ func testTheRoutes(t *testing.T, tests []testRoute, debug bool) { expectedBody = staticPathPrefixBody + req.path } - ex.Expect().Status(req.expectedStatusCode).Body().Equal(expectedBody) + ex.Expect().Status(req.expectedStatusCode).Body().IsEqual(expectedBody) } } } diff --git a/core/router/status_test.go b/core/router/status_test.go index 8a4a109fe..78eb050dd 100644 --- a/core/router/status_test.go +++ b/core/router/status_test.go @@ -45,20 +45,20 @@ func TestOnAnyErrorCode(t *testing.T) { e := httptest.New(t, app) e.GET("/found").Expect().Status(iris.StatusOK). - Body().Equal(expectedFoundResponse) + Body().IsEqual(expectedFoundResponse) e.GET("/notfound").Expect().Status(iris.StatusNotFound). - Body().Equal(http.StatusText(iris.StatusNotFound)) + Body().IsEqual(http.StatusText(iris.StatusNotFound)) checkAndClearBuf(t, buff, expectedPrintBeforeExecuteErr) e.POST("/found").Expect().Status(iris.StatusMethodNotAllowed). - Body().Equal(http.StatusText(iris.StatusMethodNotAllowed)) + Body().IsEqual(http.StatusText(iris.StatusMethodNotAllowed)) checkAndClearBuf(t, buff, expectedPrintBeforeExecuteErr) e.GET("/407").Expect().Status(iris.StatusProxyAuthRequired). - Body().Equal(expected407) + Body().IsEqual(expected407) // Test Configuration.ResetOnFireErrorCode. app2 := iris.New() @@ -77,7 +77,7 @@ func TestOnAnyErrorCode(t *testing.T) { }) httptest.New(t, app2).GET("/406").Expect().Status(iris.StatusNotAcceptable). - Body().Equal(http.StatusText(iris.StatusNotAcceptable)) + Body().IsEqual(http.StatusText(iris.StatusNotAcceptable)) checkAndClearBuf(t, buff, expectedPrintBeforeExecuteErr) } @@ -135,26 +135,26 @@ func TestPartyOnErrorCode(t *testing.T) { e := httptest.New(t, app) - e.GET("/notfound").Expect().Status(iris.StatusNotFound).Body().Equal(globalNotFoundResponse) - e.POST("/path").Expect().Status(iris.StatusMethodNotAllowed).Body().Equal(globalMethodNotAllowedResponse) - e.GET("/path").Expect().Status(iris.StatusOK).Body().Equal("/path") + e.GET("/notfound").Expect().Status(iris.StatusNotFound).Body().IsEqual(globalNotFoundResponse) + e.POST("/path").Expect().Status(iris.StatusMethodNotAllowed).Body().IsEqual(globalMethodNotAllowedResponse) + e.GET("/path").Expect().Status(iris.StatusOK).Body().IsEqual("/path") e.POST("/users").Expect().Status(iris.StatusMethodNotAllowed). - Body().Equal(usersResponse) + Body().IsEqual(usersResponse) e.POST("/users/42").Expect().Status(iris.StatusMethodNotAllowed). - Body().Equal(usersuserResponse) + Body().IsEqual(usersuserResponse) e.GET("/users/42").Expect().Status(iris.StatusOK). - Body().Equal("/users/42") - e.GET("/users/ab").Expect().Status(iris.StatusNotFound).Body().Equal(usersuserNotFoundResponse) + Body().IsEqual("/users/42") + e.GET("/users/ab").Expect().Status(iris.StatusNotFound).Body().IsEqual(usersuserNotFoundResponse) // inherit the parent. - e.GET("/users/42/friends/dsa").Expect().Status(iris.StatusNotFound).Body().Equal(usersuserNotFoundResponse) + e.GET("/users/42/friends/dsa").Expect().Status(iris.StatusNotFound).Body().IsEqual(usersuserNotFoundResponse) // if not registered to the party, then the root is taking action. - e.GET("/users/42/ab/badrequest").Expect().Status(iris.StatusBadRequest).Body().Equal(http.StatusText(iris.StatusBadRequest)) + e.GET("/users/42/ab/badrequest").Expect().Status(iris.StatusBadRequest).Body().IsEqual(http.StatusText(iris.StatusBadRequest)) // if not registered to the party, and not in root, then just write the status text (fallback behavior) e.GET("/users/badrequest").Expect().Status(iris.StatusBadRequest). - Body().Equal(http.StatusText(iris.StatusBadRequest)) + Body().IsEqual(http.StatusText(iris.StatusBadRequest)) } diff --git a/hero/binding.go b/hero/binding.go index de1af4c1d..07fe12975 100644 --- a/hero/binding.go +++ b/hero/binding.go @@ -253,7 +253,7 @@ func isPayloadType(in reflect.Type) bool { func getBindingsForFunc(fn reflect.Value, dependencies []*Dependency, disablePayloadAutoBinding bool, paramsCount int) []*binding { fnTyp := fn.Type() if !isFunc(fnTyp) { - panic("bindings: unresolved: not a func type") + panic(fmt.Sprintf("bindings: unresolved: no a func type: %#+v", fn)) } n := fnTyp.NumIn() @@ -294,7 +294,7 @@ func getBindingsForFunc(fn reflect.Value, dependencies []*Dependency, disablePay func getBindingsForStruct(v reflect.Value, dependencies []*Dependency, markExportedFieldsAsRequired bool, disablePayloadAutoBinding bool, matchDependency DependencyMatcher, paramsCount int, sorter Sorter) (bindings []*binding) { typ := indirectType(v.Type()) if typ.Kind() != reflect.Struct { - panic("bindings: unresolved: no struct type") + panic(fmt.Sprintf("bindings: unresolved: not a struct type: %#+v", v)) } // get bindings from any struct's non zero values first, including unexported. diff --git a/hero/container_test.go b/hero/container_test.go index 8399ebcf7..f0e35098b 100644 --- a/hero/container_test.go +++ b/hero/container_test.go @@ -55,7 +55,7 @@ func TestContainerHandler(t *testing.T) { e := httptest.New(t, app) path := fmt.Sprintf("/%d", expectedOutput.ID) - e.POST(path).WithJSON(input).Expect().Status(httptest.StatusOK).JSON().Equal(expectedOutput) + e.POST(path).WithJSON(input).Expect().Status(httptest.StatusOK).JSON().IsEqual(expectedOutput) } func TestContainerInject(t *testing.T) { @@ -127,5 +127,5 @@ func TestContainerUseResultHandler(t *testing.T) { app.Get("/{id:int}", handler) e := httptest.New(t, app) - e.GET("/42").Expect().Status(httptest.StatusOK).JSON().Equal(expectedResponse) + e.GET("/42").Expect().Status(httptest.StatusOK).JSON().IsEqual(expectedResponse) } diff --git a/hero/dependency.go b/hero/dependency.go index d6f4f6d44..711ef28e0 100644 --- a/hero/dependency.go +++ b/hero/dependency.go @@ -2,6 +2,7 @@ package hero import ( "fmt" + "strings" "reflect" @@ -71,7 +72,7 @@ func newDependency(dependency interface{}, disablePayloadAutoBinding bool, match } if d, ok := dependency.(*Dependency); ok { - // already a *Dependency. + // already a *Dependency, do not continue (and most importatly do not call resolveDependency) . return d } @@ -100,11 +101,12 @@ func newDependency(dependency interface{}, disablePayloadAutoBinding bool, match // DependencyResolver func(v reflect.Value, dest *Dependency) bool // Resolver DependencyResolver -func resolveDependency(v reflect.Value, disablePayloadAutoBinding bool, dest *Dependency, funcDependencies ...*Dependency) bool { +func resolveDependency(v reflect.Value, disablePayloadAutoBinding bool, dest *Dependency, prevDependencies ...*Dependency) bool { return fromDependencyHandler(v, dest) || - fromStructValue(v, dest) || + fromBuiltinValue(v, dest) || + fromStructValueOrDependentStructValue(v, disablePayloadAutoBinding, dest, prevDependencies) || fromFunc(v, dest) || - len(funcDependencies) > 0 && fromDependentFunc(v, disablePayloadAutoBinding, dest, funcDependencies) + len(prevDependencies) > 0 && fromDependentFunc(v, disablePayloadAutoBinding, dest, prevDependencies) } func fromDependencyHandler(_ reflect.Value, dest *Dependency) bool { @@ -131,20 +133,114 @@ func fromDependencyHandler(_ reflect.Value, dest *Dependency) bool { return true } +func fromBuiltinValue(v reflect.Value, dest *Dependency) bool { + if !isBuiltinValue(v) { + return false + } + + // It's just a static builtin value. + handler := func(*context.Context, *Input) (reflect.Value, error) { + return v, nil + } + + dest.DestType = v.Type() + dest.Static = true + dest.Handle = handler + return true +} + func fromStructValue(v reflect.Value, dest *Dependency) bool { - if !isFunc(v) { - // It's just a static value. - handler := func(*context.Context, *Input) (reflect.Value, error) { + if !isStructValue(v) { + return false + } + + // It's just a static struct value. + handler := func(*context.Context, *Input) (reflect.Value, error) { + return v, nil + } + + dest.DestType = v.Type() + dest.Static = true + dest.Handle = handler + return true +} + +func fromStructValueOrDependentStructValue(v reflect.Value, disablePayloadAutoBinding bool, dest *Dependency, prevDependencies []*Dependency) bool { + if !isStructValue(v) { + // It's not just a static struct value. + return false + } + + if len(prevDependencies) == 0 { // As a non depedent struct. + // We must make this check so we can avoid the auto-filling of + // the dependencies from Iris builtin dependencies. + return fromStructValue(v, dest) + } + + // Check if it's a builtin dependency (e.g an MVC Application (see mvc.go#newApp)), + // if it's and registered without a Dependency wrapper, like the rest builtin dependencies, + // then do NOT try to resolve its fields. + if strings.HasPrefix(indirectType(v.Type()).PkgPath(), "github.com/kataras/iris/v12") { + return fromStructValue(v, dest) + } + + bindings := getBindingsForStruct(v, prevDependencies, false, disablePayloadAutoBinding, DefaultDependencyMatcher, -1, nil) + if len(bindings) == 0 { + return fromStructValue(v, dest) // same as above. + } + + // As a depedent struct, however we may need to resolve its dependencies first + // so we can decide if it's really a depedent struct or not. + var ( + handler = func(*context.Context, *Input) (reflect.Value, error) { return v, nil } + isStatic = true + ) - dest.DestType = v.Type() - dest.Static = true - dest.Handle = handler - return true + for _, binding := range bindings { + if !binding.Dependency.Static { + isStatic = false + break + } } - return false + handler = func(ctx *context.Context, _ *Input) (reflect.Value, error) { // Called once per dependency on build-time if the dependency is static. + elem := v + if elem.Kind() == reflect.Ptr { + elem = elem.Elem() + } + + for _, binding := range bindings { + field := elem.FieldByIndex(binding.Input.StructFieldIndex) + if !field.CanSet() || !field.IsZero() { + continue // already set. + } + // if !binding.Dependency.Match(field.Type()) { A check already happen in getBindingsForStruct. + // continue + // } + + input, err := binding.Dependency.Handle(ctx, binding.Input) + if err != nil { + if err == ErrSeeOther { + continue + } + + return emptyValue, err + } + + // fmt.Printf("binding %s to %#+v\n", field.String(), input) + + field.Set(input) + } + + return v, nil + } + + dest.DestType = v.Type() + dest.Static = isStatic + dest.Handle = handler + return true } func fromFunc(v reflect.Value, dest *Dependency) bool { diff --git a/hero/dependency_source.go b/hero/dependency_source.go index 66b25f7c0..a1506cffc 100644 --- a/hero/dependency_source.go +++ b/hero/dependency_source.go @@ -35,7 +35,7 @@ func newSource(fn reflect.Value) Source { fallthrough default: if callerFileName == "" { - callerFileName, callerLineNumber = getCaller() + callerFileName, callerLineNumber = GetCaller() } } @@ -55,7 +55,7 @@ func newSource(fn reflect.Value) Source { } func getSource() Source { - filename, line := getCaller() + filename, line := GetCaller() return Source{ File: filename, Line: line, @@ -67,7 +67,7 @@ func (s Source) String() string { } // https://golang.org/doc/go1.9#callersframes -func getCaller() (string, int) { +func GetCaller() (string, int) { var pcs [32]uintptr n := runtime.Callers(4, pcs[:]) frames := runtime.CallersFrames(pcs[:n]) @@ -76,11 +76,13 @@ func getCaller() (string, int) { frame, more := frames.Next() file := frame.File - if strings.HasSuffix(file, "_test.go") { - return file, frame.Line + if strings.Contains(file, "go/src/runtime/") { + continue } - if !strings.Contains(file, "/kataras/iris") || strings.Contains(file, "/kataras/iris/_examples") || strings.Contains(file, "iris-contrib/examples") { + // funcName is something like "github.com/kataras/iris.SomeFunc" + funcName := frame.Function + if !strings.HasPrefix(funcName, "github.com/kataras/iris/v12") { return file, frame.Line } diff --git a/hero/func_result_test.go b/hero/func_result_test.go index 09c7592c6..39798a2f3 100644 --- a/hero/func_result_test.go +++ b/hero/func_result_test.go @@ -146,65 +146,65 @@ func TestFuncResult(t *testing.T) { e := httptest.New(t, app) e.GET("/text").Expect().Status(iris.StatusOK). - Body().Equal("text") + Body().IsEqual("text") e.GET("/status").Expect().Status(iris.StatusBadGateway) e.GET("/text/with/status/ok").Expect().Status(iris.StatusOK). - Body().Equal("OK") + Body().IsEqual("OK") e.GET("/status/with/text/not/ok/first/second").Expect().Status(iris.StatusForbidden). - Body().Equal("NOT_OK_firstsecond") + Body().IsEqual("NOT_OK_firstsecond") // Author's note: <-- if that fails means that the last binder called for both input args, // see path_param_binder.go e.GET("/text/and/content/type").Expect().Status(iris.StatusOK). ContentType("text/html", "utf-8"). - Body().Equal("text") + Body().IsEqual("text") e.GET("/custom/response").Expect().Status(iris.StatusOK). ContentType("text/html", "utf-8"). - Body().Equal("text") + Body().IsEqual("text") e.GET("/custom/response/with/status/ok").Expect().Status(iris.StatusOK). ContentType("text/html", "utf-8"). - Body().Equal("OK") + Body().IsEqual("OK") e.GET("/custom/response/with/status/not/ok").Expect().Status(iris.StatusInternalServerError). ContentType("text/html", "utf-8"). - Body().Equal("internal server error") + Body().IsEqual("internal server error") expectedResultFromCustomStruct := map[string]interface{}{ "name": "Iris", "age": 2, } e.GET("/custom/struct").Expect().Status(iris.StatusOK). - JSON().Equal(expectedResultFromCustomStruct) + JSON().IsEqual(expectedResultFromCustomStruct) e.GET("/custom/struct/with/status/not/ok").Expect().Status(iris.StatusInternalServerError). - JSON().Equal(expectedResultFromCustomStruct) + JSON().IsEqual(expectedResultFromCustomStruct) e.GET("/custom/struct/with/content/type").Expect().Status(iris.StatusOK). ContentType("text/xml", "utf-8") e.GET("/custom/struct/with/error").Expect().Status(iris.StatusOK). - JSON().Equal(expectedResultFromCustomStruct) + JSON().IsEqual(expectedResultFromCustomStruct) e.GET("/custom/struct/with/error").WithQuery("err", true).Expect(). Status(iris.StatusBadRequest). // the default status code if error is not nil // the content should be not JSON it should be the status code's text // it will fire the error's text - Body().Equal("omit return of testCustomStruct and fire error") + Body().IsEqual("omit return of testCustomStruct and fire error") e.GET("/custom/error/as/dispatcher").Expect(). Status(iris.StatusBadRequest). // the default status code if error is not nil // the content should be not JSON it should be the status code's text // it will fire the error's text - JSON().Equal(err{iris.StatusBadRequest, "this is my error as json"}) + JSON().IsEqual(err{iris.StatusBadRequest, "this is my error as json"}) // its result is nil should give an empty response but content-type is set correctly. e.GET("/custom/nil/typed").Expect(). - Status(iris.StatusOK).ContentType(context.ContentJSONHeaderValue).Body().Empty() + Status(iris.StatusOK).ContentType(context.ContentJSONHeaderValue).Body().IsEmpty() e.GET("/custom/nil/typed/ptr").Expect(). - Status(iris.StatusOK).ContentType(context.ContentJSONHeaderValue).Body().Empty() + Status(iris.StatusOK).ContentType(context.ContentJSONHeaderValue).Body().IsEmpty() e.GET("/custom/nil/map").Expect(). - Status(iris.StatusOK).ContentType(context.ContentJSONHeaderValue).Body().Empty() + Status(iris.StatusOK).ContentType(context.ContentJSONHeaderValue).Body().IsEmpty() e.GET("/custom/nil/struct").Expect(). - Status(iris.StatusOK).ContentType(context.ContentJSONHeaderValue).Body().Empty() + Status(iris.StatusOK).ContentType(context.ContentJSONHeaderValue).Body().IsEmpty() } type ( @@ -246,20 +246,20 @@ func TestPreflightResult(t *testing.T) { expected1 := testPreflightResponse{Code: httptest.StatusOK, Message: "OK"} e.POST("/").WithJSON(testPreflightRequest{FailCode: expected1.Code}). - Expect().Status(httptest.StatusOK).JSON().Equal(expected1) + Expect().Status(httptest.StatusOK).JSON().IsEqual(expected1) expected2 := testPreflightResponse{Code: httptest.StatusBadRequest, Message: "Bad Request"} e.POST("/").WithJSON(testPreflightRequest{FailCode: expected2.Code}). - Expect().Status(httptest.StatusBadRequest).JSON().Equal(expected2) + Expect().Status(httptest.StatusBadRequest).JSON().IsEqual(expected2) // Test error returned from Preflight. e.POST("/").WithJSON(testPreflightRequest{FailCode: httptest.StatusInternalServerError}). - Expect().Status(httptest.StatusBadRequest).Body().Equal("custom error") + Expect().Status(httptest.StatusBadRequest).Body().IsEqual("custom error") // Can be done without Preflight as the second output argument can be a status code. expected4 := testOutput{Name: "my_name"} e.POST("/alternative").WithJSON(testInput{expected4.Name}). - Expect().Status(httptest.StatusAccepted).JSON().Equal(expected4) + Expect().Status(httptest.StatusAccepted).JSON().IsEqual(expected4) } func TestResponseErr(t *testing.T) { @@ -280,5 +280,5 @@ func TestResponseErr(t *testing.T) { }) e := httptest.New(t, app) - e.GET("/").Expect().Status(iris.StatusBadGateway).Body().Equal("response error") + e.GET("/").Expect().Status(iris.StatusBadGateway).Body().IsEqual("response error") } diff --git a/hero/handler_test.go b/hero/handler_test.go index cfc28bccb..9a232acf2 100644 --- a/hero/handler_test.go +++ b/hero/handler_test.go @@ -93,13 +93,13 @@ func testAppWithHeroHandlers(t *testing.T, h1, h2, h3 iris.Handler) { e := httptest.New(t, app) // 1 e.GET(fmt.Sprintf("/%d/%s", expectedUser.ID, expectedUser.Username)).Expect().Status(httptest.StatusOK). - JSON().Equal(expectedUser) + JSON().IsEqual(expectedUser) // 2 e.GET("/service").Expect().Status(httptest.StatusOK). - Body().Equal("say something") + Body().IsEqual("say something") // 3 e.GET("/param/the_param_value").Expect().Status(httptest.StatusOK). - Body().Equal("param is: the_param_value") + Body().IsEqual("param is: the_param_value") } // TestBindFunctionAsFunctionInputArgument tests to bind @@ -123,7 +123,7 @@ func TestBindFunctionAsFunctionInputArgument(t *testing.T) { expectedUsername := "kataras" e.POST("/").WithFormField("username", expectedUsername). - Expect().Status(iris.StatusOK).Body().Equal(expectedUsername) + Expect().Status(iris.StatusOK).Body().IsEqual(expectedUsername) } func TestPayloadBinding(t *testing.T) { @@ -155,21 +155,21 @@ func TestPayloadBinding(t *testing.T) { e := httptest.New(t, app) // JSON - e.POST("/").WithJSON(iris.Map{"username": "makis"}).Expect().Status(httptest.StatusOK).Body().Equal("makis") - e.POST("/2").WithJSON(iris.Map{"username": "kataras"}).Expect().Status(httptest.StatusOK).Body().Equal("kataras") + e.POST("/").WithJSON(iris.Map{"username": "makis"}).Expect().Status(httptest.StatusOK).Body().IsEqual("makis") + e.POST("/2").WithJSON(iris.Map{"username": "kataras"}).Expect().Status(httptest.StatusOK).Body().IsEqual("kataras") // FORM (url-encoded) - e.POST("/").WithFormField("username", "makis").Expect().Status(httptest.StatusOK).Body().Equal("makis") + e.POST("/").WithFormField("username", "makis").Expect().Status(httptest.StatusOK).Body().IsEqual("makis") // FORM (multipart) - e.POST("/").WithMultipart().WithFormField("username", "makis").Expect().Status(httptest.StatusOK).Body().Equal("makis") + e.POST("/").WithMultipart().WithFormField("username", "makis").Expect().Status(httptest.StatusOK).Body().IsEqual("makis") // FORM: test ErrorHandler skip the ErrPath. e.POST("/").WithMultipart().WithFormField("username", "makis").WithFormField("unknown", "continue"). - Expect().Status(httptest.StatusOK).Body().Equal("makis") + Expect().Status(httptest.StatusOK).Body().IsEqual("makis") // POST URL query. - e.POST("/").WithQuery("username", "makis").Expect().Status(httptest.StatusOK).Body().Equal("makis") + e.POST("/").WithQuery("username", "makis").Expect().Status(httptest.StatusOK).Body().IsEqual("makis") // GET URL query. - e.GET("/").WithQuery("username", "makis").Expect().Status(httptest.StatusOK).Body().Equal("makis") + e.GET("/").WithQuery("username", "makis").Expect().Status(httptest.StatusOK).Body().IsEqual("makis") } /* Author's notes: @@ -231,9 +231,9 @@ func TestDependentDependencies(t *testing.T) { app.Get("/h3", h3) e := httptest.New(t, app) - e.GET("/h1").Expect().Status(httptest.StatusOK).Body().Equal("prefix: it is a deep dependency") - e.GET("/h2").Expect().Status(httptest.StatusOK).Body().Equal("prefix: message") - e.GET("/h3").Expect().Status(httptest.StatusOK).Body().Equal("value") + e.GET("/h1").Expect().Status(httptest.StatusOK).Body().IsEqual("prefix: it is a deep dependency") + e.GET("/h2").Expect().Status(httptest.StatusOK).Body().IsEqual("prefix: message") + e.GET("/h3").Expect().Status(httptest.StatusOK).Body().IsEqual("value") } func TestHandlerPathParams(t *testing.T) { @@ -262,7 +262,7 @@ func TestHandlerPathParams(t *testing.T) { e.GET("/editors/42"), e.GET("/1/book/42"), } { - testReq.Expect().Status(httptest.StatusOK).Body().Equal("42") + testReq.Expect().Status(httptest.StatusOK).Body().IsEqual("42") } } @@ -301,8 +301,8 @@ func TestRegisterDependenciesFromContext(t *testing.T) { e := httptest.New(t, app) - e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal("kataras") - e.GET("/service").Expect().Status(httptest.StatusOK).Body().Equal("say hello") - e.GET("/both").Expect().Status(httptest.StatusOK).Body().Equal("say kataras") - e.GET("/non").Expect().Status(httptest.StatusOK).Body().Equal("nothing") + e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual("kataras") + e.GET("/service").Expect().Status(httptest.StatusOK).Body().IsEqual("say hello") + e.GET("/both").Expect().Status(httptest.StatusOK).Body().IsEqual("say kataras") + e.GET("/non").Expect().Status(httptest.StatusOK).Body().IsEqual("nothing") } diff --git a/hero/reflect.go b/hero/reflect.go index b81a36522..e3881cbbc 100644 --- a/hero/reflect.go +++ b/hero/reflect.go @@ -42,6 +42,39 @@ func isFunc(kindable interface{ Kind() reflect.Kind }) bool { return kindable.Kind() == reflect.Func } +func isStructValue(v reflect.Value) bool { + return indirectType(v.Type()).Kind() == reflect.Struct +} + +// isBuiltin reports whether a reflect.Value is a builtin type +func isBuiltinValue(v reflect.Value) bool { + switch v.Type().Kind() { + case reflect.Bool, + reflect.Int, + reflect.Int8, + reflect.Int16, + reflect.Int32, + reflect.Int64, + reflect.Uint, + reflect.Uint8, + reflect.Uint16, + reflect.Uint32, + reflect.Uint64, + reflect.Float32, + reflect.Float64, + reflect.Complex64, + reflect.Complex128, + reflect.Array, + reflect.Chan, + reflect.Map, + reflect.Slice, + reflect.String: + return true + default: + return false + } +} + var ( inputTyp = reflect.TypeOf((*Input)(nil)) errTyp = reflect.TypeOf((*error)(nil)).Elem() diff --git a/hero/struct.go b/hero/struct.go index ea2c5d727..536eea402 100644 --- a/hero/struct.go +++ b/hero/struct.go @@ -57,6 +57,8 @@ func makeStruct(structPtr interface{}, c *Container, partyParamsCount int) *Stru // If static then Struct.Acquire will return the same "value" instance, otherwise it will create a new one. singleton := true elem := v.Elem() + + // fmt.Printf("makeStruct: bindings length = %d\n", len(bindings)) for _, b := range bindings { if b.Dependency.Static { // Fill now. diff --git a/hero/struct_test.go b/hero/struct_test.go index 5401f7bdd..a1045c3ae 100644 --- a/hero/struct_test.go +++ b/hero/struct_test.go @@ -46,11 +46,11 @@ func TestStruct(t *testing.T) { app.Get("/myHandler4", getHandler) e := httptest.New(t, app) - e.POST("/" + input.Name).Expect().Status(httptest.StatusOK).JSON().Equal(expectedOutput) + e.POST("/" + input.Name).Expect().Status(httptest.StatusOK).JSON().IsEqual(expectedOutput) path := fmt.Sprintf("/%d", expectedOutput.ID) - e.POST(path).WithJSON(input).Expect().Status(httptest.StatusOK).JSON().Equal(expectedOutput) - e.POST("/myHandler3").WithJSON(input).Expect().Status(httptest.StatusOK).JSON().Equal(expectedOutput) - e.GET("/myHandler4").Expect().Status(httptest.StatusOK).Body().Equal("MyHandler4") + e.POST(path).WithJSON(input).Expect().Status(httptest.StatusOK).JSON().IsEqual(expectedOutput) + e.POST("/myHandler3").WithJSON(input).Expect().Status(httptest.StatusOK).JSON().IsEqual(expectedOutput) + e.GET("/myHandler4").Expect().Status(httptest.StatusOK).Body().IsEqual("MyHandler4") } type testStructErrorHandler struct{} @@ -72,7 +72,7 @@ func TestStructErrorHandler(t *testing.T) { expectedErrText := "an error" e := httptest.New(t, app) - e.GET("/" + expectedErrText).Expect().Status(httptest.StatusConflict).Body().Equal(expectedErrText) + e.GET("/" + expectedErrText).Expect().Status(httptest.StatusConflict).Body().IsEqual(expectedErrText) } type ( @@ -117,5 +117,5 @@ func TestStructFieldsSorter(t *testing.T) { // see https://github.com/kataras/ir e := httptest.New(t, app) expectedBody := `&hero_test.testServiceImpl1{inner:"parser"} | &hero_test.testServiceImpl2{tf:24}` - e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal(expectedBody) + e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual(expectedBody) } diff --git a/middleware/basicauth/basicauth_test.go b/middleware/basicauth/basicauth_test.go index e19147f2a..4dca33cdb 100644 --- a/middleware/basicauth/basicauth_test.go +++ b/middleware/basicauth/basicauth_test.go @@ -73,7 +73,7 @@ func TestBasicAuthUseRouter(t *testing.T) { for username, password := range users { // Test pass authentication and route found. e.GET("/").WithBasicAuth(username, password).Expect(). - Status(httptest.StatusOK).Body().Equal(fmt.Sprintf("Hello, %s!", username)) + Status(httptest.StatusOK).Body().IsEqual(fmt.Sprintf("Hello, %s!", username)) e.GET("/user_json").WithBasicAuth(username, password).Expect(). Status(httptest.StatusOK).JSON().Object().ContainsMap(iris.Map{ "username": username, @@ -83,7 +83,7 @@ func TestBasicAuthUseRouter(t *testing.T) { Equal(fmt.Sprintf("%s\n%s\n%s", "Basic Authentication", username, password)) // Test empty auth. - e.GET("/").Expect().Status(httptest.StatusUnauthorized).Body().Equal("Unauthorized") + e.GET("/").Expect().Status(httptest.StatusUnauthorized).Body().IsEqual("Unauthorized") // Test invalid auth. e.GET("/").WithBasicAuth(username, "invalid_password").Expect(). Status(httptest.StatusForbidden) @@ -93,14 +93,14 @@ func TestBasicAuthUseRouter(t *testing.T) { // Test different method, it should pass the authentication (no stop on 401) // but it doesn't fire the GET route, instead it gives 405. e.POST("/").WithBasicAuth(username, password).Expect(). - Status(httptest.StatusMethodNotAllowed).Body().Equal("Method Not Allowed") + Status(httptest.StatusMethodNotAllowed).Body().IsEqual("Method Not Allowed") // Test pass the authentication but route not found. e.GET("/notfound").WithBasicAuth(username, password).Expect(). - Status(httptest.StatusNotFound).Body().Equal("Not Found") + Status(httptest.StatusNotFound).Body().IsEqual("Not Found") // Test empty auth. - e.GET("/notfound").Expect().Status(httptest.StatusUnauthorized).Body().Equal("Unauthorized") + e.GET("/notfound").Expect().Status(httptest.StatusUnauthorized).Body().IsEqual("Unauthorized") // Test invalid auth. e.GET("/notfound").WithBasicAuth(username, "invalid_password").Expect(). Status(httptest.StatusForbidden) @@ -114,7 +114,7 @@ func TestBasicAuthUseRouter(t *testing.T) { // Test pass and route found. sub.GET("/").WithBasicAuth(username, password).Expect(). - Status(httptest.StatusOK).Body().Equal(fmt.Sprintf("Static, %s", username)) + Status(httptest.StatusOK).Body().IsEqual(fmt.Sprintf("Static, %s", username)) // Test empty auth. sub.GET("/").Expect().Status(httptest.StatusUnauthorized) @@ -126,10 +126,10 @@ func TestBasicAuthUseRouter(t *testing.T) { // Test pass the authentication but route not found. sub.GET("/notfound").WithBasicAuth(username, password).Expect(). - Status(httptest.StatusNotFound).Body().Equal("Not Found") + Status(httptest.StatusNotFound).Body().IsEqual("Not Found") // Test empty auth. - sub.GET("/notfound").Expect().Status(httptest.StatusUnauthorized).Body().Equal("Unauthorized") + sub.GET("/notfound").Expect().Status(httptest.StatusUnauthorized).Body().IsEqual("Unauthorized") // Test invalid auth. sub.GET("/notfound").WithBasicAuth(username, "invalid_password").Expect(). Status(httptest.StatusForbidden) @@ -142,16 +142,16 @@ func TestBasicAuthUseRouter(t *testing.T) { sub = e.Builder(func(req *httptest.Request) { req.WithURL("http://reset_with_use_router.mydomain.com") }) - sub.GET("/").Expect().Status(httptest.StatusOK).Body().Equal("with use router\n") - sub.POST("/").Expect().Status(httptest.StatusMethodNotAllowed).Body().Equal("Method Not Allowed") - sub.GET("/notfound").Expect().Status(httptest.StatusNotFound).Body().Equal("Not Found") + sub.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual("with use router\n") + sub.POST("/").Expect().Status(httptest.StatusMethodNotAllowed).Body().IsEqual("Method Not Allowed") + sub.GET("/notfound").Expect().Status(httptest.StatusNotFound).Body().IsEqual("Not Found") // Test a reset-ed Party (all should pass without auth). sub = e.Builder(func(req *httptest.Request) { req.WithURL("http://reset.mydomain.com") }) - sub.GET("/").Expect().Status(httptest.StatusOK).Body().Empty() - sub.POST("/").Expect().Status(httptest.StatusMethodNotAllowed).Body().Equal("Method Not Allowed") - sub.GET("/notfound").Expect().Status(httptest.StatusNotFound).Body().Equal("Not Found") + sub.GET("/").Expect().Status(httptest.StatusOK).Body().IsEmpty() + sub.POST("/").Expect().Status(httptest.StatusMethodNotAllowed).Body().IsEqual("Method Not Allowed") + sub.GET("/notfound").Expect().Status(httptest.StatusNotFound).Body().IsEqual("Not Found") } } diff --git a/middleware/jwt/jwt_test.go b/middleware/jwt/jwt_test.go index 6b9d75f22..8086e21d4 100644 --- a/middleware/jwt/jwt_test.go +++ b/middleware/jwt/jwt_test.go @@ -49,10 +49,10 @@ func TestJWT(t *testing.T) { // Test Header. headerValue := fmt.Sprintf("Bearer %s", token) e.GET("/protected").WithHeader("Authorization", headerValue).Expect(). - Status(iris.StatusOK).Body().Equal("bar") + Status(iris.StatusOK).Body().IsEqual("bar") // Test URL query. e.GET("/protected").WithQuery("token", token).Expect(). - Status(iris.StatusOK).Body().Equal("bar") + Status(iris.StatusOK).Body().IsEqual("bar") // Test unauthorized. e.GET("/protected").Expect().Status(iris.StatusUnauthorized) @@ -61,5 +61,5 @@ func TestJWT(t *testing.T) { // Test expired (note checks happen based on second round). time.Sleep(5 * time.Second) e.GET("/protected").WithHeader("Authorization", headerValue).Expect(). - Status(iris.StatusUnauthorized).Body().Equal("jwt: token expired") + Status(iris.StatusUnauthorized).Body().IsEqual("jwt: token expired") } diff --git a/middleware/methodoverride/methodoverride_test.go b/middleware/methodoverride/methodoverride_test.go index fe6ec92de..df185696b 100644 --- a/middleware/methodoverride/methodoverride_test.go +++ b/middleware/methodoverride/methodoverride_test.go @@ -49,28 +49,28 @@ func TestMethodOverrideWrapper(t *testing.T) { // Test headers. e.POST("/path").WithHeader("X-HTTP-Method", iris.MethodDelete).Expect(). - Status(iris.StatusOK).Body().Equal(expectedDelResponse) + Status(iris.StatusOK).Body().IsEqual(expectedDelResponse) e.POST("/path").WithHeader("X-HTTP-Method-Override", iris.MethodDelete).Expect(). - Status(iris.StatusOK).Body().Equal(expectedDelResponse) + Status(iris.StatusOK).Body().IsEqual(expectedDelResponse) e.POST("/path").WithHeader("X-Method-Override", iris.MethodDelete).Expect(). - Status(iris.StatusOK).Body().Equal(expectedDelResponse) + Status(iris.StatusOK).Body().IsEqual(expectedDelResponse) // Test form field value. e.POST("/path").WithFormField("_method", iris.MethodDelete).Expect(). - Status(iris.StatusOK).Body().Equal(expectedDelResponse) + Status(iris.StatusOK).Body().IsEqual(expectedDelResponse) // Test URL Query (although it's the same as form field in this case). e.POST("/path").WithQuery("_method", iris.MethodDelete).Expect(). - Status(iris.StatusOK).Body().Equal(expectedDelResponse) + Status(iris.StatusOK).Body().IsEqual(expectedDelResponse) // Test saved original method and // Test without registered "POST" route. e.POST("/path2").WithQuery("_method", iris.MethodDelete).Expect(). - Status(iris.StatusOK).Body().Equal(expectedDelResponse + iris.MethodPost) + Status(iris.StatusOK).Body().IsEqual(expectedDelResponse + iris.MethodPost) // Test simple POST request without method override fields. - e.POST("/path").Expect().Status(iris.StatusOK).Body().Equal(expectedPostResponse) + e.POST("/path").Expect().Status(iris.StatusOK).Body().IsEqual(expectedPostResponse) // Test simple DELETE request. - e.DELETE("/path").Expect().Status(iris.StatusOK).Body().Equal(expectedDelResponse) + e.DELETE("/path").Expect().Status(iris.StatusOK).Body().IsEqual(expectedDelResponse) } diff --git a/middleware/requestid/requestid_test.go b/middleware/requestid/requestid_test.go index a5478d4b2..523363c69 100644 --- a/middleware/requestid/requestid_test.go +++ b/middleware/requestid/requestid_test.go @@ -57,7 +57,7 @@ func TestRequestID(t *testing.T) { e := httptest.New(t, app) e.GET("/default").Expect().Status(httptest.StatusOK).Body().NotEmpty() - e.GET("/custom").Expect().Status(httptest.StatusOK).Body().Equal(expectedCustomID) - e.GET("/custom_err").Expect().Status(httptest.StatusUnauthorized).Body().Equal(expectedErrMsg) - e.GET("/custom_change_id").Expect().Status(httptest.StatusOK).Body().Equal(expectedCustomIDFromOtherMiddleware) + e.GET("/custom").Expect().Status(httptest.StatusOK).Body().IsEqual(expectedCustomID) + e.GET("/custom_err").Expect().Status(httptest.StatusUnauthorized).Body().IsEqual(expectedErrMsg) + e.GET("/custom_change_id").Expect().Status(httptest.StatusOK).Body().IsEqual(expectedCustomIDFromOtherMiddleware) } diff --git a/mvc/controller_handle_test.go b/mvc/controller_handle_test.go index 59038b423..cb88eb605 100644 --- a/mvc/controller_handle_test.go +++ b/mvc/controller_handle_test.go @@ -124,7 +124,7 @@ func TestControllerHandle(t *testing.T) { e := httptest.New(t, app) // test the index, is not part of the current package's implementation but do it. - e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal("index") + e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual("index") // the important things now. @@ -133,30 +133,30 @@ func TestControllerHandle(t *testing.T) { // (which is the function's receiver, if any, in this case the *testController in go). expectedReqField := "this is a request field filled by this url param" e.GET("/histatic").WithQuery("reqfield", expectedReqField).Expect().Status(httptest.StatusOK). - Body().Equal(expectedReqField) + Body().IsEqual(expectedReqField) // this test makes sure that the binded values of the controller is handled correctly // and can be used in a user-defined, dynamic "mvc handler". e.GET("/hiservice").Expect().Status(httptest.StatusOK). - Body().Equal("service: hi") + Body().IsEqual("service: hi") e.GET("/hiservice/value").Expect().Status(httptest.StatusOK). - Body().Equal("service: hi with param: value") + Body().IsEqual("service: hi with param: value") // this worked with a temporary variadic on the resolvemethodfunc which is not // correct design, I should split the path and params with the rest of implementation // in order a simple template.Src can be given. e.GET("/hiparam/value").Expect().Status(httptest.StatusOK). - Body().Equal("value") + Body().IsEqual("value") e.GET("/hiparamempyinput/value").Expect().Status(httptest.StatusOK). - Body().Equal("empty in but served with ctx.Params.Get('ps')=value") + Body().IsEqual("empty in but served with ctx.Params.Get('ps')=value") e.GET("/custom/value1").Expect().Status(httptest.StatusOK). - Body().Equal("value1") + Body().IsEqual("value1") e.GET("/custom2/value2").Expect().Status(httptest.StatusOK). - Body().Equal("value2") + Body().IsEqual("value2") e.GET("/custom3/value1/value2").Expect().Status(httptest.StatusOK). - Body().Equal("value1value2") + Body().IsEqual("value1value2") e.GET("/custom3/value1").Expect().Status(httptest.StatusNotFound) e.GET("/hi/param/empty/input/with/ctx/value").Expect().Status(httptest.StatusOK). - Body().Equal("empty in but served with ctx.Params.Get('param2')= value == id == value") + Body().IsEqual("empty in but served with ctx.Params.Get('param2')= value == id == value") } type testControllerHandleWithDynamicPathPrefix struct { @@ -173,7 +173,7 @@ func TestControllerHandleWithDynamicPathPrefix(t *testing.T) { New(app.Party("/api/data/{model:string}/{action:string}")).Handle(new(testControllerHandleWithDynamicPathPrefix)) e := httptest.New(t, app) e.GET("/api/data/mymodel/myaction/myid").Expect().Status(httptest.StatusOK). - Body().Equal("mymodelmyactionmyid") + Body().IsEqual("mymodelmyactionmyid") } type testControllerGetBy struct{} @@ -195,7 +195,7 @@ func TestControllerGetByWithAllowMethods(t *testing.T) { e := httptest.New(t, app) e.GET("/project/42").Expect().Status(httptest.StatusOK). - JSON().Equal(&testCustomStruct{Age: 42, Name: "name"}) + JSON().IsEqual(&testCustomStruct{Age: 42, Name: "name"}) e.POST("/project/42").Expect().Status(httptest.StatusOK) e.PUT("/project/42").Expect().Status(httptest.StatusMethodNotAllowed) } diff --git a/mvc/controller_method_result_test.go b/mvc/controller_method_result_test.go index 163bf1b11..0168826c1 100644 --- a/mvc/controller_method_result_test.go +++ b/mvc/controller_method_result_test.go @@ -74,32 +74,32 @@ func TestControllerMethodResult(t *testing.T) { e := httptest.New(t, app) e.GET("/").Expect().Status(iris.StatusOK). - Body().Equal("Hello World!") + Body().IsEqual("Hello World!") e.GET("/with/status").Expect().Status(iris.StatusNotFound). - Body().Equal("This page doesn't exist") + Body().IsEqual("This page doesn't exist") e.GET("/json").Expect().Status(iris.StatusOK). - JSON().Equal(iris.Map{ + JSON().IsEqual(iris.Map{ "name": "Iris", "age": 2, }) e.GET("/json").WithQuery("err", true).Expect(). Status(iris.StatusBadRequest). - Body().Equal("error here") + Body().IsEqual("error here") e.GET("/thing/with/try/1").Expect(). Status(iris.StatusOK). - Body().Equal("thing 1") + Body().IsEqual("thing 1") // failure because of index exceed the slice e.GET("/thing/with/try/3").Expect(). Status(iris.StatusNotFound). - Body().Equal("thing does not exist") + Body().IsEqual("thing does not exist") e.GET("/thing/with/try/default/3").Expect(). Status(iris.StatusBadRequest). - Body().Equal("Bad Request") + Body().IsEqual("Bad Request") } type testControllerMethodResultTypes struct { @@ -178,49 +178,49 @@ func TestControllerMethodResultTypes(t *testing.T) { e := httptest.New(t, app) e.GET("/text").Expect().Status(iris.StatusOK). - Body().Equal("text") + Body().IsEqual("text") e.GET("/status").Expect().Status(iris.StatusBadGateway) e.GET("/text/with/status/ok").Expect().Status(iris.StatusOK). - Body().Equal("OK") + Body().IsEqual("OK") e.GET("/status/with/text/not/ok/first/second").Expect().Status(iris.StatusForbidden). - Body().Equal("NOT_OK_firstsecond") + Body().IsEqual("NOT_OK_firstsecond") // Author's note: <-- if that fails means that the last binder called for both input args, // see path_param_binder.go e.GET("/text/and/content/type").Expect().Status(iris.StatusOK). ContentType("text/html", "utf-8"). - Body().Equal("text") + Body().IsEqual("text") e.GET("/custom/response").Expect().Status(iris.StatusOK). ContentType("text/html", "utf-8"). - Body().Equal("text") + Body().IsEqual("text") e.GET("/custom/response/with/status/ok").Expect().Status(iris.StatusOK). ContentType("text/html", "utf-8"). - Body().Equal("OK") + Body().IsEqual("OK") e.GET("/custom/response/with/status/not/ok").Expect().Status(iris.StatusInternalServerError). ContentType("text/html", "utf-8"). - Body().Equal("internal server error") + Body().IsEqual("internal server error") expectedResultFromCustomStruct := map[string]interface{}{ "name": "Iris", "age": 2, } e.GET("/custom/struct").Expect().Status(iris.StatusOK). - JSON().Equal(expectedResultFromCustomStruct) + JSON().IsEqual(expectedResultFromCustomStruct) e.GET("/custom/struct/with/status/not/ok").Expect().Status(iris.StatusInternalServerError). - JSON().Equal(expectedResultFromCustomStruct) + JSON().IsEqual(expectedResultFromCustomStruct) e.GET("/custom/struct/with/content/type").Expect().Status(iris.StatusOK). ContentType("text/xml", "utf-8") e.GET("/custom/struct/with/error").Expect().Status(iris.StatusOK). - JSON().Equal(expectedResultFromCustomStruct) + JSON().IsEqual(expectedResultFromCustomStruct) e.GET("/custom/struct/with/error").WithQuery("err", true).Expect(). Status(iris.StatusBadRequest). // the default status code if error is not nil // the content should be not JSON it should be the status code's text // it will fire the error's text - Body().Equal("omit return of testCustomStruct and fire error") + Body().IsEqual("omit return of testCustomStruct and fire error") } type testControllerViewResultRespectCtxViewData struct { diff --git a/mvc/controller_overlap_test.go b/mvc/controller_overlap_test.go index d7897fc45..768418278 100644 --- a/mvc/controller_overlap_test.go +++ b/mvc/controller_overlap_test.go @@ -28,23 +28,23 @@ func TestControllerOverlap(t *testing.T) { } e := httptest.New(t, app) - e.GET("/user").Expect().Status(httptest.StatusUnauthorized).Body().Equal("unauth") + e.GET("/user").Expect().Status(httptest.StatusUnauthorized).Body().IsEqual("unauth") // Test raw stop execution with a status code sent on the controller's method. - e.GET("/user/with/status/on/method").Expect().Status(httptest.StatusBadRequest).Body().Equal("unauth") + e.GET("/user/with/status/on/method").Expect().Status(httptest.StatusBadRequest).Body().IsEqual("unauth") // Test stop execution with status but last code sent through the controller's method. - e.GET("/user/with/status/on/method/too").Expect().Status(httptest.StatusInternalServerError).Body().Equal("unauth") + e.GET("/user/with/status/on/method/too").Expect().Status(httptest.StatusInternalServerError).Body().IsEqual("unauth") // Test raw stop execution and no status code sent on controller's method (should be OK). - e.GET("/user/with/no/status").Expect().Status(httptest.StatusOK).Body().Equal("unauth") + e.GET("/user/with/no/status").Expect().Status(httptest.StatusOK).Body().IsEqual("unauth") // Test authenticated request. - e.GET("/user").WithQuery("id", 42).Expect().Status(httptest.StatusOK).Body().Equal("auth: 42") + e.GET("/user").WithQuery("id", 42).Expect().Status(httptest.StatusOK).Body().IsEqual("auth: 42") // Test HandleHTTPError method accepts a not found and returns a 404 // from a shared controller and overlapped, the url parameter matters because this method was overlapped. e.GET("/user/notfound").Expect().Status(httptest.StatusBadRequest). - Body().Equal("error: *mvc_test.UnauthenticatedUserController: from: 404 to: 400") + Body().IsEqual("error: *mvc_test.UnauthenticatedUserController: from: 404 to: 400") e.GET("/user/notfound").WithQuery("id", 42).Expect().Status(httptest.StatusBadRequest). - Body().Equal("error: *mvc_test.AuthenticatedUserController: from: 404 to: 400") + Body().IsEqual("error: *mvc_test.AuthenticatedUserController: from: 404 to: 400") } type AuthenticatedTest uint64 diff --git a/mvc/controller_test.go b/mvc/controller_test.go index a4dd961b6..6d2070117 100644 --- a/mvc/controller_test.go +++ b/mvc/controller_test.go @@ -82,13 +82,13 @@ func TestControllerMethodFuncs(t *testing.T) { for _, method := range router.AllMethods { e.Request(method, "/").Expect().Status(iris.StatusOK). - Body().Equal(method) + Body().IsEqual(method) e.Request(method, "/all").Expect().Status(iris.StatusOK). - Body().Equal(method) + Body().IsEqual(method) e.Request(method, "/any").Expect().Status(iris.StatusOK). - Body().Equal(method) + Body().IsEqual(method) } } @@ -137,9 +137,9 @@ func TestControllerBeginAndEndRequestFunc(t *testing.T) { for _, username := range usernames { e.GET("/profile/" + username).Expect().Status(iris.StatusOK). - Body().Equal(username + doneResponse) + Body().IsEqual(username + doneResponse) e.POST("/profile/" + username).Expect().Status(iris.StatusOK). - Body().Equal(username + doneResponse) + Body().IsEqual(username + doneResponse) } } @@ -178,17 +178,17 @@ func TestControllerBeginAndEndRequestFuncBindMiddleware(t *testing.T) { getEx := e.GET("/profile/" + username).Expect() if allow { getEx.Status(iris.StatusOK). - Body().Equal(username + doneResponse) + Body().IsEqual(username + doneResponse) } else { - getEx.Status(iris.StatusForbidden).Body().Equal("forbidden") + getEx.Status(iris.StatusForbidden).Body().IsEqual("forbidden") } postEx := e.POST("/profile/" + username).Expect() if allow { postEx.Status(iris.StatusOK). - Body().Equal(username + doneResponse) + Body().IsEqual(username + doneResponse) } else { - postEx.Status(iris.StatusForbidden).Body().Equal("forbidden") + postEx.Status(iris.StatusForbidden).Body().IsEqual("forbidden") } } } @@ -251,7 +251,7 @@ func TestControllerEndRequestAwareness(t *testing.T) { for _, username := range usernames { e.GET("/era/" + username).Expect().Status(iris.StatusOK). - Body().Equal(username + username + "2") + Body().IsEqual(username + username + "2") } } @@ -315,17 +315,17 @@ func TestControllerDependencies(t *testing.T) { e := httptest.New(t, app) expected := t1 + t2 e.GET("/").Expect().Status(iris.StatusOK). - Body().Equal(expected) + Body().IsEqual(expected) e.GET("/ctx").Expect().Status(iris.StatusContinue) e.GET("/deep").Expect().Status(iris.StatusOK). - Body().Equal(expected) + Body().IsEqual(expected) e.POST("/deep").WithJSON(iris.Map{"name": "kataras"}).Expect().Status(iris.StatusOK). - Body().Equal("kataras") + Body().IsEqual("kataras") e.POST("/deep").Expect().Status(iris.StatusBadRequest). - Body().Equal("EOF") + Body().IsEqual("EOF") } type testCtrl0 struct { @@ -381,7 +381,7 @@ func TestControllerInsideControllerRecursively(t *testing.T) { e := httptest.New(t, app) e.GET("/user/" + username).Expect(). - Status(iris.StatusOK).Body().Equal(expected) + Status(iris.StatusOK).Body().IsEqual(expected) } type testControllerRelPathFromFunc struct{} @@ -421,47 +421,47 @@ func TestControllerRelPathFromFunc(t *testing.T) { e := httptest.New(t, app) e.GET("/").Expect().Status(iris.StatusOK). - Body().Equal("GET:/") + Body().IsEqual("GET:/") e.GET("/18446744073709551615").Expect().Status(iris.StatusOK). - Body().Equal("GET:/18446744073709551615") + Body().IsEqual("GET:/18446744073709551615") e.GET("/uint8/ratio/255").Expect().Status(iris.StatusOK). - Body().Equal("GET:/uint8/ratio/255") + Body().IsEqual("GET:/uint8/ratio/255") e.GET("/uint8/ratio/256").Expect().Status(iris.StatusNotFound) e.GET("/int64/ratio/-42").Expect().Status(iris.StatusOK). - Body().Equal("GET:/int64/ratio/-42") + Body().IsEqual("GET:/int64/ratio/-42") e.GET("/something/true").Expect().Status(iris.StatusOK). - Body().Equal("GET:/something/true") + Body().IsEqual("GET:/something/true") e.GET("/something/false").Expect().Status(iris.StatusOK). - Body().Equal("GET:/something/false") + Body().IsEqual("GET:/something/false") e.GET("/something/truee").Expect().Status(iris.StatusNotFound) e.GET("/something/falsee").Expect().Status(iris.StatusNotFound) e.GET("/something/kataras/42").Expect().Status(iris.StatusOK). - Body().Equal("GET:/something/kataras/42") + Body().IsEqual("GET:/something/kataras/42") e.GET("/something/new/kataras/42").Expect().Status(iris.StatusOK). - Body().Equal("GET:/something/new/kataras/42") + Body().IsEqual("GET:/something/new/kataras/42") e.GET("/something/true/else/this/42").Expect().Status(iris.StatusOK). - Body().Equal("GET:/something/true/else/this/42") + Body().IsEqual("GET:/something/true/else/this/42") e.GET("/login").Expect().Status(iris.StatusOK). - Body().Equal("GET:/login") + Body().IsEqual("GET:/login") e.POST("/login").Expect().Status(iris.StatusOK). - Body().Equal("POST:/login") + Body().IsEqual("POST:/login") e.GET("/admin/login").Expect().Status(iris.StatusOK). - Body().Equal("GET:/admin/login") + Body().IsEqual("GET:/admin/login") e.PUT("/something/into/this").Expect().Status(iris.StatusOK). - Body().Equal("PUT:/something/into/this") + Body().IsEqual("PUT:/something/into/this") e.GET("/42").Expect().Status(iris.StatusOK). - Body().Equal("GET:/42") + Body().IsEqual("GET:/42") e.GET("/anything/here").Expect().Status(iris.StatusOK). - Body().Equal("GET:/anything/here") + Body().IsEqual("GET:/anything/here") e.GET("/location/x").Expect().Status(iris.StatusOK). - Body().Equal("GET:/location/x") + Body().IsEqual("GET:/location/x") e.GET("/location/x/y").Expect().Status(iris.StatusOK). - Body().Equal("GET:/location/x/y") + Body().IsEqual("GET:/location/x/y") e.GET("/location/z/42").Expect().Status(iris.StatusOK). - Body().Equal("GET:/location/z/42") + Body().IsEqual("GET:/location/z/42") } type testControllerActivateListener struct { @@ -502,16 +502,16 @@ func TestControllerActivateListener(t *testing.T) { e := httptest.New(t, app) e.GET("/").Expect().Status(iris.StatusOK). - Body().Equal("overrides the dependency but not the field") + Body().IsEqual("overrides the dependency but not the field") e.GET("/me/tos-read").Expect().Status(iris.StatusOK). - Body().Equal("MeTOSRead") + Body().IsEqual("MeTOSRead") e.POST("/me/tos-read").Expect().Status(iris.StatusOK). - Body().Equal("MeTOSRead") + Body().IsEqual("MeTOSRead") e.GET("/manual").Expect().Status(iris.StatusOK). - Body().Equal("overrides the dependency but not the field") + Body().IsEqual("overrides the dependency but not the field") e.GET("/manual2").Expect().Status(iris.StatusOK). - Body().Equal("my manual title") + Body().IsEqual("my manual title") } type testControllerNotCreateNewDueManuallySettingAllFields struct { @@ -550,7 +550,7 @@ func TestControllerNotCreateNewDueManuallySettingAllFields(t *testing.T) { e := httptest.New(t, app) e.GET("/").Expect().Status(iris.StatusOK). - Body().Equal("my title") + Body().IsEqual("my title") } type testControllerRequestScopedDependencies struct { @@ -594,11 +594,11 @@ func TestControllerRequestScopedDependencies(t *testing.T) { e := httptest.New(t, app) e.GET("/").WithQuery("name", "kataras").WithQuery("age", 27). - Expect().Status(httptest.StatusOK).JSON().Equal(&testCustomStruct{ + Expect().Status(httptest.StatusOK).JSON().IsEqual(&testCustomStruct{ Name: "kataras", Age: 27, }) - e.GET("/custom/context").Expect().Status(httptest.StatusOK).Body().Equal("test") + e.GET("/custom/context").Expect().Status(httptest.StatusOK).Body().IsEqual("test") } type ( @@ -637,7 +637,7 @@ func TestControllersInsideControllerDeep(t *testing.T) { m.Handle(new(FinalController)) e := httptest.New(t, app) - e.GET("/something").Expect().Status(httptest.StatusOK).Body().Equal("foo bar") + e.GET("/something").Expect().Status(httptest.StatusOK).Body().IsEqual("foo bar") } type testApplicationDependency struct { @@ -657,8 +657,8 @@ func TestApplicationDependency(t *testing.T) { m2.Handle(new(testApplicationDependency)) e := httptest.New(t, app) - e.GET("/").Expect().Status(httptest.StatusOK).Body().Equal("app1") - e.GET("/other").Expect().Status(httptest.StatusOK).Body().Equal("app2") + e.GET("/").Expect().Status(httptest.StatusOK).Body().IsEqual("app1") + e.GET("/other").Expect().Status(httptest.StatusOK).Body().IsEqual("app2") } type testControllerMethodHandlerBindStruct struct{} @@ -701,11 +701,11 @@ func TestControllerMethodHandlerBindStruct(t *testing.T) { manyData := []bindStructData{data, {"john doe"}} e := httptest.New(t, app) - e.GET("/data").WithQueryObject(data).Expect().Status(httptest.StatusOK).JSON().Equal(data) - e.PATCH("/data").WithJSON(data).Expect().Status(httptest.StatusOK).JSON().Equal(data) - e.POST("/data/42/slice").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().Equal(manyData) - e.POST("/data/42/slicetype").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().Equal(manyData) - e.POST("/data/42/slicetypeptr").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().Equal(manyData) + e.GET("/data").WithQueryObject(data).Expect().Status(httptest.StatusOK).JSON().IsEqual(data) + e.PATCH("/data").WithJSON(data).Expect().Status(httptest.StatusOK).JSON().IsEqual(data) + e.POST("/data/42/slice").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().IsEqual(manyData) + e.POST("/data/42/slicetype").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().IsEqual(manyData) + e.POST("/data/42/slicetypeptr").WithJSON(manyData).Expect().Status(httptest.StatusOK).JSON().IsEqual(manyData) // more tests inside the hero package itself. } @@ -721,7 +721,7 @@ func TestErrorHandlerContinue(t *testing.T) { WithFormField("username", "makis"). WithFormField("age", "27"). WithFormField("unknown", "continue"). - Expect().Status(httptest.StatusOK).Body().Equal("makis is 27 years old\n") + Expect().Status(httptest.StatusOK).Body().IsEqual("makis is 27 years old\n") } } diff --git a/sessions/sessions_test.go b/sessions/sessions_test.go index 414c8f116..0ee2bd06a 100644 --- a/sessions/sessions_test.go +++ b/sessions/sessions_test.go @@ -114,7 +114,7 @@ func testSessions(t *testing.T, app *iris.Application) { d.JSON().Object().Empty() d = e.GET("/after_destroy_renew").Expect().Status(iris.StatusOK) - d.Body().Equal("true") + d.Body().IsEqual("true") d.Cookies().NotEmpty() // set and clear again @@ -123,7 +123,7 @@ func testSessions(t *testing.T, app *iris.Application) { // test start on the same request but more than one times - e.GET("/multi_start_set_get").Expect().Status(iris.StatusOK).Body().Equal("value") + e.GET("/multi_start_set_get").Expect().Status(iris.StatusOK).Body().IsEqual("value") } func TestFlashMessages(t *testing.T) { @@ -211,7 +211,7 @@ func TestFlashMessages(t *testing.T) { // set again in order to take the single one ( we don't test Cookies.NotEmpty because httpexpect default conf reads that from the request-only) e.POST("/set").WithJSON(values).Expect().Status(iris.StatusOK) - e.GET("/get_single").Expect().Status(iris.StatusOK).Body().Equal(valueSingleValue) + e.GET("/get_single").Expect().Status(iris.StatusOK).Body().IsEqual(valueSingleValue) } func TestSessionsUpdateExpiration(t *testing.T) { @@ -268,11 +268,11 @@ func TestSessionsUpdateExpiration(t *testing.T) { expectedResponse := response{SessionID: sessionID, Logged: true} e.GET("/get").Expect().Status(httptest.StatusOK). - JSON().Equal(expectedResponse) + JSON().IsEqual(expectedResponse) tt = e.POST("/remember_me").Expect().Status(httptest.StatusOK) tt.Cookie(cookieName).MaxAge().InRange(23*time.Hour, 24*time.Hour) - tt.JSON().Equal(expectedResponse) + tt.JSON().IsEqual(expectedResponse) // Test call `UpdateExpiration` when cookie is firstly created. e.GET("/destroy").Expect().Status(httptest.StatusOK) @@ -312,7 +312,7 @@ func TestSessionsUpdateExpirationConcurrently(t *testing.T) { for i < 1000 { go func() { tt := e.GET("/get").Expect().Status(httptest.StatusOK) - tt.Body().Equal(id) + tt.Body().IsEqual(id) tt.Cookie(cookieName).MaxAge().InRange(29*time.Minute, 30*time.Minute) wg.Done() }() @@ -320,6 +320,6 @@ func TestSessionsUpdateExpirationConcurrently(t *testing.T) { } wg.Wait() tt := e.GET("/get").Expect() - tt.Status(httptest.StatusOK).Body().Equal(id) + tt.Status(httptest.StatusOK).Body().IsEqual(id) tt.Cookie(cookieName).MaxAge().InRange(29*time.Minute, 30*time.Minute) } diff --git a/versioning/deprecation_test.go b/versioning/deprecation_test.go index 3dfd77b58..1755b2a82 100644 --- a/versioning/deprecation_test.go +++ b/versioning/deprecation_test.go @@ -26,7 +26,7 @@ func TestDeprecated(t *testing.T) { e := httptest.New(t, app) ex := e.GET("/").WithHeader(versioning.AcceptVersionHeaderKey, "1.0").Expect() - ex.Status(iris.StatusOK).Body().Equal("1.0") + ex.Status(iris.StatusOK).Body().IsEqual("1.0") ex.Header("X-API-Warn").Equal(opts.WarnMessage) expectedDateStr := opts.DeprecationDate.Format(app.ConfigurationReadOnly().GetTimeFormat()) ex.Header("X-API-Deprecation-Date").Equal(expectedDateStr) diff --git a/versioning/group_test.go b/versioning/group_test.go index 8512bc16f..e0d160335 100644 --- a/versioning/group_test.go +++ b/versioning/group_test.go @@ -37,20 +37,20 @@ func TestNewGroup(t *testing.T) { e := httptest.New(t, app) ex := e.GET("/api/user").WithHeader(versioning.AcceptVersionHeaderKey, "1.0.0").Expect() - ex.Status(iris.StatusOK).Body().Equal(v10Response) + ex.Status(iris.StatusOK).Body().IsEqual(v10Response) ex.Header("X-API-Warn").Equal(versioning.DefaultDeprecationOptions.WarnMessage) e.GET("/api/user").WithHeader(versioning.AcceptVersionHeaderKey, "2.0.0").Expect(). - Status(iris.StatusOK).Body().Equal(v2Response) + Status(iris.StatusOK).Body().IsEqual(v2Response) e.GET("/api/user").WithHeader(versioning.AcceptVersionHeaderKey, "2.1.0").Expect(). - Status(iris.StatusOK).Body().Equal(v2Response) + Status(iris.StatusOK).Body().IsEqual(v2Response) e.GET("/api/user").WithHeader(versioning.AcceptVersionHeaderKey, "2.9.9").Expect(). - Status(iris.StatusOK).Body().Equal(v2Response) + Status(iris.StatusOK).Body().IsEqual(v2Response) e.POST("/api/user").WithHeader(versioning.AcceptVersionHeaderKey, "2.0.0").Expect(). - Status(iris.StatusOK).Body().Equal(v2Response) + Status(iris.StatusOK).Body().IsEqual(v2Response) e.PUT("/api/user/other").WithHeader(versioning.AcceptVersionHeaderKey, "2.9.0").Expect(). - Status(iris.StatusOK).Body().Equal(v2Response) + Status(iris.StatusOK).Body().IsEqual(v2Response) e.GET("/api/user").WithHeader(versioning.AcceptVersionHeaderKey, "3.0").Expect(). - Status(iris.StatusNotImplemented).Body().Equal("version not found") + Status(iris.StatusNotImplemented).Body().IsEqual("version not found") } diff --git a/versioning/version_test.go b/versioning/version_test.go index f403fae2b..c190d4d80 100644 --- a/versioning/version_test.go +++ b/versioning/version_test.go @@ -33,27 +33,27 @@ func TestGetVersion(t *testing.T) { e := httptest.New(t, app) e.GET("/").WithHeader(versioning.AcceptVersionHeaderKey, "1.0.0").Expect(). - Status(iris.StatusOK).Body().Equal("1.0.0") + Status(iris.StatusOK).Body().IsEqual("1.0.0") e.GET("/").WithHeader(versioning.AcceptHeaderKey, "application/vnd.api+json; version=2.1.0").Expect(). - Status(iris.StatusOK).Body().Equal("2.1.0") + Status(iris.StatusOK).Body().IsEqual("2.1.0") e.GET("/").WithHeader(versioning.AcceptHeaderKey, "application/vnd.api+json; version=2.1.0 ;other=dsa").Expect(). - Status(iris.StatusOK).Body().Equal("2.1.0") + Status(iris.StatusOK).Body().IsEqual("2.1.0") e.GET("/").WithHeader(versioning.AcceptHeaderKey, "version=2.1.0").Expect(). - Status(iris.StatusOK).Body().Equal("2.1.0") + Status(iris.StatusOK).Body().IsEqual("2.1.0") e.GET("/").WithHeader(versioning.AcceptHeaderKey, "version=1.0.0").Expect(). - Status(iris.StatusOK).Body().Equal("1.0.0") + Status(iris.StatusOK).Body().IsEqual("1.0.0") // unknown versions. e.GET("/").WithHeader(versioning.AcceptVersionHeaderKey, "").Expect(). - Status(iris.StatusOK).Body().Equal("") + Status(iris.StatusOK).Body().IsEqual("") e.GET("/").WithHeader(versioning.AcceptHeaderKey, "application/vnd.api+json; version=").Expect(). - Status(iris.StatusOK).Body().Equal("") + Status(iris.StatusOK).Body().IsEqual("") e.GET("/").WithHeader(versioning.AcceptHeaderKey, "application/vnd.api+json; version= ;other=dsa").Expect(). - Status(iris.StatusOK).Body().Equal("") + Status(iris.StatusOK).Body().IsEqual("") e.GET("/").WithHeader(versioning.AcceptHeaderKey, "version=").Expect(). - Status(iris.StatusOK).Body().Equal("") + Status(iris.StatusOK).Body().IsEqual("") - e.GET("/manual").Expect().Status(iris.StatusOK).Body().Equal("11.0.5") + e.GET("/manual").Expect().Status(iris.StatusOK).Body().IsEqual("11.0.5") } func TestVersionAliases(t *testing.T) { @@ -87,21 +87,21 @@ func TestVersionAliases(t *testing.T) { e := httptest.New(t, app) // Make sure the SetVersion still works. - e.GET("/api/manual").Expect().Status(iris.StatusOK).Body().Equal("12.0.0") + e.GET("/api/manual").Expect().Status(iris.StatusOK).Body().IsEqual("12.0.0") // Test Empty default. e.GET("/api").WithHeader(versioning.AcceptVersionHeaderKey, "").Expect(). - Status(iris.StatusOK).Body().Equal("1.0.0") + Status(iris.StatusOK).Body().IsEqual("1.0.0") // Test NotFound error, aliases are not responsible for that. e.GET("/api").WithHeader(versioning.AcceptVersionHeaderKey, "4.0.0").Expect(). - Status(iris.StatusNotImplemented).Body().Equal("version not found") + Status(iris.StatusNotImplemented).Body().IsEqual("version not found") // Test "stage" alias. e.GET("/api").WithHeader(versioning.AcceptVersionHeaderKey, "stage").Expect(). - Status(iris.StatusOK).Body().Equal("2.0.0") + Status(iris.StatusOK).Body().IsEqual("2.0.0") // Test version 2. e.GET("/api").WithHeader(versioning.AcceptVersionHeaderKey, "2.0.0").Expect(). - Status(iris.StatusOK).Body().Equal("2.0.0") + Status(iris.StatusOK).Body().IsEqual("2.0.0") // Test version 3 (registered first). e.GET("/api").WithHeader(versioning.AcceptVersionHeaderKey, "3.1.0").Expect(). - Status(iris.StatusOK).Body().Equal("3.1.0") + Status(iris.StatusOK).Body().IsEqual("3.1.0") } From d254d48f346e81e86170da5010e86c5e2bf8a4cf Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Mon, 17 Jul 2023 18:30:45 +0300 Subject: [PATCH 54/63] Add mvc.Application.EnableStructDependents() and app.ConfigureContainer().EnableStructDependents() relative to: #2158 --- HISTORY.md | 2 ++ core/router/api_container.go | 8 ++++++++ go.mod | 6 +++--- go.sum | 13 ++++++------- hero/binding.go | 4 ++-- hero/binding_test.go | 4 ++-- hero/container.go | 34 +++++++++++++++++++++------------- hero/dependency.go | 34 ++++++++++++++++++++++++++++------ hero/reflect.go | 4 ++++ hero/struct.go | 2 +- mvc/mvc.go | 8 ++++++++ 11 files changed, 85 insertions(+), 34 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 9203a1370..b4bf672fc 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -23,6 +23,8 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene Changes apply to `master` branch. +- Add `mvc.Application.EnableStructDependents()` method to handle [#2158](https://github.com/kataras/iris/issues/2158). + - Fix [iris-premium#17](https://github.com/kataras/iris-premium/issues/17). - Replace [russross/blackfriday](github.com/russross/blackfriday/v2) with [gomarkdown](https://github.com/gomarkdown/markdown) as requested at [#2098](https://github.com/kataras/iris/issues/2098). diff --git a/core/router/api_container.go b/core/router/api_container.go index c1d9d9e90..0c571fa9c 100644 --- a/core/router/api_container.go +++ b/core/router/api_container.go @@ -95,6 +95,14 @@ func (api *APIContainer) EnableStrictMode(strictMode bool) *APIContainer { return api } +// EnableStructDependents sets the container's EnableStructDependents to true. +// It's used to automatically fill the dependencies of a struct's fields +// based on the previous registered dependencies, just like function inputs. +func (api *APIContainer) EnableStructDependents() *APIContainer { + api.Container.EnableStructDependents = true + return api +} + // SetDependencyMatcher replaces the function that compares equality between // a dependency and an input (struct field or function parameter). // diff --git a/go.mod b/go.mod index 2af1470ff..256d37918 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/fatih/structs v1.1.0 github.com/flosch/pongo2/v4 v4.0.2 github.com/golang/snappy v0.0.4 - github.com/gomarkdown/markdown v0.0.0-20230313173142-2ced44d5b584 + github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12 github.com/google/uuid v1.3.0 github.com/gorilla/securecookie v1.1.1 github.com/iris-contrib/httpexpect/v2 v2.12.1 @@ -72,13 +72,13 @@ require ( github.com/iris-contrib/go.uuid v2.0.0+incompatible // indirect github.com/josharian/intern v1.0.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/mediocregopher/radix/v3 v3.8.1 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/nats-io/jwt/v2 v2.4.0 // indirect + github.com/nats-io/jwt/v2 v2.4.1 // indirect github.com/nats-io/nats.go v1.23.0 // indirect github.com/nats-io/nkeys v0.4.4 // indirect github.com/nats-io/nuid v1.0.1 // indirect diff --git a/go.sum b/go.sum index d53d3a833..82bfa11ee 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,8 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomarkdown/markdown v0.0.0-20230313173142-2ced44d5b584 h1:XaUmlCIi5hEY5GPUV6oXc5eytg9+FBH9/9fOKblHWEU= -github.com/gomarkdown/markdown v0.0.0-20230313173142-2ced44d5b584/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= +github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12 h1:uK3X/2mt4tbSGoHvbLBHUny7CKiuwUip3MArtukol4E= +github.com/gomarkdown/markdown v0.0.0-20230716120725-531d2d74bc12/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -135,8 +135,8 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2/go.mod h1:0KeJpeMD6o+O4hW7qJOT7vyQPKrWmj26uf5wMc/IiIs= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mediocregopher/radix/v3 v3.8.1 h1:rOkHflVuulFKlwsLY01/M2cM2tWCjDoETcMqKbAWu1M= github.com/mediocregopher/radix/v3 v3.8.1/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= github.com/microcosm-cc/bluemonday v1.0.24 h1:NGQoPtwGVcbGkKfvyYk1yRqknzBuoMiUrO6R7uFTPlw= @@ -151,8 +151,8 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OH github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/nats-io/jwt/v2 v2.4.0 h1:1woVcq37qhNwJOeZ4ZoRy5NJU5bvbtGsIammf2GpuJQ= -github.com/nats-io/jwt/v2 v2.4.0/go.mod h1:24BeQtRwxRV8ruvC4CojXlx/WQ/VjuwlYiH+vu/+ibI= +github.com/nats-io/jwt/v2 v2.4.1 h1:Y35W1dgbbz2SQUYDPCaclXcuqleVmpbRa7646Jf2EX4= +github.com/nats-io/jwt/v2 v2.4.1/go.mod h1:24BeQtRwxRV8ruvC4CojXlx/WQ/VjuwlYiH+vu/+ibI= github.com/nats-io/nats-server/v2 v2.9.11 h1:4y5SwWvWI59V5mcqtuoqKq6L9NDUydOP3Ekwuwl8cZI= github.com/nats-io/nats.go v1.23.0 h1:lR28r7IX44WjYgdiKz9GmUeW0uh/m33uD3yEjLZ2cOE= github.com/nats-io/nats.go v1.23.0/go.mod h1:ki/Scsa23edbh8IRZbCuNXR9TDcbvfaSijKtaqQgw+Q= @@ -291,7 +291,6 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/hero/binding.go b/hero/binding.go index 07fe12975..dfcf537c2 100644 --- a/hero/binding.go +++ b/hero/binding.go @@ -291,7 +291,7 @@ func getBindingsForFunc(fn reflect.Value, dependencies []*Dependency, disablePay return bindings } -func getBindingsForStruct(v reflect.Value, dependencies []*Dependency, markExportedFieldsAsRequired bool, disablePayloadAutoBinding bool, matchDependency DependencyMatcher, paramsCount int, sorter Sorter) (bindings []*binding) { +func getBindingsForStruct(v reflect.Value, dependencies []*Dependency, markExportedFieldsAsRequired bool, disablePayloadAutoBinding, enableStructDependents bool, matchDependency DependencyMatcher, paramsCount int, sorter Sorter) (bindings []*binding) { typ := indirectType(v.Type()) if typ.Kind() != reflect.Struct { panic(fmt.Sprintf("bindings: unresolved: not a struct type: %#+v", v)) @@ -303,7 +303,7 @@ func getBindingsForStruct(v reflect.Value, dependencies []*Dependency, markExpor for _, f := range nonZero { // fmt.Printf("Controller [%s] | NonZero | Field Index: %v | Field Type: %s\n", typ, f.Index, f.Type) bindings = append(bindings, &binding{ - Dependency: newDependency(elem.FieldByIndex(f.Index).Interface(), disablePayloadAutoBinding, nil), + Dependency: newDependency(elem.FieldByIndex(f.Index).Interface(), disablePayloadAutoBinding, enableStructDependents, nil), Input: newStructFieldInput(f), }) } diff --git a/hero/binding_test.go b/hero/binding_test.go index 6781f807d..9b9c67800 100644 --- a/hero/binding_test.go +++ b/hero/binding_test.go @@ -524,7 +524,7 @@ func TestBindingsForStruct(t *testing.T) { } for i, tt := range tests { - bindings := getBindingsForStruct(reflect.ValueOf(tt.Value), tt.Registered, false, false, DefaultDependencyMatcher, 0, nil) + bindings := getBindingsForStruct(reflect.ValueOf(tt.Value), tt.Registered, false, false, false, DefaultDependencyMatcher, 0, nil) if expected, got := len(tt.Expected), len(bindings); expected != got { t.Logf("[%d] expected bindings length to be: %d but got: %d:\n", i, expected, got) @@ -565,5 +565,5 @@ func TestBindingsForStructMarkExportedFieldsAsRequred(t *testing.T) { } // should panic if fail. - _ = getBindingsForStruct(reflect.ValueOf(new(controller)), dependencies, true, true, DefaultDependencyMatcher, 0, nil) + _ = getBindingsForStruct(reflect.ValueOf(new(controller)), dependencies, true, true, false, DefaultDependencyMatcher, 0, nil) } diff --git a/hero/container.go b/hero/container.go index 437366a1a..06155c682 100644 --- a/hero/container.go +++ b/hero/container.go @@ -57,6 +57,13 @@ type Container struct { // if at least one input binding depends on the request and not in a static structure. DisableStructDynamicBindings bool + // StructDependents if true then the Container will try to resolve + // the fields of a struct value, if any, when it's a dependent struct value + // based on the previous registered dependencies. + // + // Defaults to false. + EnableStructDependents bool // this can be renamed to IndirectDependencies?. + // DependencyMatcher holds the function that compares equality between // a dependency with an input. Defaults to DefaultMatchDependencyFunc. DependencyMatcher DependencyMatcher @@ -146,11 +153,11 @@ func (c *Container) fillReport(fullName string, bindings []*binding) { // Contains the iris context, standard context, iris sessions and time dependencies. var BuiltinDependencies = []*Dependency{ // iris context dependency. - newDependency(func(ctx *context.Context) *context.Context { return ctx }, true, nil).Explicitly(), + newDependency(func(ctx *context.Context) *context.Context { return ctx }, true, false, nil).Explicitly(), // standard context dependency. newDependency(func(ctx *context.Context) stdContext.Context { return ctx.Request().Context() - }, true, nil).Explicitly(), + }, true, false, nil).Explicitly(), // iris session dependency. newDependency(func(ctx *context.Context) *sessions.Session { session := sessions.Get(ctx) @@ -163,35 +170,35 @@ var BuiltinDependencies = []*Dependency{ } return session - }, true, nil).Explicitly(), + }, true, false, nil).Explicitly(), // application's logger. newDependency(func(ctx *context.Context) *golog.Logger { return ctx.Application().Logger() - }, true, nil).Explicitly(), + }, true, false, nil).Explicitly(), // time.Time to time.Now dependency. newDependency(func(ctx *context.Context) time.Time { return time.Now() - }, true, nil).Explicitly(), + }, true, false, nil).Explicitly(), // standard http Request dependency. newDependency(func(ctx *context.Context) *http.Request { return ctx.Request() - }, true, nil).Explicitly(), + }, true, false, nil).Explicitly(), // standard http ResponseWriter dependency. newDependency(func(ctx *context.Context) http.ResponseWriter { return ctx.ResponseWriter() - }, true, nil).Explicitly(), + }, true, false, nil).Explicitly(), // http headers dependency. newDependency(func(ctx *context.Context) http.Header { return ctx.Request().Header - }, true, nil).Explicitly(), + }, true, false, nil).Explicitly(), // Client IP. newDependency(func(ctx *context.Context) net.IP { return net.ParseIP(ctx.RemoteAddr()) - }, true, nil).Explicitly(), + }, true, false, nil).Explicitly(), // Status Code (special type for MVC HTTP Error handler to not conflict with path parameters) newDependency(func(ctx *context.Context) Code { return Code(ctx.GetStatusCode()) - }, true, nil).Explicitly(), + }, true, false, nil).Explicitly(), // Context Error. May be nil newDependency(func(ctx *context.Context) Err { err := ctx.GetErr() @@ -199,7 +206,7 @@ var BuiltinDependencies = []*Dependency{ return nil } return err - }, true, nil).Explicitly(), + }, true, false, nil).Explicitly(), // Context User, e.g. from basic authentication. newDependency(func(ctx *context.Context) context.User { u := ctx.User() @@ -208,7 +215,7 @@ var BuiltinDependencies = []*Dependency{ } return u - }, true, nil), + }, true, false, nil), // payload and param bindings are dynamically allocated and declared at the end of the `binding` source file. } @@ -254,6 +261,7 @@ func (c *Container) Clone() *Container { cloned.Dependencies = clonedDeps cloned.DisablePayloadAutoBinding = c.DisablePayloadAutoBinding cloned.DisableStructDynamicBindings = c.DisableStructDynamicBindings + cloned.EnableStructDependents = c.EnableStructDependents cloned.MarkExportedFieldsAsRequired = c.MarkExportedFieldsAsRequired cloned.resultHandlers = c.resultHandlers // Reports are not cloned. @@ -291,7 +299,7 @@ func Register(dependency interface{}) *Dependency { // - Register(func(ctx iris.Context) User {...}) // - Register(func(User) OtherResponse {...}) func (c *Container) Register(dependency interface{}) *Dependency { - d := newDependency(dependency, c.DisablePayloadAutoBinding, c.DependencyMatcher, c.Dependencies...) + d := newDependency(dependency, c.DisablePayloadAutoBinding, c.EnableStructDependents, c.DependencyMatcher, c.Dependencies...) if d.DestType == nil { // prepend the dynamic dependency so it will be tried at the end // (we don't care about performance here, design-time) diff --git a/hero/dependency.go b/hero/dependency.go index 711ef28e0..d7aa7d4cf 100644 --- a/hero/dependency.go +++ b/hero/dependency.go @@ -38,6 +38,13 @@ type ( // Match holds the matcher. Defaults to the Container's one. Match DependencyMatchFunc + + // StructDependents if true then the Container will try to resolve + // the fields of a struct value, if any, when it's a dependent struct value + // based on the previous registered dependencies. + // + // Defaults to false. + StructDependents bool } ) @@ -50,6 +57,12 @@ func (d *Dependency) Explicitly() *Dependency { return d } +// EnableStructDependents sets StructDependents to true. +func (d *Dependency) EnableStructDependents() *Dependency { + d.StructDependents = true + return d +} + func (d *Dependency) String() string { sourceLine := d.Source.String() val := d.OriginalValue @@ -63,10 +76,16 @@ func (d *Dependency) String() string { // // See `Container.Handler` for more. func NewDependency(dependency interface{}, funcDependencies ...*Dependency) *Dependency { // used only on tests. - return newDependency(dependency, false, nil, funcDependencies...) + return newDependency(dependency, false, false, nil, funcDependencies...) } -func newDependency(dependency interface{}, disablePayloadAutoBinding bool, matchDependency DependencyMatcher, funcDependencies ...*Dependency) *Dependency { +func newDependency( + dependency interface{}, + disablePayloadAutoBinding bool, + enableStructDependents bool, + matchDependency DependencyMatcher, + funcDependencies ...*Dependency, +) *Dependency { if dependency == nil { panic(fmt.Sprintf("bad value: nil: %T", dependency)) } @@ -86,8 +105,9 @@ func newDependency(dependency interface{}, disablePayloadAutoBinding bool, match } dest := &Dependency{ - Source: newSource(v), - OriginalValue: dependency, + Source: newSource(v), + OriginalValue: dependency, + StructDependents: enableStructDependents, } dest.Match = ToDependencyMatchFunc(dest, matchDependency) @@ -171,7 +191,7 @@ func fromStructValueOrDependentStructValue(v reflect.Value, disablePayloadAutoBi return false } - if len(prevDependencies) == 0 { // As a non depedent struct. + if len(prevDependencies) == 0 || !dest.StructDependents { // As a non depedent struct. // We must make this check so we can avoid the auto-filling of // the dependencies from Iris builtin dependencies. return fromStructValue(v, dest) @@ -180,11 +200,13 @@ func fromStructValueOrDependentStructValue(v reflect.Value, disablePayloadAutoBi // Check if it's a builtin dependency (e.g an MVC Application (see mvc.go#newApp)), // if it's and registered without a Dependency wrapper, like the rest builtin dependencies, // then do NOT try to resolve its fields. + // + // Although EnableStructDependents is false by default, we must check if it's a builtin dependency for any case. if strings.HasPrefix(indirectType(v.Type()).PkgPath(), "github.com/kataras/iris/v12") { return fromStructValue(v, dest) } - bindings := getBindingsForStruct(v, prevDependencies, false, disablePayloadAutoBinding, DefaultDependencyMatcher, -1, nil) + bindings := getBindingsForStruct(v, prevDependencies, false, disablePayloadAutoBinding, dest.StructDependents, DefaultDependencyMatcher, -1, nil) if len(bindings) == 0 { return fromStructValue(v, dest) // same as above. } diff --git a/hero/reflect.go b/hero/reflect.go index e3881cbbc..d214f01bf 100644 --- a/hero/reflect.go +++ b/hero/reflect.go @@ -154,6 +154,10 @@ func lookupFields(elem reflect.Value, skipUnexported bool, onlyZeros bool, paren // Note: embedded pointers are not supported. // elem = reflect.Indirect(elem) elemTyp := elem.Type() + if elemTyp.Kind() == reflect.Pointer { + return + } + for i, n := 0, elem.NumField(); i < n; i++ { field := elemTyp.Field(i) fieldValue := elem.Field(i) diff --git a/hero/struct.go b/hero/struct.go index 536eea402..30f6eba8c 100644 --- a/hero/struct.go +++ b/hero/struct.go @@ -51,7 +51,7 @@ func makeStruct(structPtr interface{}, c *Container, partyParamsCount int) *Stru } // get struct's fields bindings. - bindings := getBindingsForStruct(v, c.Dependencies, c.MarkExportedFieldsAsRequired, c.DisablePayloadAutoBinding, c.DependencyMatcher, partyParamsCount, c.Sorter) + bindings := getBindingsForStruct(v, c.Dependencies, c.MarkExportedFieldsAsRequired, c.DisablePayloadAutoBinding, c.EnableStructDependents, c.DependencyMatcher, partyParamsCount, c.Sorter) // length bindings of 0, means that it has no fields or all mapped deps are static. // If static then Struct.Acquire will return the same "value" instance, otherwise it will create a new one. diff --git a/mvc/mvc.go b/mvc/mvc.go index 3ae2e80e6..981387cbb 100644 --- a/mvc/mvc.go +++ b/mvc/mvc.go @@ -142,6 +142,14 @@ func (app *Application) SetControllersNoLog(disable bool) *Application { return app } +// EnableStructDependents will try to resolve +// the fields of a struct value, if any, when it's a dependent struct value +// based on the previous registered dependencies. +func (app *Application) EnableStructDependents() *Application { + app.container.EnableStructDependents = true + return app +} + // Register appends one or more values as dependencies. // The value can be a single struct value-instance or a function // which has one input and one output, the input should be From 4cb0c626be56deca554e45dc7cdc0e0dd3744c4e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jul 2023 17:38:48 +0300 Subject: [PATCH 55/63] Bump github.com/microcosm-cc/bluemonday from 1.0.24 to 1.0.25 (#2176) Bumps [github.com/microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday) from 1.0.24 to 1.0.25. - [Release notes](https://github.com/microcosm-cc/bluemonday/releases) - [Commits](https://github.com/microcosm-cc/bluemonday/compare/v1.0.24...v1.0.25) --- updated-dependencies: - dependency-name: github.com/microcosm-cc/bluemonday dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 256d37918..9e3e0b72a 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/klauspost/compress v1.16.7 github.com/mailgun/raymond/v2 v2.0.48 github.com/mailru/easyjson v0.7.7 - github.com/microcosm-cc/bluemonday v1.0.24 + github.com/microcosm-cc/bluemonday v1.0.25 github.com/redis/go-redis/v9 v9.0.5 github.com/schollz/closestmatch v2.1.0+incompatible github.com/shirou/gopsutil/v3 v3.23.6 diff --git a/go.sum b/go.sum index 82bfa11ee..1eaa046cc 100644 --- a/go.sum +++ b/go.sum @@ -139,8 +139,8 @@ github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APP github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mediocregopher/radix/v3 v3.8.1 h1:rOkHflVuulFKlwsLY01/M2cM2tWCjDoETcMqKbAWu1M= github.com/mediocregopher/radix/v3 v3.8.1/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= -github.com/microcosm-cc/bluemonday v1.0.24 h1:NGQoPtwGVcbGkKfvyYk1yRqknzBuoMiUrO6R7uFTPlw= -github.com/microcosm-cc/bluemonday v1.0.24/go.mod h1:ArQySAMps0790cHSkdPEJ7bGkF2VePWH773hsJNSHf8= +github.com/microcosm-cc/bluemonday v1.0.25 h1:4NEwSfiJ+Wva0VxN5B8OwMicaJvD8r9tlJWm9rtloEg= +github.com/microcosm-cc/bluemonday v1.0.25/go.mod h1:ZIOjCQp1OrzBBPIJmfX4qDYFuhU02nx4bn030ixfHLE= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= From 353fd4dcbaec93ab756d694c3e0cca064484faca Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sun, 30 Jul 2023 21:17:22 +0300 Subject: [PATCH 56/63] implement #2175 --- core/host/task.go | 67 ++++++++++++++++++++++++++++++++++++++++++++++- iris.go | 2 +- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/core/host/task.go b/core/host/task.go index c16a98747..464f65a9d 100644 --- a/core/host/task.go +++ b/core/host/task.go @@ -9,7 +9,9 @@ import ( "errors" "fmt" "io" + "net" "net/http" + "strings" "time" "github.com/kataras/iris/v12/core/netutil" @@ -26,9 +28,72 @@ func WriteStartupLogOnServe(w io.Writer) func(TaskHost) { if addr == "" { addr = h.Supervisor.Server.Addr } + + var listeningURIs = make([]string, 0, 1) + + if host, port, err := net.SplitHostPort(addr); err == nil { // Improve for the issue #2175. + if host == "" || host == "0.0.0.0" { + if ifaces, err := net.Interfaces(); err == nil { + var ips []string + for _, i := range ifaces { + addrs, err := i.Addrs() + if err != nil { + continue + } + for _, localAddr := range addrs { + var ip net.IP + switch v := localAddr.(type) { + case *net.IPNet: + ip = v.IP + case *net.IPAddr: + ip = v.IP + } + if ip != nil && ip.To4() != nil { + if !ip.IsPrivate() { + // let's don't print ips that are not accessible through browser. + continue + } + ips = append(ips, ip.String()) + } + } + } + + for _, ip := range ips { + listeningURI := netutil.ResolveURL(guessScheme, fmt.Sprintf("%s:%s", ip, port)) + + listeningURI = "> Network: " + listeningURI + listeningURIs = append(listeningURIs, listeningURI) + } + } + } + } + + // if len(listeningURIs) == 0 { + // ^ check no need, we want to print the virtual addr too. listeningURI := netutil.ResolveURL(guessScheme, addr) + if len(listeningURIs) > 0 { + listeningURIs[0] = "\n" + listeningURIs[0] + listeningURI = "> Local: " + listeningURI + } + listeningURIs = append(listeningURIs, listeningURI) + _, _ = fmt.Fprintf(w, "Now listening on: %s\nApplication started. Press CTRL+C to shut down.\n", - listeningURI) + strings.Join(listeningURIs, "\n")) + + /* + When :8080 or 0.0.0.0:8080: + Now listening on: + > Network: http://192.168.1.109:8080 + > Network: http://172.25.224.1:8080 + > Local: http://localhost:8080 + Application started. Press CTRL+C to shut down. + + Otherwise: + Iris Version: 12.2.1 + + Now listening on: http://192.168.1.109:8080 + Application started. Press CTRL+C to shut down. + */ } } diff --git a/iris.go b/iris.go index c2f899fd1..4e6d652c8 100644 --- a/iris.go +++ b/iris.go @@ -38,7 +38,7 @@ import ( ) // Version is the current version of the Iris Web Framework. -const Version = "12.2.0" +const Version = "12.2.1" // Byte unit helpers. const ( From ead6bba1bbe3fbde0c0ae0f892404b9d6f509485 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sun, 30 Jul 2023 21:22:41 +0300 Subject: [PATCH 57/63] minor for #2175 --- core/host/task.go | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/core/host/task.go b/core/host/task.go index 464f65a9d..a7ea30516 100644 --- a/core/host/task.go +++ b/core/host/task.go @@ -61,7 +61,7 @@ func WriteStartupLogOnServe(w io.Writer) func(TaskHost) { for _, ip := range ips { listeningURI := netutil.ResolveURL(guessScheme, fmt.Sprintf("%s:%s", ip, port)) - listeningURI = "> Network: " + listeningURI + listeningURI = "> Network: " + listeningURI listeningURIs = append(listeningURIs, listeningURI) } } @@ -73,27 +73,20 @@ func WriteStartupLogOnServe(w io.Writer) func(TaskHost) { listeningURI := netutil.ResolveURL(guessScheme, addr) if len(listeningURIs) > 0 { listeningURIs[0] = "\n" + listeningURIs[0] - listeningURI = "> Local: " + listeningURI + listeningURI = "> Local: " + listeningURI } listeningURIs = append(listeningURIs, listeningURI) - - _, _ = fmt.Fprintf(w, "Now listening on: %s\nApplication started. Press CTRL+C to shut down.\n", - strings.Join(listeningURIs, "\n")) - /* - When :8080 or 0.0.0.0:8080: - Now listening on: - > Network: http://192.168.1.109:8080 - > Network: http://172.25.224.1:8080 - > Local: http://localhost:8080 - Application started. Press CTRL+C to shut down. + Now listening on: + > Network: http://192.168.1.109:8080 + > Network: http://172.25.224.1:8080 + > Local: http://localhost:8080 Otherwise: - Iris Version: 12.2.1 - Now listening on: http://192.168.1.109:8080 - Application started. Press CTRL+C to shut down. */ + _, _ = fmt.Fprintf(w, "Now listening on: %s\nApplication started. Press CTRL+C to shut down.\n", + strings.Join(listeningURIs, "\n")) } } From 55da0252f6c2bb749f885da33ab862cebd992f1e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:22:44 +0300 Subject: [PATCH 58/63] Bump github.com/shirou/gopsutil/v3 from 3.23.6 to 3.23.7 (#2179) Bumps [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil) from 3.23.6 to 3.23.7. - [Release notes](https://github.com/shirou/gopsutil/releases) - [Commits](https://github.com/shirou/gopsutil/compare/v3.23.6...v3.23.7) --- updated-dependencies: - dependency-name: github.com/shirou/gopsutil/v3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 9e3e0b72a..71bb09ef5 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( github.com/microcosm-cc/bluemonday v1.0.25 github.com/redis/go-redis/v9 v9.0.5 github.com/schollz/closestmatch v2.1.0+incompatible - github.com/shirou/gopsutil/v3 v3.23.6 + github.com/shirou/gopsutil/v3 v3.23.7 github.com/tdewolff/minify/v2 v2.12.7 github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 diff --git a/go.sum b/go.sum index 1eaa046cc..b013b5868 100644 --- a/go.sum +++ b/go.sum @@ -185,8 +185,8 @@ github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiy github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil/v3 v3.23.6 h1:5y46WPI9QBKBbK7EEccUPNXpJpNrvPuTD0O2zHEHT08= -github.com/shirou/gopsutil/v3 v3.23.6/go.mod h1:j7QX50DrXYggrpN30W0Mo+I4/8U2UUIQrnrhqUeWrAU= +github.com/shirou/gopsutil/v3 v3.23.7 h1:C+fHO8hfIppoJ1WdsVm1RoI0RwXoNdfTK7yWXV0wVj4= +github.com/shirou/gopsutil/v3 v3.23.7/go.mod h1:c4gnmoRC0hQuaLqvxnx1//VXQ0Ms/X9UnJF8pddY5z4= github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= @@ -294,7 +294,6 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= From 6d0819cfa2a8f098c10bc5b3cd89503b5497a7a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:24:13 +0300 Subject: [PATCH 59/63] Bump github.com/tdewolff/minify/v2 from 2.12.7 to 2.12.8 (#2180) Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.12.7 to 2.12.8. - [Release notes](https://github.com/tdewolff/minify/releases) - [Commits](https://github.com/tdewolff/minify/compare/v2.12.7...v2.12.8) --- updated-dependencies: - dependency-name: github.com/tdewolff/minify/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 15 ++++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 71bb09ef5..28c2226f1 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/redis/go-redis/v9 v9.0.5 github.com/schollz/closestmatch v2.1.0+incompatible github.com/shirou/gopsutil/v3 v3.23.7 - github.com/tdewolff/minify/v2 v2.12.7 + github.com/tdewolff/minify/v2 v2.12.8 github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 @@ -92,7 +92,7 @@ require ( github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/stretchr/testify v1.8.4 // indirect - github.com/tdewolff/parse/v2 v2.6.6 // indirect + github.com/tdewolff/parse/v2 v2.6.7 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect diff --git a/go.sum b/go.sum index b013b5868..d02b517bd 100644 --- a/go.sum +++ b/go.sum @@ -28,7 +28,6 @@ github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -45,7 +44,6 @@ github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczC github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/djherbis/atime v1.1.0/go.mod h1:28OF6Y8s3NQWwacXc5eZTsEsiMzp7LF8MbXE+XJPdBE= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= @@ -56,7 +54,6 @@ github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= @@ -133,7 +130,6 @@ github.com/mailgun/raymond/v2 v2.0.48 h1:5dmlB680ZkFG2RN/0lvTAghrSxIESeu9/2aeDqA github.com/mailgun/raymond/v2 v2.0.48/go.mod h1:lsgvL50kgt1ylcFJYZiULi5fjPBkkhNfj4KA0W54Z18= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2/go.mod h1:0KeJpeMD6o+O4hW7qJOT7vyQPKrWmj26uf5wMc/IiIs= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= @@ -201,7 +197,6 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -217,11 +212,10 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8= -github.com/tdewolff/minify/v2 v2.12.7 h1:pBzz2tAfz5VghOXiQIsSta6srhmTeinQPjRDHWoumCA= -github.com/tdewolff/minify/v2 v2.12.7/go.mod h1:ZRKTheiOGyLSK8hOZWWv+YoJAECzDivNgAlVYDHp/Ws= -github.com/tdewolff/parse/v2 v2.6.6 h1:Yld+0CrKUJaCV78DL1G2nk3C9lKrxyRTux5aaK/AkDo= -github.com/tdewolff/parse/v2 v2.6.6/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs= -github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= +github.com/tdewolff/minify/v2 v2.12.8 h1:Q2BqOTmlMjoutkuD/OPCnJUpIqrzT3nRPkw+q+KpXS0= +github.com/tdewolff/minify/v2 v2.12.8/go.mod h1:YRgk7CC21LZnbuke2fmYnCTq+zhCgpb0yJACOTUNJ1E= +github.com/tdewolff/parse/v2 v2.6.7 h1:WrFllrqmzAcrKHzoYgMupqgUBIfBVOb0yscFzDf8bBg= +github.com/tdewolff/parse/v2 v2.6.7/go.mod h1:XHDhaU6IBgsryfdnpzUXBlT6leW/l25yrFBTEb4eIyM= github.com/tdewolff/test v1.0.9 h1:SswqJCmeN4B+9gEAi/5uqT0qpi1y2/2O47V/1hhGZT0= github.com/tdewolff/test v1.0.9/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= @@ -291,7 +285,6 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= From 72f9d4ba5c1299e64c3c46b69a8bc721019101b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:24:22 +0300 Subject: [PATCH 60/63] Bump golang.org/x/net from 0.12.0 to 0.13.0 (#2181) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.12.0 to 0.13.0. - [Commits](https://github.com/golang/net/compare/v0.12.0...v0.13.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 28c2226f1..cd311dbc0 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 golang.org/x/crypto v0.11.0 - golang.org/x/net v0.12.0 + golang.org/x/net v0.13.0 golang.org/x/sys v0.10.0 golang.org/x/text v0.11.0 golang.org/x/time v0.3.0 diff --git a/go.sum b/go.sum index d02b517bd..2a58d6e29 100644 --- a/go.sum +++ b/go.sum @@ -265,8 +265,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY= +golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= From 9d538eabb0cf1301f8a36a01df10c8087950a7e3 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Fri, 4 Aug 2023 17:59:00 +0300 Subject: [PATCH 61/63] implement a dynamic router handler for #2167 --- _examples/routing/route-state/main.go | 2 +- configuration.go | 21 ++++ context/configuration.go | 2 + core/router/handler.go | 122 +++++++++++++++++++++++- core/router/route_register_rule_test.go | 2 + core/router/router.go | 12 +-- 6 files changed, 150 insertions(+), 11 deletions(-) diff --git a/_examples/routing/route-state/main.go b/_examples/routing/route-state/main.go index 6c362c115..d59b8c810 100644 --- a/_examples/routing/route-state/main.go +++ b/_examples/routing/route-state/main.go @@ -41,5 +41,5 @@ func main() { ctx.Exec("GET", "/invisible/iris") }) - app.Listen(":8080") + app.Listen(":8080", iris.WithDynamicHandler) } diff --git a/configuration.go b/configuration.go index 931a5a442..81377bcaa 100644 --- a/configuration.go +++ b/configuration.go @@ -308,6 +308,14 @@ var WithLowercaseRouting = func(app *Application) { app.config.ForceLowercaseRouting = true } +// WithDynamicHandler enables for dynamic routing by +// setting the `EnableDynamicHandler` to true. +// +// See `Configuration`. +var WithDynamicHandler = func(app *Application) { + app.config.EnableDynamicHandler = true +} + // WithOptimizations can force the application to optimize for the best performance where is possible. // // See `Configuration`. @@ -737,6 +745,14 @@ type Configuration struct { // // Defaults to false. ForceLowercaseRouting bool `ini:"force_lowercase_routing" json:"forceLowercaseRouting,omitempty" yaml:"ForceLowercaseRouting" toml:"ForceLowercaseRouting"` + // EnableOptimizations enables dynamic request handler. + // It gives the router the feature to add routes while in serve-time, + // when `RefreshRouter` is called. + // If this setting is set to true, the request handler will use a mutex for data(trie routing) protection, + // hence the performance cost. + // + // Defaults to false. + EnableDynamicHandler bool `ini:"enable_dynamic_handler" json:"enableDynamicHandler,omitempty" yaml:"EnableDynamicHandler" toml:"EnableDynamicHandler"` // FireMethodNotAllowed if it's true router checks for StatusMethodNotAllowed(405) and // fires the 405 error instead of 404 // Defaults to false. @@ -1008,6 +1024,11 @@ func (c *Configuration) GetForceLowercaseRouting() bool { return c.ForceLowercaseRouting } +// GetEnableDynamicHandler returns the EnableDynamicHandler field. +func (c *Configuration) GetEnableDynamicHandler() bool { + return c.EnableDynamicHandler +} + // GetFireMethodNotAllowed returns the FireMethodNotAllowed field. func (c *Configuration) GetFireMethodNotAllowed() bool { return c.FireMethodNotAllowed diff --git a/context/configuration.go b/context/configuration.go index 255aab4da..0e7554d8d 100644 --- a/context/configuration.go +++ b/context/configuration.go @@ -34,6 +34,8 @@ type ConfigurationReadOnly interface { GetEnablePathEscape() bool // GetForceLowercaseRouting returns the ForceLowercaseRouting field. GetForceLowercaseRouting() bool + // GetEnableOptimizations returns the EnableDynamicHandler field. + GetEnableDynamicHandler() bool // GetFireMethodNotAllowed returns the FireMethodNotAllowed field. GetFireMethodNotAllowed() bool // GetDisableAutoFireStatusCode returns the DisableAutoFireStatusCode field. diff --git a/core/router/handler.go b/core/router/handler.go index 34c449312..024d0f529 100644 --- a/core/router/handler.go +++ b/core/router/handler.go @@ -1,10 +1,13 @@ package router import ( + "errors" "fmt" "net/http" "sort" "strings" + "sync" + "sync/atomic" "time" "github.com/kataras/iris/v12/context" @@ -39,8 +42,18 @@ type ( // on the given context's response status code. FireErrorCode(ctx *context.Context) } + + // RouteAdder is an optional interface that can be implemented by a `RequestHandler`. + RouteAdder interface { + // AddRoute should add a route to the request handler directly. + AddRoute(*Route) error + } ) +// ErrNotRouteAdder throws on `AddRouteUnsafe` when a registered `RequestHandler` +// does not implements the optional `AddRoute(*Route) error` method. +var ErrNotRouteAdder = errors.New("request handler does not implement AddRoute method") + type routerHandler struct { // Config. disablePathCorrection bool @@ -59,8 +72,103 @@ type routerHandler struct { errorDefaultHandlers context.Handlers // the main handler(s) for default error code handlers, when not registered directly by the end-developer. } -var _ RequestHandler = (*routerHandler)(nil) -var _ HTTPErrorHandler = (*routerHandler)(nil) +var ( + _ RequestHandler = (*routerHandler)(nil) + _ HTTPErrorHandler = (*routerHandler)(nil) +) + +type routerHandlerDynamic struct { + RequestHandler + rw sync.RWMutex + + locked uint32 +} + +// RouteExists reports whether a particular route exists. +func (h *routerHandlerDynamic) RouteExists(ctx *context.Context, method, path string) (exists bool) { + h.lock(false, func() error { + exists = h.RequestHandler.RouteExists(ctx, method, path) + return nil + }) + + return +} + +func (h *routerHandlerDynamic) AddRoute(r *Route) error { + if v, ok := h.RequestHandler.(RouteAdder); ok { + return h.lock(true, func() error { + return v.AddRoute(r) + }) + } + + return ErrNotRouteAdder +} + +func (h *routerHandlerDynamic) lock(writeAccess bool, fn func() error) error { + if atomic.CompareAndSwapUint32(&h.locked, 0, 1) { + if writeAccess { + h.rw.Lock() + } else { + h.rw.RLock() + } + + err := fn() + + // check agan because fn may called the unlock method. + if atomic.CompareAndSwapUint32(&h.locked, 1, 0) { + if writeAccess { + h.rw.Unlock() + } else { + h.rw.RUnlock() + } + } + + return err + } + + return fn() +} + +func (h *routerHandlerDynamic) Build(provider RoutesProvider) error { + // Build can be called inside HandleRequest if the route handler + // calls the RefreshRouter method, and it will stuck on the rw.Lock() call, + // so use a custom version of it. + // h.rw.Lock() + // defer h.rw.Unlock() + + return h.lock(true, func() error { + return h.RequestHandler.Build(provider) + }) +} + +func (h *routerHandlerDynamic) HandleRequest(ctx *context.Context) { + h.lock(false, func() error { + h.RequestHandler.HandleRequest(ctx) + return nil + }) +} + +func (h *routerHandlerDynamic) FireErrorCode(ctx *context.Context) { + h.lock(false, func() error { + h.RequestHandler.FireErrorCode(ctx) + return nil + }) +} + +// NewDynamicHandler returns a new router handler which is responsible handle each request +// with routes that can be added in serve-time. +// It's a wrapper of the `NewDefaultHandler`. +// It's being used when the `ConfigurationReadOnly.GetEnableDynamicHandler` is true. +func NewDynamicHandler(config context.ConfigurationReadOnly, logger *golog.Logger) RequestHandler /* #2167 */ { + handler := NewDefaultHandler(config, logger) + return wrapDynamicHandler(handler) +} + +func wrapDynamicHandler(handler RequestHandler) RequestHandler { + return &routerHandlerDynamic{ + RequestHandler: handler, + } +} // NewDefaultHandler returns the handler which is responsible // to map the request with a route (aka mux implementation). @@ -71,6 +179,7 @@ func NewDefaultHandler(config context.ConfigurationReadOnly, logger *golog.Logge fireMethodNotAllowed bool enablePathIntelligence bool forceLowercaseRouting bool + dynamicHandlerEnabled bool ) if config != nil { // #2147 @@ -79,9 +188,10 @@ func NewDefaultHandler(config context.ConfigurationReadOnly, logger *golog.Logge fireMethodNotAllowed = config.GetFireMethodNotAllowed() enablePathIntelligence = config.GetEnablePathIntelligence() forceLowercaseRouting = config.GetForceLowercaseRouting() + dynamicHandlerEnabled = config.GetEnableDynamicHandler() } - return &routerHandler{ + handler := &routerHandler{ disablePathCorrection: disablePathCorrection, disablePathCorrectionRedirection: disablePathCorrectionRedirection, fireMethodNotAllowed: fireMethodNotAllowed, @@ -89,6 +199,12 @@ func NewDefaultHandler(config context.ConfigurationReadOnly, logger *golog.Logge forceLowercaseRouting: forceLowercaseRouting, logger: logger, } + + if dynamicHandlerEnabled { + return wrapDynamicHandler(handler) + } + + return handler } func (h *routerHandler) getTree(statusCode int, method, subdomain string) *trie { diff --git a/core/router/route_register_rule_test.go b/core/router/route_register_rule_test.go index 9fd8ce1aa..68ff25954 100644 --- a/core/router/route_register_rule_test.go +++ b/core/router/route_register_rule_test.go @@ -12,6 +12,8 @@ import ( func TestRegisterRule(t *testing.T) { app := iris.New() + app.Configure(iris.WithDynamicHandler) + // collect the error on RouteError rule. buf := new(bytes.Buffer) app.Logger().SetTimeFormat("").DisableNewLine().SetOutput(buf) diff --git a/core/router/router.go b/core/router/router.go index e3b33671c..25d84ad44 100644 --- a/core/router/router.go +++ b/core/router/router.go @@ -49,23 +49,21 @@ func NewRouter() *Router { // RefreshRouter re-builds the router. Should be called when a route's state // changed (i.e Method changed at serve-time). +// +// Note that in order to use RefreshRouter while in serve-time, +// you have to set the `EnableDynamicHandler` Iris Application setting to true, +// e.g. `app.Listen(":8080", iris.WithEnableDynamicHandler)` func (router *Router) RefreshRouter() error { return router.BuildRouter(router.cPool, router.requestHandler, router.routesProvider, true) } -// ErrNotRouteAdder throws on `AddRouteUnsafe` when a registered `RequestHandler` -// does not implements the optional `AddRoute(*Route) error` method. -var ErrNotRouteAdder = errors.New("request handler does not implement AddRoute method") - // AddRouteUnsafe adds a route directly to the router's request handler. // Works before or after Build state. // Mainly used for internal cases like `iris.WithSitemap`. // Do NOT use it on serve-time. func (router *Router) AddRouteUnsafe(routes ...*Route) error { if h := router.requestHandler; h != nil { - if v, ok := h.(interface { - AddRoute(*Route) error - }); ok { + if v, ok := h.(RouteAdder); ok { for _, r := range routes { return v.AddRoute(r) } From 6b076536369af1701e152802ed1bf49a042ca02b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Aug 2023 12:22:33 +0300 Subject: [PATCH 62/63] Bump golang.org/x/text from 0.11.0 to 0.12.0 (#2183) Bumps [golang.org/x/text](https://github.com/golang/text) from 0.11.0 to 0.12.0. - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.11.0...v0.12.0) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cd311dbc0..ad08b36f5 100644 --- a/go.mod +++ b/go.mod @@ -42,7 +42,7 @@ require ( golang.org/x/crypto v0.11.0 golang.org/x/net v0.13.0 golang.org/x/sys v0.10.0 - golang.org/x/text v0.11.0 + golang.org/x/text v0.12.0 golang.org/x/time v0.3.0 google.golang.org/protobuf v1.31.0 gopkg.in/ini.v1 v1.67.0 diff --git a/go.sum b/go.sum index 2a58d6e29..3ba311c07 100644 --- a/go.sum +++ b/go.sum @@ -294,8 +294,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 4af1113dab78e630100794d178e9f0cc99cb3f17 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Aug 2023 12:23:56 +0300 Subject: [PATCH 63/63] Bump golang.org/x/net from 0.13.0 to 0.14.0 (#2184) Bumps [golang.org/x/net](https://github.com/golang/net) from 0.13.0 to 0.14.0. - [Commits](https://github.com/golang/net/compare/v0.13.0...v0.14.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 6 +++--- go.sum | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index ad08b36f5..b78f7e40a 100644 --- a/go.mod +++ b/go.mod @@ -39,9 +39,9 @@ require ( github.com/vmihailenco/msgpack/v5 v5.3.5 github.com/yosssi/ace v0.0.5 go.etcd.io/bbolt v1.3.7 - golang.org/x/crypto v0.11.0 - golang.org/x/net v0.13.0 - golang.org/x/sys v0.10.0 + golang.org/x/crypto v0.12.0 + golang.org/x/net v0.14.0 + golang.org/x/sys v0.11.0 golang.org/x/text v0.12.0 golang.org/x/time v0.3.0 google.golang.org/protobuf v1.31.0 diff --git a/go.sum b/go.sum index 3ba311c07..b93ba7060 100644 --- a/go.sum +++ b/go.sum @@ -255,8 +255,8 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= @@ -265,8 +265,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY= -golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -287,8 +287,9 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=