diff --git a/.forgejo/workflows/workflow.yaml b/.forgejo/workflows/workflow.yaml index 13935dc..5e4f4fd 100644 --- a/.forgejo/workflows/workflow.yaml +++ b/.forgejo/workflows/workflow.yaml @@ -1,5 +1,5 @@ --- -name: Workflow +name: CI on: pull_request: @@ -8,12 +8,10 @@ on: - synchronize jobs: - test: + tests: + name: Tests if: ${{ ! github.event.pull_request.draft }} runs-on: docker - env: - GO_TEST_VERBOSE: "1" - GO_TEST_COVER: "1" steps: - name: Checkout Repository uses: https://code.forgejo.org/actions/checkout@v4 @@ -24,3 +22,19 @@ jobs: env: PROJECT_TEST_VERBOSE: "1" PROJECT_TEST_COVER: "1" + - name: Gosec + uses: https://codeflow.dananglin.me.uk/actions/mage-ci@main + with: + target: gosec + + style: + name: Style + if: ${{ ! github.event.pull_request.draft }} + runs-on: docker + steps: + - name: Checkout Repository + uses: https://code.forgejo.org/actions/checkout@v4 + - name: Run staticcheck + uses: https://codeflow.dananglin.me.uk/actions/mage-ci@main + with: + target: staticcheck diff --git a/internal/executors/errors.go b/internal/executors/errors.go index a6aaeed..54c4f78 100644 --- a/internal/executors/errors.go +++ b/internal/executors/errors.go @@ -5,5 +5,5 @@ type UnrecognisedCommandError struct { } func (e UnrecognisedCommandError) Error() string { - return "unrecognised command: "+ e.command + return "unrecognised command: " + e.command } diff --git a/internal/executors/serve.go b/internal/executors/serve.go index e79f57c..f4cac2e 100644 --- a/internal/executors/serve.go +++ b/internal/executors/serve.go @@ -44,7 +44,7 @@ func (e *serveExecutor) execute() error { ReadHeaderTimeout: 1 * time.Second, } - slog.Info(info.ApplicationName + " is listening for web requests", "address", e.address) + slog.Info(info.ApplicationName+" is listening for web requests", "address", e.address) err := server.ListenAndServe() if err != nil { diff --git a/magefiles/mage.go b/magefiles/mage.go index 75cccf4..05df9d7 100644 --- a/magefiles/mage.go +++ b/magefiles/mage.go @@ -52,6 +52,14 @@ func Lint() error { return sh.RunV("golangci-lint", "run", "--color", "always") } +func Gosec() error { + return sh.RunV("gosec", "./...") +} + +func Staticcheck() error { + return sh.RunV("staticcheck", "./...") +} + // Build build the executable. // To rebuild packages that are already up-to-date set PROJECT_BUILD_REBUILD_ALL=1 // To enable verbose mode set PROJECT_BUILD_VERBOSE=1