mirror of
				https://github.com/JaCoB1123/dupe-finder.git
				synced 2025-11-04 12:38:29 +01:00 
			
		
		
		
	Rename variable
This commit is contained in:
		
							
								
								
									
										12
									
								
								filesmap.go
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								filesmap.go
									
									
									
									
									
								
							@@ -13,8 +13,6 @@ func (fm *FilesMap) Add(path string, info os.FileInfo) error {
 | 
				
			|||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fileInfo := path
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	filesByHash := fm.FilesBySize[info.Size()]
 | 
						filesByHash := fm.FilesBySize[info.Size()]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// first file with same size
 | 
						// first file with same size
 | 
				
			||||||
@@ -22,7 +20,7 @@ func (fm *FilesMap) Add(path string, info os.FileInfo) error {
 | 
				
			|||||||
	if filesByHash == nil {
 | 
						if filesByHash == nil {
 | 
				
			||||||
		filesByHash = map[string][]string{}
 | 
							filesByHash = map[string][]string{}
 | 
				
			||||||
		fm.FilesBySize[info.Size()] = filesByHash
 | 
							fm.FilesBySize[info.Size()] = filesByHash
 | 
				
			||||||
		filesByHash[""] = []string{fileInfo}
 | 
							filesByHash[""] = []string{path}
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -45,17 +43,17 @@ func (fm *FilesMap) Add(path string, info os.FileInfo) error {
 | 
				
			|||||||
	return appendByFileHash(filesByHash, fileInfo)
 | 
						return appendByFileHash(filesByHash, fileInfo)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func appendByFileHash(filesByHash map[string][]string, fileInfo string) error {
 | 
					func appendByFileHash(filesByHash map[string][]string, path string) error {
 | 
				
			||||||
	hash, err := calculateHash(fileInfo)
 | 
						hash, err := calculateHash(path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if _, ok := filesByHash[hash]; ok {
 | 
						if _, ok := filesByHash[hash]; ok {
 | 
				
			||||||
		filesByHash[hash] = append(filesByHash[hash], fileInfo)
 | 
							filesByHash[hash] = append(filesByHash[hash], path)
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		filesByHash[hash] = []string{fileInfo}
 | 
							filesByHash[hash] = []string{path}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user