🚚 Refactor project structure to follow standard Go layout conventions

This commit is contained in:
Dan Jones 2025-11-05 16:00:55 -06:00
commit ad7eba9b03
7 changed files with 5 additions and 4 deletions

2
.gitignore vendored
View file

@ -122,6 +122,6 @@ Temporary Items
*.icloud *.icloud
# End of https://www.toptal.com/developers/gitignore/api/go,linux,emacs,macos # End of https://www.toptal.com/developers/gitignore/api/go,linux,emacs,macos
my-log /my-log
cover.html cover.html
cmd/test.go cmd/test.go

View file

@ -25,7 +25,8 @@
- **Examples**: `✨ Add JSON export functionality for log entries`, `🐛 Fix date parsing for RFC3339 timestamps`, `📝 Update README with configuration examples` - **Examples**: `✨ Add JSON export functionality for log entries`, `🐛 Fix date parsing for RFC3339 timestamps`, `📝 Update README with configuration examples`
## Project Structure ## Project Structure
- `cmd/`: Cobra commands (root, drop, config) - `cmd/my-log/`: Main application entrypoint
- `internal/cmd/`: Cobra commands (root, drop, config)
- `models/`: Core types (Entry, Log, Meta) with marshal/unmarshal implementations - `models/`: Core types (Entry, Log, Meta) with marshal/unmarshal implementations
- `config/`: TOML-based configuration with env overrides - `config/`: TOML-based configuration with env overrides
- `formatters/`: Output formatters (plain, json, null) - `formatters/`: Output formatters (plain, json, null)

View file

@ -47,4 +47,4 @@ open-report: $(COVERHTML) ## Open the coverage report in the default browser
build: $(OUT) ## Builds the application build: $(OUT) ## Builds the application
$(OUT): $(SOURCES) fmt $(OUT): $(SOURCES) fmt
go build -o $@ go build -o $@ ./cmd/my-log

View file

@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package main package main
import "codeberg.org/danjones000/my-log/cmd" import "codeberg.org/danjones000/my-log/internal/cmd"
func main() { func main() {
cmd.Execute() cmd.Execute()