gitforge/build
Mathieu Fenniak 16793050ce chore: add permissions.Context methods to lint-single-response (#13234)
#13087 added a new lint, `lint-single-response`, which guarantees that web handlers don't proceed after making a terminating call (eg. `ctx.Error(...)`).  #12512 introduced a new type with these terminating-style methods on the interface `forgejo.org/routers/api/v1/permissions.Context`.  This PR adds the new methods to the list of terminating calls.

## Testing

In addition to automated tests which check the usage, I've manually altered codepaths in `routers/api/v1` and removed `return` statements (for example, removing [this line](1ab4c8d915/routers/api/v1/permissions/req_admin.go (L18))), and then running `make lint-single-response`:
```
$ make lint-single-response
.../go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.4.linux-amd64/bin/go run ./build/lint-single-response/cmd ./...
.../Dev/forgejo/routers/api/v1/permissions/req_admin.go:17:3: Invocation of forgejo.org/routers/api/v1/permissions.Context / NotFound, and control flow continues afterwards.
exit status 3
make: *** [Makefile:535: lint-single-response] Error 1
```

This testing was important because `permissions.Context` is the first interface to be involved in this new lint, where the other usages are all structs.

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13234
Reviewed-by: limiting-factor <limiting-factor@noreply.codeberg.org>
2026-07-01 15:41:04 +02:00
..
codeformat chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
lint-locale feat: add actionable message on lint-locale failure (#12748) 2026-05-27 11:48:07 +02:00
lint-locale-usage feat(build): Support go "fmt" format strings as masked usage patterns (#12013) 2026-05-01 02:46:01 +02:00
lint-single-response chore: add permissions.Context methods to lint-single-response (#13234) 2026-07-01 15:41:04 +02:00
backport-locales.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
code-batch-process.go chore: rename 'migrations' to 'gitea_migrations' 2025-10-14 14:40:49 -06:00
generate-bindata.go fix: Dockerfile should re-use bindata files when possible 2025-06-13 14:00:57 +02:00
generate-disposable-email.go
generate-emoji.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
generate-gitignores.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
generate-go-licenses.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
generate-licenses.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
merge-forgejo-locales.go
test-echo.go
test-env-check.sh
test-env-prepare.sh