shurcooL / Go-Package-Store

An app that displays updates for the Go packages in your GOPATH.
MIT License
900 stars 29 forks source link

Huge refactor to improve package layout. #61

Closed dmitshur closed 7 years ago

dmitshur commented 7 years ago

Move root package to ./cmd/Go-Package-Store; move domain types to root.

This is a large refactor that aims at significantly improving the package organization of this project.

First, move the Go-Package-Store command to its new import path at github.com/shurcooL/Go-Package-Store/cmd/Go-Package-Store.

The move ./pkg into root package gps at github.com/shurcooL/Go-Package-Store. Also move github.com/shurcooL/Go-Package-Store.Presenter and github.com/shurcooL/Go-Package-Store/updater.Updater types into root package.

This package reorganization is somewhat inspired by the "Standard Package Layout" blog post at https://medium.com/@benbjohnson/standard-package-layout-7cdbc8391fc1 (/cc @benbjohnson). It currently generally follows two principles from there:

1. Root package is for domain types
4. Main package ties together dependencies

Putting domain types in the root packages seems to be a great idea, and the command that previously lived there has no choice but to go into cmd subfolder. It continues to tie together dependencies as before.

Rename presenter to presentation; provider to presenter.

These new names make a lot more sense and better correspond to reality. A presenter is something that takes a repository, performs the work, and returns a presentation of that repository. The presentation is ready to be displayed and does no work.

Clean up, simplify, improve organization and style of packages. Avoid stutter in many names.