can't install #157

Closed
opened 2026-11-10 20:16:08 +01:00 by sneak · 4 comments
Owner
root@las1stor1:~# go install -v sneak.berlin/go/sfdupes/cmd/sfdupes@latest
go: downloading sneak.berlin/go/sfdupes v0.0.3
go: sneak.berlin/go/sfdupes@v0.0.3 requires go >= 1.25.7; switching to go1.26.10
go: sneak.berlin/go/sfdupes/cmd/sfdupes@latest: module sneak.berlin/go/sfdupes@latest found (v0.0.3), but does not contain package sneak.berlin/go/sfdupes/cmd/sfdupes
root@las1stor1:~#
``` root@las1stor1:~# go install -v sneak.berlin/go/sfdupes/cmd/sfdupes@latest go: downloading sneak.berlin/go/sfdupes v0.0.3 go: sneak.berlin/go/sfdupes@v0.0.3 requires go >= 1.25.7; switching to go1.26.10 go: sneak.berlin/go/sfdupes/cmd/sfdupes@latest: module sneak.berlin/go/sfdupes@latest found (v0.0.3), but does not contain package sneak.berlin/go/sfdupes/cmd/sfdupes root@las1stor1:~# ```
Collaborator

Why it fails

  • No ref has a cmd/sfdupes directory. v0.0.3, main and next all build the command from package main in the repository root, and README "Install" on all three says go install sneak.berlin/go/sfdupes@latest.
  • cmd/sfdupes is where the repo's own rules put it: REPO_POLICIES.md (root layout: "cmd/ — Go command entrypoints; thin only") and CODE_STYLEGUIDE_GO.md ("Binaries go in cmd/ directories", "main.go whose body is one call into library code"). The repo breaks those rules; this issue fixes that.
  • @latest is the newest release tag, v0.0.3 (2026-10-22). Go skips v1.0.0-rc1 and v1.0.0-rc2 as prereleases. cmd/sfdupes@latest works only once a tag contains the move; that goes to the owner separately.

For the implementer

Read in full first: REPO_POLICIES.md in this repo (the root layout list) and https://git.eeqj.de/sneak/prompts/src/branch/main/prompts/CODE_STYLEGUIDE_GO.md (the cmd/, internal/ and main items). Scope is the layout of the Go code only.

  1. git mv every .go file in the root, tests included, into internal/sfdupes/, package sfdupes. main.go becomes internal/sfdupes/cli.go and main_test.go becomes internal/sfdupes/cli_test.go; every other file keeps its name. One package: splitting the program into more packages is not this issue.
  2. Package doc in internal/sfdupes/cli.go: one or two sentences saying the package implements the sfdupes command and the database its subcommands share.
  3. In internal/sfdupes/cli.go, an exported Main() int returns run(os.Args[1:], os.Stdout, os.Stderr) and carries the existing SIGPIPE comment. run stays unexported, so the tests' calls to it do not change.
  4. New cmd/sfdupes/main.go, package main: the "Command sfdupes ..." doc comment from the old main.go, and func main() { os.Exit(sfdupes.Main()) }. Nothing else.
  5. Version stays a package variable, now in internal/sfdupes. Makefile: LDFLAGS := -X sneak.berlin/go/sfdupes/internal/sfdupes.Version=$(VERSION) and go build -ldflags "$(LDFLAGS)" -o $(BINARY) ./cmd/sfdupes. make build still writes ./sfdupes.
  6. Do not change .golangci.yml. Dockerfile, .gitignore and .dockerignore change only if the build needs it.
  7. README "Install": both commands become go install sneak.berlin/go/sfdupes/cmd/sfdupes@latest and go install sneak.berlin/go/sfdupes/cmd/sfdupes@main. The sentence "For @latest that is a release tag such as v0.0.3" drops the example tag, since v0.0.3 predates the move. Every other place in README.md and TODO.md that names a moved file or the old install path is updated. Record the change in TODO.md the way it records finished work.
  8. No test assertion changes. A test that reads a file by a root-relative path is fixed to the new relative path.
  9. Edit by hand with the editor; format only through make fmt.

Definition of done

  • cmd/sfdupes/main.go is the only package main; no .go file is left in the root.
  • In a throwaway golang container with an empty GOPATH, go install sneak.berlin/go/sfdupes/cmd/sfdupes@<PR head commit> installs a binary whose --version prints that commit's pseudo-version.
  • make build writes ./sfdupes whose --version prints the git describe version, so the linker flag still reaches Version.
  • make check passes. PR base next, labelled needs-review, title ending (closes #157).

Model: opus-5-5

## Why it fails - No ref has a `cmd/sfdupes` directory. `v0.0.3`, `main` and `next` all build the command from `package main` in the repository root, and README "Install" on all three says `go install sneak.berlin/go/sfdupes@latest`. - `cmd/sfdupes` is where the repo's own rules put it: `REPO_POLICIES.md` (root layout: "`cmd/` — Go command entrypoints; thin only") and `CODE_STYLEGUIDE_GO.md` ("Binaries go in `cmd/` directories", "`main.go` whose body is one call into library code"). The repo breaks those rules; this issue fixes that. - `@latest` is the newest release tag, `v0.0.3` (2026-10-22). Go skips `v1.0.0-rc1` and `v1.0.0-rc2` as prereleases. `cmd/sfdupes@latest` works only once a tag contains the move; that goes to the owner separately. ## For the implementer Read in full first: `REPO_POLICIES.md` in this repo (the root layout list) and https://git.eeqj.de/sneak/prompts/src/branch/main/prompts/CODE_STYLEGUIDE_GO.md (the `cmd/`, `internal/` and `main` items). Scope is the layout of the Go code only. 1. `git mv` every `.go` file in the root, tests included, into `internal/sfdupes/`, package `sfdupes`. `main.go` becomes `internal/sfdupes/cli.go` and `main_test.go` becomes `internal/sfdupes/cli_test.go`; every other file keeps its name. One package: splitting the program into more packages is not this issue. 2. Package doc in `internal/sfdupes/cli.go`: one or two sentences saying the package implements the sfdupes command and the database its subcommands share. 3. In `internal/sfdupes/cli.go`, an exported `Main() int` returns `run(os.Args[1:], os.Stdout, os.Stderr)` and carries the existing SIGPIPE comment. `run` stays unexported, so the tests' calls to it do not change. 4. New `cmd/sfdupes/main.go`, package `main`: the "Command sfdupes ..." doc comment from the old `main.go`, and `func main() { os.Exit(sfdupes.Main()) }`. Nothing else. 5. `Version` stays a package variable, now in `internal/sfdupes`. `Makefile`: `LDFLAGS := -X sneak.berlin/go/sfdupes/internal/sfdupes.Version=$(VERSION)` and `go build -ldflags "$(LDFLAGS)" -o $(BINARY) ./cmd/sfdupes`. `make build` still writes `./sfdupes`. 6. Do not change `.golangci.yml`. `Dockerfile`, `.gitignore` and `.dockerignore` change only if the build needs it. 7. README "Install": both commands become `go install sneak.berlin/go/sfdupes/cmd/sfdupes@latest` and `go install sneak.berlin/go/sfdupes/cmd/sfdupes@main`. The sentence "For `@latest` that is a release tag such as `v0.0.3`" drops the example tag, since `v0.0.3` predates the move. Every other place in `README.md` and `TODO.md` that names a moved file or the old install path is updated. Record the change in `TODO.md` the way it records finished work. 8. No test assertion changes. A test that reads a file by a root-relative path is fixed to the new relative path. 9. Edit by hand with the editor; format only through `make fmt`. ## Definition of done - `cmd/sfdupes/main.go` is the only `package main`; no `.go` file is left in the root. - In a throwaway `golang` container with an empty `GOPATH`, `go install sneak.berlin/go/sfdupes/cmd/sfdupes@<PR head commit>` installs a binary whose `--version` prints that commit's pseudo-version. - `make build` writes `./sfdupes` whose `--version` prints the `git describe` version, so the linker flag still reaches `Version`. - `make check` passes. PR base `next`, labelled `needs-review`, title ending `(closes #157)`. Model: opus-5-5
Author
Owner

definition of done is that go install -v sneak.berlin/go/sfdupes/cmd/sfdupes@latest works to install main.

definition of done is that `go install -v sneak.berlin/go/sfdupes/cmd/sfdupes@latest` works to install `main`.
Collaborator

Built in #158 as planned above: cmd/sfdupes/main.go calls sfdupes.Main() in internal/sfdupes, the Makefile sets Version by its new import path, and README and TODO.md give the new paths.

One addition the plan did not foresee: testpackage now flags the in-package tests, which it allowed only in package main. Each test file carries //nolint:testpackage with a reason, as vaultik does; .golangci.yml is unchanged.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/sfdupes/pulls/158 as planned above: `cmd/sfdupes/main.go` calls `sfdupes.Main()` in `internal/sfdupes`, the `Makefile` sets `Version` by its new import path, and README and `TODO.md` give the new paths. One addition the plan did not foresee: `testpackage` now flags the in-package tests, which it allowed only in `package main`. Each test file carries `//nolint:testpackage` with a reason, as `vaultik` does; `.golangci.yml` is unchanged. Model: opus-5-5
Collaborator

The command is at cmd/sfdupes on next now (#158), and go install -v sneak.berlin/go/sfdupes/cmd/sfdupes@next installs it today.

@latest still fails, because Go reads it as the newest release tag. That is v0.0.3, which has no cmd/sfdupes; the v1.0.0-rc tags are prereleases, which Go skips. To finish this issue:

  • Merge #159 (next into main).
  • Tag v0.0.4 on the merge commit that puts on main. That tag gives go install -v sneak.berlin/go/sfdupes/cmd/sfdupes@latest a package to install, and it is main's tip.

Model: opus-5-5

The command is at `cmd/sfdupes` on `next` now (https://git.eeqj.de/sneak/sfdupes/pulls/158), and `go install -v sneak.berlin/go/sfdupes/cmd/sfdupes@next` installs it today. `@latest` still fails, because Go reads it as the newest release tag. That is `v0.0.3`, which has no `cmd/sfdupes`; the `v1.0.0-rc` tags are prereleases, which Go skips. To finish this issue: - Merge https://git.eeqj.de/sneak/sfdupes/pulls/159 (`next` into `main`). - Tag `v0.0.4` on the merge commit that puts on `main`. That tag gives `go install -v sneak.berlin/go/sfdupes/cmd/sfdupes@latest` a package to install, and it is `main`'s tip. Model: opus-5-5
sneak was assigned by clawbot 2026-11-10 21:18:34 +01:00
clawbot reopened this issue 2026-11-10 21:18:39 +01:00
sneak closed this issue 2026-11-10 23:12:04 +01:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/sfdupes#157