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

Proposal: package layout #17

Open
inkel opened this issue Sep 28, 2022 · 0 comments
Open

Proposal: package layout #17

inkel opened this issue Sep 28, 2022 · 0 comments

Comments

@inkel
Copy link
Contributor

inkel commented Sep 28, 2022

Heya. I've been looking at this with more detail, and I'd like to propose a new package layout that I think it will make things easier to maintain.

At the top level we have the current import path, github.com/mplzik/rnr/golang/pkg/rnr, which contains the Task interface and the Job struct.

Then we have github.com/mplzik/rnr/golang/pkg/rnr/tasks/web with the Server struct for what it currently resides in webserver.go.

Last but not least, we have for each type of class, the following:

  • github.com/mplzik/rnr/golang/pkg/rnr/tasks/nested
  • github.com/mplzik/rnr/golang/pkg/rnr/tasks/shell
  • github.com/mplzik/rnr/golang/pkg/rnr/tasks/callback

Each of these packages rename the existing FooTask into a Task structure, making the code a little less verbose or more familiar across sub-packages, as in:

t1 := nested.New("foo", nested.Options{})

t2 := shell.New("bar", "kubectl", "get", "pods")`

t3 := callback.New("quux", someFunc)

By doing so we remove the need to use prefixes for each type, and it gives more isolation between definitions, code, and tests.

I believe this should be done first before my other proposal in #6.

What do you think?

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

No branches or pull requests

1 participant