Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit76ab22f

Browse files
authored
chore(coderd/database): introduce compile-time guard against import in slim build (#9521)
This change introduces a compile-time error when `coderd/database` isimported into the slim build. This is to guard against accidentallygrowing the binary size via import.Ref:#9380
1 parentadba421 commit76ab22f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

‎coderd/database/no_slim.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package database
2+
3+
const (
4+
// This declaration protects against imports in slim builds, see
5+
// no_slim_slim.go.
6+
//nolint:revive,unused
7+
_DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS="DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS"
8+
)

‎coderd/database/no_slim_slim.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//go:build slim
2+
3+
package database
4+
5+
const (
6+
// This re-declaration will result in a compilation error and is present to
7+
// prevent increasing the slim binary size by importing this package,
8+
// directly or indirectly.
9+
//
10+
// no_slim_slim.go:7:2: _DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS redeclared in this block
11+
// no_slim.go:4:2: other declaration of _DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS
12+
//nolint:revive,unused
13+
_DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS="DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS"
14+
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp