From 8b96956519d8cc487289e8289a916a3cdd8155fa Mon Sep 17 00:00:00 2001 From: Deng Ming Date: Sun, 11 Feb 2024 22:58:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20ekit=20=E7=9A=84=20sna?= =?UTF-8?q?pshot=20=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 6 +++--- go.sum | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c0ed752..9acd254 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/ecodeclub/ginx go 1.21 require ( - github.com/ecodeclub/ekit v0.0.8 + github.com/ecodeclub/ekit v0.0.8-0.20240211141809-d8a351a335b5 github.com/gin-gonic/gin v1.9.1 github.com/golang-jwt/jwt/v5 v5.0.0 github.com/google/uuid v1.6.0 @@ -17,7 +17,7 @@ require ( github.com/bytedance/sonic v1.9.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/gin-contrib/sse v0.1.0 // indirect @@ -32,7 +32,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect golang.org/x/arch v0.3.0 // indirect diff --git a/go.sum b/go.sum index 4307dfb..92bba58 100644 --- a/go.sum +++ b/go.sum @@ -13,8 +13,11 @@ github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583j 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= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/ecodeclub/ekit v0.0.8-0.20240211141809-d8a351a335b5 h1:beyGjdznTmvRRzEdxHF6SeYRLPAsCPr5OzR6Xb2bd1k= +github.com/ecodeclub/ekit v0.0.8-0.20240211141809-d8a351a335b5/go.mod h1:rEGubThvxoIQT/qnbVBkZgSvYwgKrY/dtwEWKRTmgeY= github.com/ecodeclub/ekit v0.0.8 h1:861Aot0GvD5ueREEYDVYc1oIhDuFyg6MTxIyiOa4Pvw= github.com/ecodeclub/ekit v0.0.8/go.mod h1:OqTojKeKFTxeeAAUwNIPKu339SRkX6KAuoK/8A5BCEs= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= @@ -63,6 +66,7 @@ github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZ github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= 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/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/redis/go-redis/v9 v9.2.1 h1:WlYJg71ODF0dVspZZCpYmoF1+U1Jjk9Rwd7pq6QmlCg= github.com/redis/go-redis/v9 v9.2.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= From 3adb69232f0b6a75a28ebf4bd15a83031340b7a4 Mon Sep 17 00:00:00 2001 From: Deng Ming Date: Sun, 11 Feb 2024 23:17:37 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20lint=20=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 1 + go.sum | 17 +++++++++-------- middlewares/accesslog/builder.go | 2 +- middlewares/activelimit/locallimit/builder.go | 2 -- middlewares/activelimit/redislimit/builder.go | 3 +-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 9acd254..52344bc 100644 --- a/go.mod +++ b/go.mod @@ -27,6 +27,7 @@ require ( github.com/goccy/go-json v0.10.2 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/kr/text v0.2.0 // indirect github.com/leodido/go-urn v1.2.4 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect diff --git a/go.sum b/go.sum index 92bba58..e68808c 100644 --- a/go.sum +++ b/go.sum @@ -10,16 +10,15 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= +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= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/ecodeclub/ekit v0.0.8-0.20240211141809-d8a351a335b5 h1:beyGjdznTmvRRzEdxHF6SeYRLPAsCPr5OzR6Xb2bd1k= github.com/ecodeclub/ekit v0.0.8-0.20240211141809-d8a351a335b5/go.mod h1:rEGubThvxoIQT/qnbVBkZgSvYwgKrY/dtwEWKRTmgeY= -github.com/ecodeclub/ekit v0.0.8 h1:861Aot0GvD5ueREEYDVYc1oIhDuFyg6MTxIyiOa4Pvw= -github.com/ecodeclub/ekit v0.0.8/go.mod h1:OqTojKeKFTxeeAAUwNIPKu339SRkX6KAuoK/8A5BCEs= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -49,6 +48,8 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= @@ -60,15 +61,15 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/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/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= -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/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/redis/go-redis/v9 v9.2.1 h1:WlYJg71ODF0dVspZZCpYmoF1+U1Jjk9Rwd7pq6QmlCg= github.com/redis/go-redis/v9 v9.2.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= 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= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -108,8 +109,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 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-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 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= diff --git a/middlewares/accesslog/builder.go b/middlewares/accesslog/builder.go index d5e8434..d71ff6a 100644 --- a/middlewares/accesslog/builder.go +++ b/middlewares/accesslog/builder.go @@ -119,7 +119,7 @@ func (b *Builder) Builder() gin.HandlerFunc { } defer func() { - accessLog.Duration = time.Now().Sub(start).String() + accessLog.Duration = time.Since(start).String() //日志打印 b.loggerFunc(ctx, accessLog) }() diff --git a/middlewares/activelimit/locallimit/builder.go b/middlewares/activelimit/locallimit/builder.go index 98ed393..f0a7413 100644 --- a/middlewares/activelimit/locallimit/builder.go +++ b/middlewares/activelimit/locallimit/builder.go @@ -47,7 +47,5 @@ func (a *LocalActiveLimit) Build() gin.HandlerFunc { } else { ctx.AbortWithStatus(http.StatusTooManyRequests) } - return - } } diff --git a/middlewares/activelimit/redislimit/builder.go b/middlewares/activelimit/redislimit/builder.go index e952ccc..fb66949 100644 --- a/middlewares/activelimit/redislimit/builder.go +++ b/middlewares/activelimit/redislimit/builder.go @@ -40,7 +40,7 @@ func NewRedisActiveLimit(cmd redis.Cmdable, maxActive int64, key string) *RedisA key: key, cmd: cmd, logFn: func(msg any, args ...any) { - fmt.Println(fmt.Sprintf("%v 详细信息: %v", msg, args)) + fmt.Printf("%v 详细信息: %v \n", msg, args) }, } } @@ -70,6 +70,5 @@ func (a *RedisActiveLimit) Build() gin.HandlerFunc { a.logFn("web server ", "限流中..") ctx.AbortWithStatus(http.StatusTooManyRequests) } - return } } From 7009d2287f4615820eaea53fd21180a8965eafd0 Mon Sep 17 00:00:00 2001 From: Deng Ming Date: Sun, 11 Feb 2024 23:19:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20github=20action=20?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/integration_test.yml | 2 +- .github/workflows/license.yml | 9 ++++++--- .license_header | 13 +++++++++++++ .licenserc.json | 4 +++- .script/integrate_test.sh | 6 +++--- .script/integration_test_compose.yml | 21 +++++++++++++++++++++ Makefile | 4 ++-- gctx/context.go | 14 ++++++++++++++ gctx/context_test.go | 14 ++++++++++++++ internal/errs/error.go | 14 ++++++++++++++ internal/mocks/pipeline.mock.go | 16 +++++++++++++++- session/builder.go | 14 ++++++++++++++ session/builder_test.go | 14 ++++++++++++++ session/global.go | 14 ++++++++++++++ session/global_test.go | 14 ++++++++++++++ session/memory.go | 14 ++++++++++++++ session/memory_test.go | 14 ++++++++++++++ session/middleware_builder.go | 14 ++++++++++++++ session/provider.mock_test.go | 16 +++++++++++++++- session/redis/redis.go | 14 ++++++++++++++ session/redis/redis_test.go | 14 ++++++++++++++ session/types.go | 14 ++++++++++++++ types.go | 14 ++++++++++++++ wrapper_func.go | 14 ++++++++++++++ 24 files changed, 289 insertions(+), 12 deletions(-) create mode 100644 .license_header create mode 100755 .script/integration_test_compose.yml diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 0f6d589..99cf52b 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -31,4 +31,4 @@ jobs: go-version: '1.21.1' - name: Test - run: sudo sh ./script/integrate_test.sh \ No newline at end of file + run: make e2e \ No newline at end of file diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml index 0ae64fc..1cab822 100644 --- a/.github/workflows/license.yml +++ b/.github/workflows/license.yml @@ -24,6 +24,9 @@ jobs: check-license-lines: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: Check License Lines - uses: kt3k/license_checker@v1.0.6 \ No newline at end of file + - uses: denoland/setup-deno@v1 + with: + deno-version: "1.40.4" + - uses: actions/checkout@v4 + - name: Check license + run: deno run --allow-read https://deno.land/x/license_checker@v3.2.3/main.ts diff --git a/.license_header b/.license_header new file mode 100644 index 0000000..5cd27fa --- /dev/null +++ b/.license_header @@ -0,0 +1,13 @@ +Copyright 2023 ecodeclub + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/.licenserc.json b/.licenserc.json index 32d9c55..7215a8b 100644 --- a/.licenserc.json +++ b/.licenserc.json @@ -3,6 +3,8 @@ "**/*.{yml,toml}": "# Copyright 2023 ecodeclub", "**/*.sh": "# Copyright 2023 ecodeclub", "ignore": [ - "**/*.mock.go" + "internal/mocks/", + "session/provider.mock_test.go", + "internal/ratelimit/mocks/ratelimit.mock.go" ] } \ No newline at end of file diff --git a/.script/integrate_test.sh b/.script/integrate_test.sh index 975029d..f455b56 100644 --- a/.script/integrate_test.sh +++ b/.script/integrate_test.sh @@ -15,7 +15,7 @@ #!/usr/bin/env bash set -e -docker compose -f script/integration_test_compose.yml down -docker compose -f script/integration_test_compose.yml up -d +docker compose -f .script/integration_test_compose.yml down +docker compose -f .script/integration_test_compose.yml up -d go test ./... -tags=e2e -docker compose -f script/integration_test_compose.yml down \ No newline at end of file +docker compose -f .script/integration_test_compose.yml down \ No newline at end of file diff --git a/.script/integration_test_compose.yml b/.script/integration_test_compose.yml new file mode 100755 index 0000000..1e7155e --- /dev/null +++ b/.script/integration_test_compose.yml @@ -0,0 +1,21 @@ +# Copyright 2023 ecodeclub +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http:#www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: '3.0' + +services: + redis: + image: redis:latest + ports: + - "16379:6379" diff --git a/Makefile b/Makefile index 4ee5cb7..3ea7057 100644 --- a/Makefile +++ b/Makefile @@ -40,5 +40,5 @@ e2e_up: e2e_down: docker compose -f .script/integration_test_compose.yml down mock: - mockgen -package=mocks -destination=internal/mocks/pipeline.mock.go github.com/redis/go-redis/v9 Pipeliner - mockgen -source=session/types.go -package=session -destination=session/provider.mock_test.go Provider \ No newline at end of file + mockgen -copyright_file=.license_header -package=mocks -destination=internal/mocks/pipeline.mock.go github.com/redis/go-redis/v9 Pipeliner + mockgen -copyright_file=.license_header -source=session/types.go -package=session -destination=session/provider.mock_test.go Provider \ No newline at end of file diff --git a/gctx/context.go b/gctx/context.go index 62e49a2..057ccb9 100644 --- a/gctx/context.go +++ b/gctx/context.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package gctx import ( diff --git a/gctx/context_test.go b/gctx/context_test.go index f25206d..7ee2d15 100644 --- a/gctx/context_test.go +++ b/gctx/context_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package gctx import ( diff --git a/internal/errs/error.go b/internal/errs/error.go index b089274..ccd9085 100644 --- a/internal/errs/error.go +++ b/internal/errs/error.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package errs import "errors" diff --git a/internal/mocks/pipeline.mock.go b/internal/mocks/pipeline.mock.go index 0efe4a6..82ad058 100644 --- a/internal/mocks/pipeline.mock.go +++ b/internal/mocks/pipeline.mock.go @@ -1,9 +1,23 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Code generated by MockGen. DO NOT EDIT. // Source: github.com/redis/go-redis/v9 (interfaces: Pipeliner) // // Generated by this command: // -// mockgen -package=mocks -destination=internal/mocks/pipeline.mock.go github.com/redis/go-redis/v9 Pipeliner +// mockgen -copyright_file=.license_header -package=mocks -destination=internal/mocks/pipeline.mock.go github.com/redis/go-redis/v9 Pipeliner // // Package mocks is a generated GoMock package. package mocks diff --git a/session/builder.go b/session/builder.go index 752336f..acaa755 100644 --- a/session/builder.go +++ b/session/builder.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package session import "github.com/ecodeclub/ginx/gctx" diff --git a/session/builder_test.go b/session/builder_test.go index ddae80c..4b71b9e 100644 --- a/session/builder_test.go +++ b/session/builder_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package session import ( diff --git a/session/global.go b/session/global.go index 323d47e..7addc97 100644 --- a/session/global.go +++ b/session/global.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package session import ( diff --git a/session/global_test.go b/session/global_test.go index 85b107b..1a20b0c 100644 --- a/session/global_test.go +++ b/session/global_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package session import ( diff --git a/session/memory.go b/session/memory.go index 3ca8db1..0092c02 100644 --- a/session/memory.go +++ b/session/memory.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package session import ( diff --git a/session/memory_test.go b/session/memory_test.go index 6c0d333..b345ce5 100644 --- a/session/memory_test.go +++ b/session/memory_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package session import ( diff --git a/session/middleware_builder.go b/session/middleware_builder.go index acba24a..3f0d0ce 100644 --- a/session/middleware_builder.go +++ b/session/middleware_builder.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package session import ( diff --git a/session/provider.mock_test.go b/session/provider.mock_test.go index 8afc0ef..f4282f0 100644 --- a/session/provider.mock_test.go +++ b/session/provider.mock_test.go @@ -1,9 +1,23 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Code generated by MockGen. DO NOT EDIT. // Source: session/types.go // // Generated by this command: // -// mockgen -source=session/types.go -package=session -destination=session/provider.mock_test.go Provider +// mockgen -copyright_file=.license_header -source=session/types.go -package=session -destination=session/provider.mock_test.go Provider // // Package session is a generated GoMock package. package session diff --git a/session/redis/redis.go b/session/redis/redis.go index 3112309..11b8180 100644 --- a/session/redis/redis.go +++ b/session/redis/redis.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package redis import ( diff --git a/session/redis/redis_test.go b/session/redis/redis_test.go index e31cc24..23eac3c 100644 --- a/session/redis/redis_test.go +++ b/session/redis/redis_test.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package redis import ( diff --git a/session/types.go b/session/types.go index 13ec521..9cbca8d 100644 --- a/session/types.go +++ b/session/types.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package session import ( diff --git a/types.go b/types.go index 19b7c11..d431135 100644 --- a/types.go +++ b/types.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ginx import ( diff --git a/wrapper_func.go b/wrapper_func.go index cc15873..54e135f 100644 --- a/wrapper_func.go +++ b/wrapper_func.go @@ -1,3 +1,17 @@ +// Copyright 2023 ecodeclub +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package ginx import (