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

chore(coderd/database): introduce compile-time guard against import in slim build#9521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

mafredri
Copy link
Member

This change introduces a compile-time error whencoderd/database is
imported into the slim build. This is to guard against accidentally
growing the binary size via import.

Ref:#9380


This is a bit of a hack, perhaps we want to lint this in the future, but for now a compile-time check should protect against the immediate danger of importingcoderd/database.

The error is (IMO) clear enough:

❯ make build/coder-slim_linux_amd64# github.com/coder/coder/v2/coderd/databasecoderd/database/no_slim_slim.go:12:2: _DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS redeclared in this blockcoderd/database/no_slim.go:6:2: other declaration of _DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDSmake: *** [Makefile:205: build/coder-slim_2.1.4-devel+72655331a_linux_amd64] Error 1

… buildThis 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
@mafredrimafredri self-assigned thisSep 4, 2023
Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A very clever way to do this. Very simple, I like it.

mafredri reacted with hooray emoji
@mafredrimafredri changed the titlechore(coderd/database): add compile-time guard against import in slim buildchore(coderd/database): introduce compile-time guard against import in slim buildSep 4, 2023
@mafredrimafredrienabled auto-merge (squash)September 4, 2023 18:46
@mafredrimafredri merged commit76ab22f intomainSep 4, 2023
@mafredrimafredri deleted the mafredri/chore-prevent-database-import-in-slim-builds branchSeptember 4, 2023 19:01
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 4, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@kylecarbskylecarbskylecarbs approved these changes

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@mafredri@kylecarbs

[8]ページ先頭

©2009-2025 Movatter.jp