From 05db6994d4a77bc95cc9d96892f81875f2f9fa01 Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Sun, 15 Mar 2026 21:43:53 +0300 Subject: [PATCH] Document git submodule embedding --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/README.md b/README.md index ed4ae72..c18c9f4 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,37 @@ It is intended to be embedded into other Go applications that collect audit data For embedding instructions, see [`docs/embedding.md`](/Users/mchusavitin/Documents/git/reanimator/chart/docs/embedding.md). +### As Git Submodule + +To embed `chart` into another repository as a git submodule: + +```bash +git submodule add https://git.mchus.pro/reanimator/chart.git internal/chart +git submodule update --init --recursive +``` + +In the host application's `go.mod`, point the module path at the checked-out submodule: + +```go +replace reanimator/chart => ./internal/chart +``` + +Example mount inside the host application: + +```go +mux.Handle("/chart/", http.StripPrefix("/chart", viewer.NewHandler(viewer.HandlerOptions{ + Title: "Hardware Snapshot", +}))) +``` + +To update the submodule later: + +```bash +git submodule update --remote internal/chart +git add internal/chart +git commit -m "Update reanimator chart submodule" +``` + Standalone local run: ```bash