Skip to content

Commit a398de4

Browse files
committed
Use the correct log function
Switch from log.Printf to log.Println when there's only constant strings to be displayed
1 parent 96c7260 commit a398de4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

get/syncer.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,20 @@ func (r *Syncer) StoreRepo() (err error) {
152152
_, checksumError := err.(*util.ChecksumError)
153153
if checksumError {
154154
log.Println(err.Error())
155-
log.Printf("Checksum did not match, presumably the repo was published while syncing, retrying...\n")
155+
log.Println("Checksum did not match, presumably the repo was published while syncing, retrying...")
156156
continue
157157
}
158158

159159
_, signatureError := err.(*SignatureError)
160160
if signatureError {
161161
log.Println(err.Error())
162-
log.Printf("Signature not valid, presumably the repo was published while syncing, retrying...\n")
162+
log.Println("Signature not valid, presumably the repo was published while syncing, retrying...")
163163
} else {
164164
return err
165165
}
166166
}
167167

168-
log.Printf("Too many temporary errors, aborting...\n")
168+
log.Println("Too many temporary errors, aborting...")
169169
return err
170170
}
171171

@@ -195,7 +195,7 @@ func (r *Syncer) storeRepo(checksumMap map[string]XMLChecksum) (err error) {
195195
}
196196
}
197197

198-
log.Printf("Committing changes...\n")
198+
log.Println("Committing changes...")
199199
err = r.storage.Commit()
200200
if err != nil {
201201
return
@@ -206,7 +206,7 @@ func (r *Syncer) storeRepo(checksumMap map[string]XMLChecksum) (err error) {
206206
// downloadStoreApply downloads a repo-relative path into a file, while applying a ReaderConsumer
207207
func (r *Syncer) downloadStoreApply(relativePath string, checksum string, description string, hash crypto.Hash, f util.ReaderConsumer) error {
208208
log.Printf("Downloading %v...", description)
209-
//log.Printf("SYNCER: %v\n", r)
209+
210210
url := r.URL
211211
url.Path = path.Join(r.URL.Path, relativePath)
212212
body, err := ReadURL(url.String())
@@ -237,20 +237,20 @@ func (r *Syncer) processMetadata(checksumMap map[string]XMLChecksum) (packagesTo
237237

238238
data := repomd.Data
239239
for i := 0; i < len(data); i++ {
240-
log.Printf(data[i].Location.Href)
240+
log.Println(data[i].Location.Href)
241241
metadataLocation := data[i].Location.Href
242242
metadataChecksum := data[i].Checksum
243243

244244
decision := r.decide(metadataLocation, metadataChecksum, checksumMap)
245245
switch decision {
246246
case Download:
247-
log.Printf("...downloading")
247+
log.Println("...downloading")
248248
err = r.downloadStoreApply(metadataLocation, metadataChecksum.Checksum, path.Base(metadataLocation), hashMap[metadataChecksum.Type], util.Nop)
249249
if err != nil {
250250
return
251251
}
252252
case Recycle:
253-
log.Printf("...recycling")
253+
log.Println("...recycling")
254254
r.storage.Recycle(metadataLocation)
255255
}
256256

@@ -267,7 +267,7 @@ func (r *Syncer) processMetadata(checksumMap map[string]XMLChecksum) (packagesTo
267267
})
268268
if err != nil {
269269
log.Println(err.Error())
270-
log.Printf("Fallback to next repo type")
270+
log.Println("Fallback to next repo type")
271271
// attempt to download Debian's Release file
272272
err = r.downloadStoreApply(releasePath, "", path.Base(releasePath), 0, func(reader io.ReadCloser) (err error) {
273273
err = doProcessMetadata(reader, repoTypes["deb"])
@@ -298,7 +298,7 @@ func (r *Syncer) checkRepomdSignature(repomdReader io.Reader, repoType RepoType)
298298
if err != nil {
299299
uerr, unexpectedStatusCode := err.(*UnexpectedStatusCodeError)
300300
if unexpectedStatusCode && uerr.StatusCode == 404 {
301-
log.Printf("Got 404, ignoring...")
301+
log.Println("Got 404, ignoring...")
302302
err = nil
303303
}
304304
}
@@ -307,7 +307,7 @@ func (r *Syncer) checkRepomdSignature(repomdReader io.Reader, repoType RepoType)
307307
if err != nil {
308308
uerr, unexpectedStatusCode := err.(*UnexpectedStatusCodeError)
309309
if unexpectedStatusCode && uerr.StatusCode == 404 {
310-
log.Printf("Got 404, ignoring...")
310+
log.Println("Got 404, ignoring...")
311311
err = nil
312312
}
313313
}

0 commit comments

Comments
 (0)