forgejo/models/migrations/v1_20
Gusted 138942c09e
[CHORE] Move test related function to own package
- Go's deadcode eliminator is quite simple, if you put a public function
in a package `aa/bb` that is used only by tests, it would still be built
if package `aa/bb` was imported. This means that if such functions use
libraries relevant only to tests that those libraries would still be
be built and increase the binary size of a Go binary.
- This is also the case with Forgejo, `models/migrations/base/tests.go`
contained functions exclusively used by tests which (skipping some steps
here) imports https://github.com/ClickHouse/clickhouse-go, which is
2MiB. The `code.gitea.io/gitea/models/migrations/base` package is
imported by `cmd/doctor` and thus the code of the clickhouse library is
also built and included in the Forgejo binary, although entirely unused
and not reachable.
- This patch moves the test-related functions to their own package, so
Go's deadcode eliminator knows not to build the test-related functions
and thus reduces the size of the Forgejo binary.
- It is not possible to move this to a `_test.go` file because Go does
not allow importing functions from such files, so any test helper
function must be in a non-test package and file.
- Reduction of size (built with `TAGS="sqlite sqlite_unlock_notify" make
build`):
  - Before: 95912040 bytes (92M)
  - After: 92306888 bytes (89M)
2024-07-14 17:00:49 +02:00
..
main_test.go [CHORE] Move test related function to own package 2024-07-14 17:00:49 +02:00
v244.go Require approval to run actions for fork pull request (#22803) 2023-02-24 15:58:49 +08:00
v245.go [CHORE] Remove Microsoft SQL Server Support 2024-04-05 23:37:36 +02:00
v246.go Fix missed migration in #22235 (#23482) 2023-03-15 10:33:10 +01:00
v247.go Do not store user projects as organization projects (#23353) 2023-03-17 21:07:23 +08:00
v248.go Display the version of runner in the runner list (#23490) 2023-03-19 22:19:40 -04:00
v249.go Improve indices for action table (#23532) 2023-03-24 23:44:33 +08:00
v250.go Enable more revive linter rules (#30608) 2024-04-28 15:39:00 +02:00
v251.go Fix owner team access mode value in team_unit table (#23675) 2023-04-03 10:36:35 -04:00
v252.go Fix admin team access mode value in team_unit table (#24012) 2023-04-13 21:06:10 +02:00
v253.go Add migration to fix external unit access mode of owner/admin team (#24117) 2023-04-15 09:52:44 -04:00
v254.go Support upload outputs and use needs context on Actions (#24230) 2023-04-22 16:12:41 -04:00
v255.go Display when a repo was archived (#22664) 2023-04-26 10:46:26 -04:00
v256.go Add Debian package registry (#24426) 2023-05-02 12:31:35 -04:00
v257.go Implement actions artifacts (#22738) 2023-05-19 21:37:57 +08:00
v258.go Add the ability to pin Issues (#24406) 2023-05-25 15:17:19 +02:00
v259.go Redesign Scoped Access Tokens (#24767) 2023-06-04 20:57:16 +02:00
v259_test.go [CHORE] Move test related function to own package 2024-07-14 17:00:49 +02:00