mirror of https://github.com/coder/coder.git
chore(coderd/database): introduce compile-time guard against import in slim build (#9521)
This change introduces a compile-time error when `coderd/database` is imported into the slim build. This is to guard against accidentally growing the binary size via import. Ref: #9380
This commit is contained in:
parent
adba421524
commit
76ab22f539
|
@ -0,0 +1,8 @@
|
|||
package database
|
||||
|
||||
const (
|
||||
// This declaration protects against imports in slim builds, see
|
||||
// no_slim_slim.go.
|
||||
//nolint:revive,unused
|
||||
_DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS = "DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS"
|
||||
)
|
|
@ -0,0 +1,14 @@
|
|||
//go:build slim
|
||||
|
||||
package database
|
||||
|
||||
const (
|
||||
// This re-declaration will result in a compilation error and is present to
|
||||
// prevent increasing the slim binary size by importing this package,
|
||||
// directly or indirectly.
|
||||
//
|
||||
// no_slim_slim.go:7:2: _DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS redeclared in this block
|
||||
// no_slim.go:4:2: other declaration of _DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS
|
||||
//nolint:revive,unused
|
||||
_DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS = "DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS"
|
||||
)
|
Loading…
Reference in New Issue