@@ -161,7 +161,7 @@ func UpdateRepoLicenses(ctx context.Context, repo *repo_model.Repository, commit
161161 return nil
162162 }
163163
164- _ , licenseFile , err := findLicenseFile (commit )
164+ licenseFile , err := findLicenseFile (commit )
165165 if err != nil {
166166 return fmt .Errorf ("findLicenseFile: %w" , err )
167167 }
@@ -187,7 +187,7 @@ func GetDetectedLicenseFileName(ctx context.Context, repo *repo_model.Repository
187187 if commit == nil {
188188 return "" , nil
189189 }
190- _ , licenseFile , err := findLicenseFile (commit )
190+ licenseFile , err := findLicenseFile (commit )
191191 if err != nil {
192192 return "" , fmt .Errorf ("findLicenseFile: %w" , err )
193193 }
@@ -198,15 +198,16 @@ func GetDetectedLicenseFileName(ctx context.Context, repo *repo_model.Repository
198198}
199199
200200// findLicenseFile returns the entry of license file in the repository if it exists
201- func findLicenseFile (commit * git.Commit ) (string , * git.TreeEntry , error ) {
201+ func findLicenseFile (commit * git.Commit ) (* git.TreeEntry , error ) {
202202 if commit == nil {
203- return "" , nil , nil
203+ return nil , nil
204204 }
205205 entries , err := commit .ListEntries ()
206206 if err != nil {
207- return "" , nil , fmt .Errorf ("ListEntries: %w" , err )
207+ return nil , fmt .Errorf ("ListEntries: %w" , err )
208208 }
209- return FindFileInEntries (util .FileTypeLicense , entries , "" , "" , false )
209+ _ , f , err := FindFileInEntries (util .FileTypeLicense , entries , "" , "" , false )
210+ return f , err
210211}
211212
212213// detectLicense returns the licenses detected by the given content buff
0 commit comments