From 8fe60a4f8fc0e0ead2e75db32f934e05e635e11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Thu, 3 Dec 2026 18:06:09 +0100 Subject: [PATCH] refactor!: rename module and move CLI to cmd/cephmig Use the repository path git.zb-server.de/Sebi/CephfsMig as module path instead of the non-importable name CephMig, and move the cephmig entry point from the repository root to cmd/cephmig next to cmd/nativeprobe. Makefile and Dockerfile.native build the new path. BREAKING CHANGE: import paths change from CephMig/... to git.zb-server.de/Sebi/CephfsMig/..., and the binary is now built from ./cmd/cephmig instead of the module root. Co-Authored-By: Claude Opus 5.5 --- Makefile | 4 ++-- main.go => cmd/cephmig/main.go | 2 +- main_test.go => cmd/cephmig/main_test.go | 2 +- cmd/nativeprobe/main_ceph.go | 4 ++-- dev/Dockerfile.native | 2 +- go.mod | 2 +- internal/cephfsnative/client_ceph.go | 2 +- internal/migration/native_access.go | 2 +- internal/migration/native_data.go | 2 +- internal/migration/native_factory_ceph.go | 2 +- internal/migration/native_helpers.go | 2 +- internal/migration/native_inventory_test.go | 2 +- internal/migration/native_test.go | 2 +- internal/migration/native_transport.go | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) rename main.go => cmd/cephmig/main.go (98%) rename main_test.go => cmd/cephmig/main_test.go (90%) diff --git a/Makefile b/Makefile index 16e3d4d..d9bebfe 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,13 @@ .PHONY: build check doctor dev-config dev-up dev-down dev-status dev-smoke dev-shell dev-restart-check dev-migration-test dev-native-build dev-native-test dev-smallfiles-test dev-million-start dev-million-status dev-million-finish build: - go build -buildvcs=false -o bin/cephmig . + go build -buildvcs=false -o bin/cephmig ./cmd/cephmig check: go vet ./... go test ./... bash -n dev/cluster.sh dev/client.sh dev/smoke.sh dev/restart-check.sh dev/migration-test.sh dev/native-test.sh dev/smallfiles-test.sh dev/million-start.sh dev/million-finish.sh python3 -c 'import ast,pathlib; [ast.parse(pathlib.Path(p).read_text()) for p in ("dev/native-fixture.py", "dev/smallfiles.py", "dev/million.py")]' doctor: - go run . doctor + go run ./cmd/cephmig doctor dev-config: docker compose -f dev/compose.yaml config --quiet dev-up: diff --git a/main.go b/cmd/cephmig/main.go similarity index 98% rename from main.go rename to cmd/cephmig/main.go index 3bc8750..820f174 100644 --- a/main.go +++ b/cmd/cephmig/main.go @@ -13,7 +13,7 @@ import ( "syscall" "time" - "CephMig/internal/migration" + "git.zb-server.de/Sebi/CephfsMig/internal/migration" ) func main() { diff --git a/main_test.go b/cmd/cephmig/main_test.go similarity index 90% rename from main_test.go rename to cmd/cephmig/main_test.go index fecc696..e26aded 100644 --- a/main_test.go +++ b/cmd/cephmig/main_test.go @@ -9,7 +9,7 @@ import ( func TestCLIRejectsFinalizationWithoutWriterStop(t *testing.T) { var out, log bytes.Buffer - err := run(context.Background(), []string{"finalize", "--config", "dev/migration.example.json", "--state", "/tmp/unused-state"}, &out, &log) + err := run(context.Background(), []string{"finalize", "--config", "../../dev/migration.example.json", "--state", "/tmp/unused-state"}, &out, &log) if err == nil || !strings.Contains(err.Error(), "--writers-stopped") { t.Fatalf("got %v", err) } diff --git a/cmd/nativeprobe/main_ceph.go b/cmd/nativeprobe/main_ceph.go index 4e13f1f..4f7b050 100644 --- a/cmd/nativeprobe/main_ceph.go +++ b/cmd/nativeprobe/main_ceph.go @@ -3,11 +3,11 @@ package main import ( - "CephMig/internal/cephfsnative" - "CephMig/internal/storage" "encoding/json" "flag" "fmt" + "git.zb-server.de/Sebi/CephfsMig/internal/cephfsnative" + "git.zb-server.de/Sebi/CephfsMig/internal/storage" "io" "os" ) diff --git a/dev/Dockerfile.native b/dev/Dockerfile.native index 65d873e..47fcbf9 100644 --- a/dev/Dockerfile.native +++ b/dev/Dockerfile.native @@ -13,7 +13,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ CGO_ENABLED=1 go test -race -tags ceph ./... \ && CGO_ENABLED=1 go vet -tags ceph ./... \ && CGO_ENABLED=1 go build -buildvcs=false -tags ceph -o /out/native-probe ./cmd/nativeprobe \ - && CGO_ENABLED=1 go build -buildvcs=false -tags ceph -o /out/cephmig-native . + && CGO_ENABLED=1 go build -buildvcs=false -tags ceph -o /out/cephmig-native ./cmd/cephmig FROM ${CEPH_IMAGE} COPY --from=build /out/ /usr/local/bin/ diff --git a/go.mod b/go.mod index a064a2f..8a0bc98 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module CephMig +module git.zb-server.de/Sebi/CephfsMig go 1.25.0 diff --git a/internal/cephfsnative/client_ceph.go b/internal/cephfsnative/client_ceph.go index 334ca03..bd86a90 100644 --- a/internal/cephfsnative/client_ceph.go +++ b/internal/cephfsnative/client_ceph.go @@ -55,7 +55,7 @@ import ( "time" "unsafe" - "CephMig/internal/storage" + "git.zb-server.de/Sebi/CephfsMig/internal/storage" ) type Client struct{ mount *C.struct_ceph_mount_info } diff --git a/internal/migration/native_access.go b/internal/migration/native_access.go index bf637c0..52256e4 100644 --- a/internal/migration/native_access.go +++ b/internal/migration/native_access.go @@ -13,7 +13,7 @@ import ( "strings" "syscall" - "CephMig/internal/storage" + "git.zb-server.de/Sebi/CephfsMig/internal/storage" ) type nativeAccess struct{ backend *nativeTransport } diff --git a/internal/migration/native_data.go b/internal/migration/native_data.go index 00b79e1..5897ac4 100644 --- a/internal/migration/native_data.go +++ b/internal/migration/native_data.go @@ -10,7 +10,7 @@ import ( "syscall" "time" - "CephMig/internal/storage" + "git.zb-server.de/Sebi/CephfsMig/internal/storage" ) func readNativeAt(f storage.File, b []byte, offset int64) error { diff --git a/internal/migration/native_factory_ceph.go b/internal/migration/native_factory_ceph.go index 3b798a3..2603d6c 100644 --- a/internal/migration/native_factory_ceph.go +++ b/internal/migration/native_factory_ceph.go @@ -6,7 +6,7 @@ import ( "context" "io" - "CephMig/internal/cephfsnative" + "git.zb-server.de/Sebi/CephfsMig/internal/cephfsnative" ) func openNativeEngine(ctx context.Context, c Config, x Executor, log io.Writer) (Engine, io.Closer, error) { diff --git a/internal/migration/native_helpers.go b/internal/migration/native_helpers.go index 67e5311..45b92f4 100644 --- a/internal/migration/native_helpers.go +++ b/internal/migration/native_helpers.go @@ -10,7 +10,7 @@ import ( "strings" "syscall" - "CephMig/internal/storage" + "git.zb-server.de/Sebi/CephfsMig/internal/storage" ) func walkNative(ctx context.Context, fs storage.FS, root string, visit func(string, storage.Node, int) error) error { diff --git a/internal/migration/native_inventory_test.go b/internal/migration/native_inventory_test.go index 7f5f0f5..1d3154b 100644 --- a/internal/migration/native_inventory_test.go +++ b/internal/migration/native_inventory_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "CephMig/internal/storage" + "git.zb-server.de/Sebi/CephfsMig/internal/storage" ) type inventorySourceFS struct { diff --git a/internal/migration/native_test.go b/internal/migration/native_test.go index d05f460..d1105c1 100644 --- a/internal/migration/native_test.go +++ b/internal/migration/native_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "CephMig/internal/storage" + "git.zb-server.de/Sebi/CephfsMig/internal/storage" ) type emptyNativeDiff struct{} diff --git a/internal/migration/native_transport.go b/internal/migration/native_transport.go index e1adca1..f777760 100644 --- a/internal/migration/native_transport.go +++ b/internal/migration/native_transport.go @@ -16,7 +16,7 @@ import ( "syscall" "time" - "CephMig/internal/storage" + "git.zb-server.de/Sebi/CephfsMig/internal/storage" ) const nativeChunk = 4 << 20