Skip to content

Commit

Permalink
Verbose to list symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
peteraba committed Jun 14, 2020
1 parent bc6aa2f commit d4c9c75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
17 changes: 0 additions & 17 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,6 @@ before:
builds:
- env:
- CGO_ENABLED=0
- goos:
- android
- darwin
- freebsd
- linux
- netbsd
- openbsd
- plan9
- solaris
- windows
- goarch:
- 386
- amd64
- arm
- goarm:
- 6
- 7
archives:
- replacements:
darwin: Darwin
Expand Down
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"sync"
)

const version = "0.4.4"
const version = "0.4.5"

func getFlags() (bool, int, bool, string, string, bool) {
var (
Expand Down Expand Up @@ -56,12 +56,12 @@ func main() {
root = "."
}

filesizes, err := getAllFilesizes(root)
filesizes, err := getAllFilesizes(root, verbose)
if err != nil {
fmt.Printf("filepath.Walk() returned an error: %v\n", err)
return
} else {
fmt.Printf("Found %d unique filenames\n", len(filesizes))
fmt.Printf("Found %d unique file sizes\n", len(filesizes))
}

sameSizeFiles, count := filterSameSizeFiles(filesizes)
Expand All @@ -88,7 +88,7 @@ func main() {
}

// getAllFilesizes scans the root directory recursively and returns the path of each file found
func getAllFilesizes(root string) (map[int64][]string, error) {
func getAllFilesizes(root string, verbose bool) (map[int64][]string, error) {
filesizes := make(map[int64][]string)

visit := func(path string, f os.FileInfo, err error) error {
Expand All @@ -101,6 +101,9 @@ func getAllFilesizes(root string) (map[int64][]string, error) {
panic(err2)
}
if p != path {
if verbose {
log.Printf("symlink found: %s <-> %s\n", p, path)
}
return nil
}

Expand Down

0 comments on commit d4c9c75

Please sign in to comment.