diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4ad47cb5..e98df7a1 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -54,7 +54,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2.18.2 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -68,4 +68,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2.18.2 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 9dc4aacc..b866c86b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,13 +7,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Setup Go environment - uses: actions/setup-go@v3.0.0 + uses: actions/setup-go@v5.0.2 with: go-version: 1.19 - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4.1.7 - name: Run golangci-lint - uses: golangci/golangci-lint-action@v3.1.0 + uses: golangci/golangci-lint-action@v6.1.0 - name: WriteGoList run: go list -json -m all > go.list - name: nancy @@ -33,14 +33,14 @@ jobs: docker ps docker logs keycloak - name: CodeCov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4.5.0 with: file: ./coverage.txt # Publish benchmarks for the main branch only - name: Store Benchmark Result if: github.event_name == 'push' && github.ref == 'refs/heads/main' - uses: rhysd/github-action-benchmark@v1 + uses: rhysd/github-action-benchmark@v1.20.3 with: # What benchmark tool the output.txt came from tool: "go" diff --git a/.golangci.yml b/.golangci.yml index d59a6c32..d5d49ce9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,8 +1,3 @@ -run: - skip-dirs: - - (^|/)testdata($|/) - skip-dirs-use-default: false - linters: enable: - goimports @@ -32,6 +27,9 @@ linters-settings: simplify: true issues: + exclude-dirs: + - (^|/)testdata($|/) + exclude-dirs-use-default: false exclude-use-default: false exclude-rules: - path: _test\.go diff --git a/Makefile b/Makefile index 0409e817..877241bc 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ test: ./run-tests.sh start-keycloak: stop-keycloak - docker-compose up -d + docker compose up -d stop-keycloak: - docker-compose down + docker compose down diff --git a/client_test.go b/client_test.go index 0cda97c3..11aee4fe 100644 --- a/client_test.go +++ b/client_test.go @@ -495,7 +495,7 @@ func (w *RestyLogWriter) write(format string, v ...interface{}) { func NewClientWithDebug(t testing.TB) *gocloak.GoCloak { cfg := GetConfig(t) client := gocloak.NewClient(cfg.HostName) - cond := func(resp *resty.Response, err error) bool { + cond := func(resp *resty.Response, _ error) bool { if resp != nil && resp.IsError() { if e, ok := resp.Error().(*gocloak.HTTPErrorResponse); ok { msg := e.String() @@ -536,7 +536,7 @@ func NewClientWithDebug(t testing.TB) *gocloak.GoCloak { // skipN = number of requests to be executed and not failed by this function func FailRequest(client *gocloak.GoCloak, err error, failN, skipN int) *gocloak.GoCloak { client.RestyClient().OnBeforeRequest( - func(c *resty.Client, r *resty.Request) error { + func(_ *resty.Client, r *resty.Request) error { if skipN > 0 { skipN-- return nil @@ -6253,7 +6253,7 @@ func Test_CreatePermissionTicket(t *testing.T) { require.NoError(t, err, "CreatePermissionTicket failed") t.Logf("Created PermissionTicket: %+v", *(ticket.Ticket)) - pt, err := jwt.ParseWithClaims(*(ticket.Ticket), &gocloak.PermissionTicketRepresentation{}, func(token *jwt.Token) (interface{}, error) { + pt, err := jwt.ParseWithClaims(*(ticket.Ticket), &gocloak.PermissionTicketRepresentation{}, func(_ *jwt.Token) (interface{}, error) { return []byte(""), nil }) diff --git a/docker-compose.yml b/docker-compose.yml index b422ddbb..01bdf32d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3' - services: keycloak: build: . diff --git a/model_test.go b/model_test.go index d14acf60..1a5affcc 100644 --- a/model_test.go +++ b/model_test.go @@ -339,6 +339,6 @@ func TestStringerOmitEmpty(t *testing.T) { } for _, custom := range customs { - assert.Equal(t, "{}", custom.(Stringable).String()) + assert.Equal(t, "{}", custom.String()) } } diff --git a/run-tests.sh b/run-tests.sh index 57875f8e..f762b3eb 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -1,7 +1,7 @@ #!/bin/sh -docker-compose down -docker-compose up -d +docker compose down +docker compose up -d keycloakServer=http://localhost:8080 url="${keycloakServer}/health" @@ -23,4 +23,4 @@ fi go test -failfast -race -cover -coverprofile=coverage.out -covermode=atomic -p 10 -cpu 1,2 -bench . -benchmem ${ARGS[@]} -docker-compose down +docker compose down