Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Regal version at start-up #824

Merged
merged 8 commits into from
Jun 12, 2024

Conversation

charlieegan3
Copy link
Member

@charlieegan3 charlieegan3 commented Jun 11, 2024

This adds functionality to the regal LS and lint commands what will check the current version against the latest release in GH.

In order to keep the number of requests down, the version is cached to disk in the .regal dir. The task runs in another goroutine to keep things fast too.

Config has been updated with a features key, and
REGAL_FEATURES_REMOTE_CHECK_VERSION can also be set to disable to functionality.

Sharing for review, if we think it looks good, I'll add some docs and we can get this in.

Fixes #802

cmd/lint.go Outdated
dir = regalDir.Name()
}

if userConfig.Features.RemoteFeatures.CheckVersion &&
Copy link
Member Author

Choose a reason for hiding this comment

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

Config loading is handled in a few places, lint, fix and the lsp, in each place, there are minor differences in when and how the config is loaded. Depending on config for this version check functionality makes it more tightly coupled, and harder to just run anywhere. So not sure, about the config stuff in this PR, but we can remove if we don't like it and just offer the env var.

This adds functionality to the regal LS and lint commands what will
check the current version against the latest release in GH.

In order to keep the number of requests down, the version is cached to
disk in the .regal dir. The task runs in another goroutine to keep
things fast too.

Config has been updated with a features key, and
REGAL_FEATURES_REMOTE_CHECK_VERSION can also be set to disable to
functionality.

Sharing for review, if we think it looks good, I'll add some docs and we
can get this in.

Signed-off-by: Charlie Egan <[email protected]>
Copy link
Member

Choose a reason for hiding this comment

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

👏

internal/update/update.go Outdated Show resolved Hide resolved
Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

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

Change looks good to me! With a few things to consider / discuss.

Also, we'd need some docs on this, right?

pkg/config/config.go Outdated Show resolved Hide resolved
cmd/lint.go Outdated Show resolved Hide resolved
@charlieegan3
Copy link
Member Author

This is all updated again, I just need to do some docs for it.

@charlieegan3
Copy link
Member Author

dedd3bb adds the docs.

Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

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

Looks great, and the refactoring was very welcome!

@anderseknert
Copy link
Member

There's some build failures. I just realized it might be good to mention this briefly in the README too, and provide a link to the docs page on that!

Signed-off-by: Charlie Egan <[email protected]>
@charlieegan3
Copy link
Member Author

Have fixed the md lint error and updated readme too.

@charlieegan3 charlieegan3 merged commit 90b2bcc into StyraInc:main Jun 12, 2024
3 checks passed
@charlieegan3 charlieegan3 deleted the check-version branch June 12, 2024 14:47
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.

Log warning to Stderror when Regal is outdated
3 participants