HUGO

Refactor code structure within hugo packages

I just want to ask a question in how open are the project maintainers to pull request for refactoring of code blocks within the Hugo packages? E.g. moving code blocks to other files without changing the package functionality or API surface. Some kind of housekeeping if you will.

While diving into the source of Hugo I had some difficulties to follow the code structure vs. file naming. Some parts of connected code are located in separate files, while other files with specific names do not contain the expected code blocks.

Example within the package hugo/commands:

  • main entry of the package is the hugo.go file
  • hugo.go contains code blocks, which define methods on a commandeer struct
  • there exists another file named commandeer.go, which defines the type commandeer struct
  • the hugo.go file contains some other functions, which are only called within commandeer methods, e.g. func isTerminal() bool
  • IMO all code belonging to commandeer should be located in a dedicated single file
  • within commandeer.go is a type fileChangeDetector struct with its own methods defined, which IMO should be moved to a separate file

Overall no deal breakers, but I see some points to stumble over in trying to understand the code structure.

These improvements for the /commands package is welcome.

The answer to your general question would be no. And the main reason for that is that I currently have a few bigger and long running feature branches that would fall over like a brick house (or: would be very hard to rebase) if code was moved around much in general in Hugo.