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
v245.go [CHORE] Remove Microsoft SQL Server Support 2024-04-05 23:37:36 +02:00
v246.go
v247.go
v248.go
v249.go
v250.go Enable more revive linter rules (#30608) 2024-04-28 15:39:00 +02:00
v251.go
v252.go
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