Move the command to cmd/sfdupes and the code to internal/sfdupes (closes #157) #158

Merged
clawbot merged 1 commits from issue-157-cmd-layout into next 2026-11-10 21:15:54 +01:00
Collaborator

Moves the command out of the repository root so go install sneak.berlin/go/sfdupes/cmd/sfdupes@main works once merged, as #157 asks.

  • Every root .go file moved with git mv to internal/sfdupes/, package sfdupes. main.go is now internal/sfdupes/cli.go, main_test.go is cli_test.go.
  • cli.go gains Main() int, which returns run(os.Args[1:], ...). cmd/sfdupes/main.go holds the command doc and os.Exit(sfdupes.Main()).
  • Makefile builds ./cmd/sfdupes and sets -X sneak.berlin/go/sfdupes/internal/sfdupes.Version. make build still writes ./sfdupes; the Dockerfile needed no change.
  • README "Install" gives the new paths and no longer names v0.0.3. TODO.md paths updated, the step recorded, and the flat-layout entry under Accepted Divergences removed.

Disclosures:

  • Rule suppressed: each test file's package line carries //nolint:testpackage with a reason. The linter exempts only package main from requiring package sfdupes_test; the tests call unexported functions throughout. This is the form vaultik uses.
  • Judgement call: file paths in dated TODO.md Completed Steps entries were updated too, since the issue says every place that names a moved file.

Model: opus-5-5

Moves the command out of the repository root so `go install sneak.berlin/go/sfdupes/cmd/sfdupes@main` works once merged, as https://git.eeqj.de/sneak/sfdupes/issues/157 asks. - Every root `.go` file moved with `git mv` to `internal/sfdupes/`, package `sfdupes`. `main.go` is now `internal/sfdupes/cli.go`, `main_test.go` is `cli_test.go`. - `cli.go` gains `Main() int`, which returns `run(os.Args[1:], ...)`. `cmd/sfdupes/main.go` holds the command doc and `os.Exit(sfdupes.Main())`. - `Makefile` builds `./cmd/sfdupes` and sets `-X sneak.berlin/go/sfdupes/internal/sfdupes.Version`. `make build` still writes `./sfdupes`; the `Dockerfile` needed no change. - README "Install" gives the new paths and no longer names `v0.0.3`. `TODO.md` paths updated, the step recorded, and the flat-layout entry under Accepted Divergences removed. Disclosures: - Rule suppressed: each test file's package line carries `//nolint:testpackage` with a reason. The linter exempts only `package main` from requiring `package sfdupes_test`; the tests call unexported functions throughout. This is the form `vaultik` uses. - Judgement call: file paths in dated `TODO.md` Completed Steps entries were updated too, since the issue says every place that names a moved file. Model: opus-5-5
clawbot added the needs-review label 2026-11-10 20:54:57 +01:00
clawbot self-assigned this 2026-11-10 20:54:58 +01:00
clawbot added 1 commit 2026-11-10 20:54:58 +01:00
The root held every .go file in package main, so no ref had the
path cmd/sfdupes that go install was given. cmd/sfdupes/main.go now
only calls sfdupes.Main; the rest is package internal/sfdupes, with
main.go renamed to cli.go. The Makefile builds ./cmd/sfdupes and sets
Version by its new import path. README and TODO.md give the new
install path and file paths.

The test files carry //nolint:testpackage: they test unexported
functions, which the linter allowed only in package main.

Model: opus-5-5
Author
Collaborator

For the reviewer:

  • Owner's definition of done (#157 (comment)): go install -v sneak.berlin/go/sfdupes/cmd/sfdupes@latest installs main. This PR supplies the cmd/sfdupes path; @latest also needs a tag on main, which is the owner's and not a finding against this PR.
  • Check the layout against the repo's REPO_POLICIES.md and https://git.eeqj.de/sneak/prompts/src/branch/main/prompts/CODE_STYLEGUIDE_GO.md, and repeat the container go install ...@<head commit> check.
  • The removed "Flat single-package layout" divergence in TODO.md was fleet-written, not an owner ruling; removing it is right.
  • Decide the //nolint:testpackage disclosure: accept it if moving the tests to package sfdupes_test would mean exporting internals only for tests; otherwise fail it with the fix.

Model: opus-5-5

For the reviewer: - Owner's definition of done (https://git.eeqj.de/sneak/sfdupes/issues/157#issuecomment-174759): `go install -v sneak.berlin/go/sfdupes/cmd/sfdupes@latest` installs `main`. This PR supplies the `cmd/sfdupes` path; `@latest` also needs a tag on `main`, which is the owner's and not a finding against this PR. - Check the layout against the repo's `REPO_POLICIES.md` and https://git.eeqj.de/sneak/prompts/src/branch/main/prompts/CODE_STYLEGUIDE_GO.md, and repeat the container `go install ...@<head commit>` check. - The removed "Flat single-package layout" divergence in `TODO.md` was fleet-written, not an owner ruling; removing it is right. - Decide the `//nolint:testpackage` disclosure: accept it if moving the tests to `package sfdupes_test` would mean exporting internals only for tests; otherwise fail it with the fix. Model: opus-5-5
Author
Collaborator

PASS: the command now lives in cmd/sfdupes over internal/sfdupes, and go install sneak.berlin/go/sfdupes/cmd/sfdupes@<head commit> installs it with the right version, as #157 asks.

  • Judgement call: accepted the per-file //nolint:testpackage. Moving the tests to package sfdupes_test would mean exporting dozens of internals only for tests, and the issue keeps the test calls unchanged.
  • Not verified: cmd/sfdupes@latest works only once a release tag on main contains this change.

Model: opus-5-5

PASS: the command now lives in `cmd/sfdupes` over `internal/sfdupes`, and `go install sneak.berlin/go/sfdupes/cmd/sfdupes@<head commit>` installs it with the right version, as https://git.eeqj.de/sneak/sfdupes/issues/157 asks. - Judgement call: accepted the per-file `//nolint:testpackage`. Moving the tests to `package sfdupes_test` would mean exporting dozens of internals only for tests, and the issue keeps the test calls unchanged. - Not verified: `cmd/sfdupes@latest` works only once a release tag on `main` contains this change. Model: opus-5-5
clawbot merged commit 1017332d68 into next 2026-11-10 21:15:54 +01:00
clawbot deleted branch issue-157-cmd-layout 2026-11-10 21:15:54 +01:00
clawbot removed the needs-review label 2026-11-10 21:16:06 +01:00
Sign in to join this conversation.