-
Notifications
You must be signed in to change notification settings - Fork 34
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
Refactor and add tests, implement a feature #7
Refactor and add tests, implement a feature #7
Conversation
I've typically seen the |
Lgtm fwiw. |
return clnt, err | ||
} | ||
|
||
func (p *policyEvaluator) fetchEnterpriseContractPolicy(ctx context.Context) (*ecp.EnterpriseContractPolicy, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is a function defined for a struct in another file. I understand the relation between this function and the kubernets_client.go
file, but does it hurt readability by having functions separated like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed the refactoring there, I wanted a separate struct for k8s, that should not belong on policyEvaluator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh okay gotcha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a few notes.
A few code style issues that should be addressed:
- go uses camel case. no snake casing.
- all functions should have appropriate doc strings
- ensure a blank line between license boilerplate and package declaration to avoid tools such as
golint
from complaining.
https://github.com/golang-standards/project-layout#internal
|
What we didn't have in the `bash` or the `ec-cli` was the ability to have multiple sources of policy (Rego) files, e.g. from multiple git repositories or branches. Now this is available in the `ec-cli`. This does however refactor the implementation into smaller more manageable files, hopefully makes it easier to maintain. Tests were added. Ref. https://issues.redhat.com/browse/HACBS-372
What we didn't have in the
bash
or theec-cli
was the ability tohave multiple sources of policy (Rego) files, e.g. from multiple git
repositories or branches. Now this is available in the
ec-cli
.This does however refactor the implementation into smaller more
manageable files, hopefully makes it easier to maintain.
Tests were added.
Ref. https://issues.redhat.com/browse/HACBS-372