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

Feature/validate role options #101

Merged
merged 9 commits into from
Sep 15, 2017
Merged

Conversation

alexeyklyukin
Copy link
Contributor

Only accept CREATE ROLE flags that doesn't have any params (i.e.
not ADMIN or CONNECTION LIMIT). Check that both flag and NOflag
are not used at the same time.

func invertFlag(flag string) string {
if flag[:2] == "NO" {
return flag[2:]
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

no need for else

return "NO" + flag
}
}

func normalizeUserFlags(userFlags []string) (flags []string, err error) {
Copy link
Contributor

@mkabilov mkabilov Sep 15, 2017

Choose a reason for hiding this comment

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

I think in this case there is no strong need for the named return values.
Besides, code like return nil, fmt.Errorf("bla") as for me looks more clear than

err = fmt.Errorf("bla")
return

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 8.863% when pulling 57da83a on feature/validate_role_options into 969a06f on master.

@mkabilov
Copy link
Contributor

👍

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 8.873% when pulling 2eec0e5 on feature/validate_role_options into 969a06f on master.

@alexeyklyukin
Copy link
Contributor Author

👍

@alexeyklyukin alexeyklyukin merged commit 7667847 into master Sep 15, 2017
@alexeyklyukin alexeyklyukin deleted the feature/validate_role_options branch September 15, 2017 11:57
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.

None yet

3 participants