Skip to content

Commit

Permalink
Merge branch 'gofiber:main' into feature/loadshed-middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Behzad-Khokher authored Jan 21, 2024
2 parents fc827f4 + 5f6baef commit 81ca27c
Show file tree
Hide file tree
Showing 29 changed files with 275 additions and 318 deletions.
39 changes: 22 additions & 17 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,35 @@ on:
- ".github/dependabot.yml"

jobs:
golangci-lint:
set-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- name: Fetch Repository
uses: actions/checkout@v4
- name: Generate Matrix
id: generate-matrix
run: |
SUBDIRS=$(find . -maxdepth 1 -type d -not -name '.*' -not -name 'internal' -not -empty | sed 's|./||' | tr '\n' ' ' | sed 's/ $//')
JSON_MATRIX=$(echo "$SUBDIRS" | jq -R -c -s 'split(" ") | map(select(. != "")) | .[-1] |= sub("\n$"; "")')
echo "matrix=$JSON_MATRIX" >> $GITHUB_OUTPUT
- name: Set up Go
golangci-lint:
runs-on: ubuntu-latest
needs: set-matrix
strategy:
matrix:
directory: ${{fromJson(needs.set-matrix.outputs.matrix)}}
steps:
- name: Fetch Repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.x'

- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/[email protected]

- name: Get directories to lint
run: |
REPO_ROOT=$(pwd)
go list -f '{{.Dir}}' -m > dirs.txt
sed -i "s|${REPO_ROOT}/||" dirs.txt
cat dirs.txt
- name: Run golangci-lint for each directory
run: |
while IFS= read -r dir; do
echo "Linting directory $dir"
(cd "$dir" && golangci-lint run --tests=false)
done < dirs.txt
- name: Run golangci-lint
working-directory: ./${{ matrix.directory }}
run: golangci-lint run --tests=false
132 changes: 53 additions & 79 deletions .github/workflows/gosec.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,58 @@
name: Gosec Security Scan

on:
push:
branches:
- "master"
- "main"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
push:
branches:
- "master"
- "main"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"

jobs:
gosec-scan:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Fetch Repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 'oldstable'
check-latest: true
cache: false
- name: Install Gosec
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
- name: Run Gosec (paseto)
working-directory: ./paseto
run: gosec -exclude-dir=internal ./...
# -----
- name: Run Gosec (fiberzap)
working-directory: ./fiberzap
run: gosec -exclude-dir=internal ./...
# -----
- name: Run Gosec (otelfiber)
working-directory: ./otelfiber
run: gosec -exclude-dir=example ./...
- name: Run Gosec (swagger)
working-directory: ./swagger
run: gosec -exclude-dir=internal ./...
# -----
- name: Run Gosec (casbin)
working-directory: ./casbin
run: gosec -exclude-dir=internal ./...
# -----
- name: Run Gosec (fibernewrelic)
working-directory: ./fibernewrelic
run: gosec -exclude-dir=internal ./...
# -----
- name: Run Gosec (opafiber)
working-directory: ./opafiber
run: gosec -exclude-dir=internal ./...
# -----
- name: Run Gosec (fiberi18n)
working-directory: ./fiberi18n
run: gosec -exclude-dir=internal ./...
# -----
- name: Run Gosec (fiberzerolog)
working-directory: ./fiberzerolog
run: gosec -exclude-dir=internal ./...
# -----
- name: Run Gosec (jwt)
working-directory: ./jwt
run: gosec -exclude-dir=internal ./...
# -----
- name: Run Gosec (websocket)
working-directory: ./websocket
run: gosec -exclude-dir=internal ./...
# -----
- name: Run Gosec (fgprof)
working-directory: ./fgprof
run: gosec -exclude-dir=internal ./...
# -----
set-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- name: Fetch Repository
uses: actions/checkout@v4
- name: Generate Matrix
id: generate-matrix
run: |
SUBDIRS=$(find . -maxdepth 1 -type d -not -name '.*' -not -name 'internal' -not -empty | sed 's|./||' | tr '\n' ' ' | sed 's/ $//')
JSON_MATRIX=$(echo "$SUBDIRS" | jq -R -c -s 'split(" ") | map(select(. != "")) | .[-1] |= sub("\n$"; "")')
echo "matrix=$JSON_MATRIX" >> $GITHUB_OUTPUT
gosec-scan:
runs-on: ubuntu-latest
needs: set-matrix
strategy:
matrix:
directory: ${{fromJson(needs.set-matrix.outputs.matrix)}}
env:
GO111MODULE: on
steps:
- name: Fetch Repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 'oldstable'
check-latest: true
cache: false
- name: Install Gosec
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
- name: Run Gosec for ${{ matrix.directory }}
working-directory: ./${{ matrix.directory }}
run: gosec -exclude-dir=example ./...
62 changes: 20 additions & 42 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,26 @@ on:
- ".github/dependabot.yml"

jobs:
set-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- name: Fetch Repository
uses: actions/checkout@v4
- name: Generate Matrix
id: generate-matrix
run: |
SUBDIRS=$(find . -maxdepth 1 -type d -not -name '.*' -not -name 'internal' -not -empty | sed 's|./||' | tr '\n' ' ' | sed 's/ $//')
JSON_MATRIX=$(echo "$SUBDIRS" | jq -R -c -s 'split(" ") | map(select(. != "")) | .[-1] |= sub("\n$"; "")')
echo "matrix=$JSON_MATRIX" >> $GITHUB_OUTPUT
govulncheck-check:
runs-on: ubuntu-latest
needs: set-matrix
strategy:
matrix:
directory: ${{fromJson(needs.set-matrix.outputs.matrix)}}
env:
GO111MODULE: on
steps:
Expand All @@ -35,46 +53,6 @@ jobs:
cache: false
- name: Install Govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run govulncheck (paseto)
working-directory: ./paseto
run: govulncheck ./...
# -----
- name: Run govulncheck (fiberzap)
working-directory: ./fiberzap
run: govulncheck ./...
# -----
- name: Run govulncheck (otelfiber)
working-directory: ./otelfiber
run: govulncheck ./...
- name: Run govulncheck (swagger)
working-directory: ./swagger
run: govulncheck ./...
# -----
- name: Run govulncheck (casbin)
working-directory: ./casbin
run: govulncheck ./...
# -----
- name: Run govulncheck (fibernewrelic)
working-directory: ./fibernewrelic
run: govulncheck ./...
# -----
- name: Run govulncheck (opafiber)
working-directory: ./opafiber
run: govulncheck ./...
# -----
- name: Run govulncheck (fiberi18n)
working-directory: ./fiberi18n
run: govulncheck ./...
# -----
- name: Run govulncheck (fiberzerolog)
working-directory: ./fiberzerolog
run: govulncheck ./...
# -----
- name: Run govulncheck (jwt)
working-directory: ./jwt
run: govulncheck ./...
# -----
- name: Run govulncheck (websocket)
working-directory: ./websocket
- name: Run Govulncheck for ${{ matrix.directory }}
working-directory: ./${{ matrix.directory }}
run: govulncheck ./...
# -----
10 changes: 5 additions & 5 deletions casbin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ go 1.18

require (
github.com/casbin/casbin/v2 v2.81.0
github.com/gofiber/fiber/v2 v2.51.0
github.com/gofiber/fiber/v2 v2.52.0
)

require (
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/casbin/govaluate v1.1.0 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.50.0 // indirect
github.com/valyala/fasthttp v1.51.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/sys v0.15.0 // indirect
)
20 changes: 10 additions & 10 deletions casbin/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ github.com/casbin/casbin/v2 v2.81.0 h1:vNwJXK7a+TJZElZ5saP+SFJvweZNtJ3MlVP6P4IuR
github.com/casbin/casbin/v2 v2.81.0/go.mod h1:jX8uoN4veP85O/n2674r2qtfSXI6myvxW85f6TH50fw=
github.com/casbin/govaluate v1.1.0 h1:6xdCWIpE9CwHdZhlVQW+froUrCsjb6/ZYNcXODfLT+E=
github.com/casbin/govaluate v1.1.0/go.mod h1:G/UnbIjZk/0uMNaLwZZmFQrR72tYRZWQkO70si/iR7A=
github.com/gofiber/fiber/v2 v2.51.0 h1:JNACcZy5e2tGApWB2QrRpenTWn0fq0hkFm6k0C86gKQ=
github.com/gofiber/fiber/v2 v2.51.0/go.mod h1:xaQRZQJGqnKOQnbQw+ltvku3/h8QxvNi8o6JiJ7Ll0U=
github.com/gofiber/fiber/v2 v2.52.0 h1:S+qXi7y+/Pgvqq4DrSmREGiFwtB7Bu6+QFLuIHYw/UE=
github.com/gofiber/fiber/v2 v2.52.0/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM=
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
Expand All @@ -23,8 +23,8 @@ github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.50.0 h1:H7fweIlBm0rXLs2q0XbalvJ6r0CUPFWK3/bB4N13e9M=
github.com/valyala/fasthttp v1.50.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand All @@ -33,7 +33,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
4 changes: 2 additions & 2 deletions fgprof/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ go 1.19

require (
github.com/felixge/fgprof v0.9.3
github.com/gofiber/fiber/v2 v2.51.0
github.com/gofiber/fiber/v2 v2.52.0
)

require (
github.com/andybalholm/brotli v1.0.6 // indirect
github.com/google/pprof v0.0.0-20231205033806-a5a03c77bf08 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
Expand Down
8 changes: 4 additions & 4 deletions fgprof/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ 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/felixge/fgprof v0.9.3 h1:VvyZxILNuCiUCSXtPtYmmtGvb65nqXh2QFWc0Wpf2/g=
github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw=
github.com/gofiber/fiber/v2 v2.51.0 h1:JNACcZy5e2tGApWB2QrRpenTWn0fq0hkFm6k0C86gKQ=
github.com/gofiber/fiber/v2 v2.51.0/go.mod h1:xaQRZQJGqnKOQnbQw+ltvku3/h8QxvNi8o6JiJ7Ll0U=
github.com/gofiber/fiber/v2 v2.52.0 h1:S+qXi7y+/Pgvqq4DrSmREGiFwtB7Bu6+QFLuIHYw/UE=
github.com/gofiber/fiber/v2 v2.52.0/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg=
github.com/google/pprof v0.0.0-20231205033806-a5a03c77bf08 h1:PxlBVtIFHR/mtWk2i0gTEdCz+jBnqiuHNSki0epDbVs=
github.com/google/pprof v0.0.0-20231205033806-a5a03c77bf08/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w=
github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4=
github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
Expand Down
10 changes: 5 additions & 5 deletions fiberi18n/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ module github.com/gofiber/contrib/fiberi18n/v2
go 1.19

require (
github.com/gofiber/fiber/v2 v2.51.0
github.com/gofiber/fiber/v2 v2.52.0
github.com/nicksnyder/go-i18n/v2 v2.2.2
golang.org/x/text v0.14.0
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.50.0 // indirect
github.com/valyala/fasthttp v1.51.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/sys v0.15.0 // indirect
)
Loading

0 comments on commit 81ca27c

Please sign in to comment.