Skip to content

Conversation

spikecurtis
Copy link
Contributor

@spikecurtis spikecurtis commented Aug 19, 2022

This adds a check to ensure we don't accidentally import enterprise code from AGPL code, which would cause "AGPL" builds to not really be AGPL.

Oh, and if you are wondering, "can ruleguard do this?," the answer is no

Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis spikecurtis requested a review from a team August 19, 2022 17:28
Signed-off-by: Spike Curtis <spike@coder.com>
@spikecurtis spikecurtis enabled auto-merge (squash) August 19, 2022 17:40
@spikecurtis spikecurtis merged commit 690e6c6 into main Aug 19, 2022
@spikecurtis spikecurtis deleted the spike/enterprise_import_lint branch August 19, 2022 17:49
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Looks like I was too slow with my review 😄.

Btw, I looked at the linked issue; this last comment makes it sound like it would be possible? quasilyte/go-ruleguard#78 (comment)

cdroot

set +e
find . -regex ".*\.go" | grep -v "./enterprise" | xargs grep -n "github.com/coder/coder/enterprise"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
find . -regex ".*\.go" | grep -v "./enterprise" | xargs grep -n "github.com/coder/coder/enterprise"
find . -name ./enterprise -prune -o -name '*.go' -print0 | xargs -0 grep -n "github.com/coder/coder/enterprise"

Not at a computer; so can’t test. But use if you want. Silly tool optimization. This even handles spaces in names which isn’t ever going to be a problem with Go source files 🤪

@spikecurtis
Copy link
Contributor Author

@mafredri it is possible to match on file names, which is one requirement, but it is not possible to match the import statements, which is the other requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants