Enable stricter linting with golangci-lint (#316)

* update golangci-lint

* add golangci config file w/ more linters

* correct issues flagged by stricter linters

* add more generous timeout for golangci-lint

* add some style + formatting guidelines

* move timeout to config file

* go fmt
This commit is contained in:
tobi 2021-11-22 08:46:19 +01:00 committed by GitHub
commit f8630348b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 227 additions and 163 deletions

View file

@ -172,7 +172,7 @@ pageLoop:
l.Debugf("dereferencing page %s", currentPageIRI)
nextPage, err := d.DereferenceCollectionPage(ctx, username, currentPageIRI)
if err != nil {
return nil
return err
}
// next items could be either a list of URLs or a list of statuses
@ -188,19 +188,19 @@ pageLoop:
// We're looking for a url to feed to GetRemoteStatus.
// Items can be either an IRI, or a Note.
// If a note, we grab the ID from it and call it, rather than parsing the note.
var itemURI *url.URL
if iter.IsIRI() {
switch {
case iter.IsIRI():
// iri, easy
itemURI = iter.GetIRI()
} else if iter.IsActivityStreamsNote() {
case iter.IsActivityStreamsNote():
// note, get the id from it to use as iri
n := iter.GetActivityStreamsNote()
id := n.GetJSONLDId()
if id != nil && id.IsIRI() {
itemURI = id.GetIRI()
}
} else {
default:
// if it's not an iri or a note, we don't know how to process it
continue
}
@ -211,7 +211,7 @@ pageLoop:
}
// we can confidently say now that we found something
foundReplies = foundReplies + 1
foundReplies++
// get the remote statusable and put it in the db
_, statusable, new, err := d.GetRemoteStatus(ctx, username, itemURI, false, false)