Skip to content

Split up server.go into diff files #472

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

Merged
merged 6 commits into from
Feb 10, 2022
Merged

Split up server.go into diff files #472

merged 6 commits into from
Feb 10, 2022

Conversation

sarataha
Copy link
Member

@sarataha sarataha commented Feb 7, 2022

Closes #359

@sarataha sarataha added tech-debt enhancement New feature or request labels Feb 7, 2022
@sarataha sarataha marked this pull request as ready for review February 7, 2022 14:25
Copy link
Collaborator

@foot foot left a comment

Choose a reason for hiding this comment

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

🎉 !

Looking great

return &capiv1_proto.GetEnterpriseVersionResponse{
Version: version.Version,
}, nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maye its own file called version?

// profileValues is what the client will provide to the API.
// It may have > 1 and its values parameter may be empty.
// Assumption: each profile should have a values.yaml that we can treat as the default.
func generateProfileFiles(ctx context.Context, helmRepoName, helmRepoNamespace, helmRepositoryCacheDir, clusterName string, kubeClient client.Client, profileValues []*capiv1_proto.ProfileValues) (*gitprovider.CommitFile, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Helpers that are only used by the clusters handlers can go in that file I would say, wdyt?

The principle of proximity focuses on how well organised your code is with respect to readability and change. Proximity implies that functions that are changed together are moved closer together. Proximity is both a design principle and a heuristic for refactoring hotspots toward code that's easier to understand.

^ Not a hard and fast rule at all just guidelines.

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense to me 🙂 🙏

repositoryURL := os.Getenv("CAPI_TEMPLATES_REPOSITORY_URL")

return &capiv1_proto.GetConfigResponse{RepositoryURL: repositoryURL}, nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

config.go?

}

// ListCredentials searches the management cluster and lists any objects that match specific given types
func (s *server) ListCredentials(ctx context.Context, msg *capiv1_proto.ListCredentialsRequest) (*capiv1_proto.ListCredentialsResponse, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

credentials.go too perhaps?

Copy link
Collaborator

@foot foot left a comment

Choose a reason for hiding this comment

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

💯 !!!

Much nicer nicely done :)

@@ -0,0 +1,151 @@
package server
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets rename this to common_test.go or something like that to make it clearer it just test stuff.

If its used by other packages we could go for test_common.go or something that can be exported (I think that works..)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure 👍 I think it's used by the same package only :)

@sarataha sarataha merged commit 3fad77e into main Feb 10, 2022
@sarataha sarataha deleted the split-server-file branch February 10, 2022 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request tech-debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split up server.go into diff files, its very big.
2 participants