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

Add staticcheck to actions #96

Merged
merged 3 commits into from
May 11, 2022
Merged

Conversation

elivlo
Copy link
Collaborator

@elivlo elivlo commented May 10, 2022

This pull request will apply some changes to actions. It will add staticcheck to check the code for some optimization.
Suggestion from: #95

@elivlo elivlo added the enhancement New feature or request label May 10, 2022
@elivlo elivlo self-assigned this May 10, 2022
@elivlo elivlo linked an issue May 10, 2022 that may be closed by this pull request
@elivlo elivlo force-pushed the fix-use-regexp-compile-and-staticcheck branch 2 times, most recently from 0cee179 to a4b17cc Compare May 10, 2022 11:12
@elivlo elivlo force-pushed the fix-use-regexp-compile-and-staticcheck branch from a4b17cc to 42200c1 Compare May 10, 2022 11:14
@elivlo elivlo requested a review from Ullaakut May 10, 2022 11:18
@elivlo
Copy link
Collaborator Author

elivlo commented May 10, 2022

Hi @Ullaakut :)
WDYT of this?

Comment on lines +70 to +71
interfaceRegex := regexp.MustCompile(`\*INTERFACES\*`)
routesRegex := regexp.MustCompile(`\*ROUTES\*`)
Copy link
Owner

Choose a reason for hiding this comment

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

Usually regexp.MustCompile statements are kept outside of the function body, in var declarations at the top of the files they are used in. WDYT?

See discussion about it in the noglobals linter if you're curious

Copy link
Collaborator Author

@elivlo elivlo May 11, 2022

Choose a reason for hiding this comment

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

I will change this. @ChnMig mentioned it but I was not sure if we really need this.

Copy link
Owner

@Ullaakut Ullaakut left a comment

Choose a reason for hiding this comment

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

Hi @elivlo ! Thanks for your contribution :))) Appreciated as always! I think we could add further linters as well in the future, I'm up for discussing it with you if you're interested

@Ullaakut Ullaakut merged commit 1b0b513 into master May 11, 2022
@Ullaakut Ullaakut deleted the fix-use-regexp-compile-and-staticcheck branch May 11, 2022 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using regexp.Match or related in a loop, should use regexp.Compile
2 participants