From ad7eba9b03621dc1cc3ea592808400742b555d68 Mon Sep 17 00:00:00 2001 From: Dan Jones Date: Wed, 5 Nov 2025 16:00:55 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20Refactor=20project=20structure?= =?UTF-8?q?=20to=20follow=20standard=20Go=20layout=20conventions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- AGENTS.md | 3 ++- Makefile | 2 +- main.go => cmd/my-log/main.go | 2 +- {cmd => internal/cmd}/config.go | 0 {cmd => internal/cmd}/drop.go | 0 {cmd => internal/cmd}/root.go | 0 7 files changed, 5 insertions(+), 4 deletions(-) rename main.go => cmd/my-log/main.go (93%) rename {cmd => internal/cmd}/config.go (100%) rename {cmd => internal/cmd}/drop.go (100%) rename {cmd => internal/cmd}/root.go (100%) diff --git a/.gitignore b/.gitignore index 3a550dc..5a806ae 100644 --- a/.gitignore +++ b/.gitignore @@ -122,6 +122,6 @@ Temporary Items *.icloud # End of https://www.toptal.com/developers/gitignore/api/go,linux,emacs,macos -my-log +/my-log cover.html cmd/test.go diff --git a/AGENTS.md b/AGENTS.md index 2f54c9d..50a1aca 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -25,7 +25,8 @@ - **Examples**: `✨ Add JSON export functionality for log entries`, `🐛 Fix date parsing for RFC3339 timestamps`, `📝 Update README with configuration examples` ## 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 - `config/`: TOML-based configuration with env overrides - `formatters/`: Output formatters (plain, json, null) diff --git a/Makefile b/Makefile index a3d8581..aaf684f 100644 --- a/Makefile +++ b/Makefile @@ -47,4 +47,4 @@ open-report: $(COVERHTML) ## Open the coverage report in the default browser build: $(OUT) ## Builds the application $(OUT): $(SOURCES) fmt - go build -o $@ + go build -o $@ ./cmd/my-log diff --git a/main.go b/cmd/my-log/main.go similarity index 93% rename from main.go rename to cmd/my-log/main.go index a23ee3c..c7f2435 100644 --- a/main.go +++ b/cmd/my-log/main.go @@ -16,7 +16,7 @@ along with this program. If not, see . */ package main -import "codeberg.org/danjones000/my-log/cmd" +import "codeberg.org/danjones000/my-log/internal/cmd" func main() { cmd.Execute() diff --git a/cmd/config.go b/internal/cmd/config.go similarity index 100% rename from cmd/config.go rename to internal/cmd/config.go diff --git a/cmd/drop.go b/internal/cmd/drop.go similarity index 100% rename from cmd/drop.go rename to internal/cmd/drop.go diff --git a/cmd/root.go b/internal/cmd/root.go similarity index 100% rename from cmd/root.go rename to internal/cmd/root.go