Move the command to cmd/sfdupes and the code to internal/sfdupes (closes #157)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
`go install sneak.berlin/go/sfdupes/cmd/sfdupes@...` found no package: the command was built from `package main` in the repository root. It now lives in `cmd/sfdupes/main.go`, whose one call is `sfdupes.Main()`, and every other Go file moved with `git mv` to `internal/sfdupes`, as `REPO_POLICIES.md` and the Go style guide require. The `Makefile` builds `./cmd/sfdupes` and sets `Version` by its new import path. README "Install" and `TODO.md` give the new paths; the fleet-written "flat layout" divergence is gone. Rule suppressed: each test file carries `//nolint:testpackage`, since the tests call unexported functions throughout. Model: opus-5-5
This commit was merged in pull request #158.
This commit is contained in:
1 parent
7cb10ed303
commit
1017332d68
27 files changed
+120
-96
No files matched your search
@@ -0,0 +1,36 @@
|
||||
//go:build !darwin
|
||||
|
||||
package sfdupes
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// mountInfoPath is the file in which Linux lists the mounts the reading
|
||||
// process sees.
|
||||
const mountInfoPath = "/proc/self/mountinfo"
|
||||
|
||||
// nonPersistentFilesystems returns the device ID of every mounted
|
||||
// filesystem that is not persistent, with its type: on Linux read from
|
||||
// mountInfoPath (see readMountInfo), and on any other system none.
|
||||
func nonPersistentFilesystems() (map[uint64]string, error) {
|
||||
if runtime.GOOS != goosLinux {
|
||||
return map[uint64]string{}, nil
|
||||
}
|
||||
|
||||
f, err := os.Open(mountInfoPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
devices, err := readMountInfo(f)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read %s: %w", mountInfoPath, err)
|
||||
}
|
||||
|
||||
return devices, nil
|
||||
}
|
||||
Reference in new issue
Block a user