1
0
Fork 0

Fix some linter issues

This commit is contained in:
Frédéric Guillot 2022-08-08 21:33:38 -07:00
parent 3eb3ac06b6
commit cecab91298
69 changed files with 73 additions and 176 deletions

View file

@ -17,3 +17,12 @@ updates:
- "fguillot"
assignees:
- "fguillot"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
reviewers:
- "fguillot"
assignees:
- "fguillot"

View file

@ -14,7 +14,7 @@ jobs:
max-parallel: 4
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
go-version: [1.16, 1.17, 1.18]
go-version: [1.18, 1.19]
steps:
- name: Set up Go
uses: actions/setup-go@v2
@ -42,7 +42,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.19
- name: Checkout
uses: actions/checkout@v2
- name: Install Postgres client

View file

@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.19
- uses: golangci/golangci-lint-action@v2
with:
args: --skip-dirs tests --disable errcheck --enable sqlclosecheck --enable misspell --enable gofmt --enable goimports --enable whitespace

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package cli implements command line arguments for Miniflux application.
*/
package cli // import "miniflux.app/cli"

View file

@ -3,10 +3,9 @@
// license that can be found in the LICENSE file.
/*
Package client implements a client library for the Miniflux REST API.
Examples
# Examples
This code snippet fetch the list of users:
@ -30,6 +29,5 @@ This one discover subscriptions on a website:
return
}
fmt.Println(subscriptions)
*/
package client // import "miniflux.app/client"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package config handles configuration management for the application.
*/
package config // import "miniflux.app/config"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package crypto implements helpers related to cryptography.
*/
package crypto // import "miniflux.app/crypto"

2
doc.go
View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Miniflux is a feed reader application.
*/
package main // import "miniflux.app"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package errors handles localized errors.
*/
package errors // import "miniflux.app/errors"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package fever implements Fever API endpoints.
*/
package fever // import "miniflux.app/fever"

View file

@ -61,13 +61,13 @@ func (h *handler) serve(w http.ResponseWriter, r *http.Request) {
/*
A request with the groups argument will return two additional members:
groups contains an array of group objects
feeds_groups contains an array of feeds_group objects
groups contains an array of group objects
feeds_groups contains an array of feeds_group objects
A group object has the following members:
id (positive integer)
title (utf-8 string)
id (positive integer)
title (utf-8 string)
The feeds_group object is documented under Feeds/Groups Relationships.
@ -76,7 +76,6 @@ an is_spark equal to 0.
The Sparks super group is not included in this response and is composed of all feeds with an
is_spark equal to 1.
*/
func (h *handler) handleGroups(w http.ResponseWriter, r *http.Request) {
userID := request.UserID(r)
@ -107,18 +106,18 @@ func (h *handler) handleGroups(w http.ResponseWriter, r *http.Request) {
/*
A request with the feeds argument will return two additional members:
feeds contains an array of group objects
feeds_groups contains an array of feeds_group objects
feeds contains an array of group objects
feeds_groups contains an array of feeds_group objects
A feed object has the following members:
id (positive integer)
favicon_id (positive integer)
title (utf-8 string)
url (utf-8 string)
site_url (utf-8 string)
is_spark (boolean integer)
last_updated_on_time (Unix timestamp/integer)
id (positive integer)
favicon_id (positive integer)
title (utf-8 string)
url (utf-8 string)
site_url (utf-8 string)
is_spark (boolean integer)
last_updated_on_time (Unix timestamp/integer)
The feeds_group object is documented under Feeds/Groups Relationships.
@ -165,12 +164,12 @@ func (h *handler) handleFeeds(w http.ResponseWriter, r *http.Request) {
/*
A request with the favicons argument will return one additional member:
favicons contains an array of favicon objects
favicons contains an array of favicon objects
A favicon object has the following members:
id (positive integer)
data (base64 encoded image data; prefixed by image type)
id (positive integer)
data (base64 encoded image data; prefixed by image type)
An example data value:
@ -206,20 +205,20 @@ func (h *handler) handleFavicons(w http.ResponseWriter, r *http.Request) {
/*
A request with the items argument will return two additional members:
items contains an array of item objects
total_items contains the total number of items stored in the database (added in API version 2)
items contains an array of item objects
total_items contains the total number of items stored in the database (added in API version 2)
An item object has the following members:
id (positive integer)
feed_id (positive integer)
title (utf-8 string)
author (utf-8 string)
html (utf-8 string)
url (utf-8 string)
is_saved (boolean integer)
is_read (boolean integer)
created_on_time (Unix timestamp/integer)
id (positive integer)
feed_id (positive integer)
title (utf-8 string)
author (utf-8 string)
html (utf-8 string)
url (utf-8 string)
is_saved (boolean integer)
is_read (boolean integer)
created_on_time (Unix timestamp/integer)
Most servers wont have enough memory allocated to PHP to dump all items at once.
Three optional arguments control determine the items included in the response.
@ -232,7 +231,6 @@ Three optional arguments control determine the items included in the response.
Use the with_ids argument with a comma-separated list of item ids to request (a maximum of 50) specific items.
(added in API version 2)
*/
func (h *handler) handleItems(w http.ResponseWriter, r *http.Request) {
var result itemsResponse
@ -327,7 +325,8 @@ The unread_item_ids and saved_item_ids arguments can be used to keep your local
with the remote Fever installation.
A request with the unread_item_ids argument will return one additional member:
unread_item_ids (string/comma-separated list of positive integers)
unread_item_ids (string/comma-separated list of positive integers)
*/
func (h *handler) handleUnreadItems(w http.ResponseWriter, r *http.Request) {
userID := request.UserID(r)
@ -384,9 +383,9 @@ func (h *handler) handleSavedItems(w http.ResponseWriter, r *http.Request) {
}
/*
mark=item
as=? where ? is replaced with read, saved or unsaved
id=? where ? is replaced with the id of the item to modify
mark=item
as=? where ? is replaced with read, saved or unsaved
id=? where ? is replaced with the id of the item to modify
*/
func (h *handler) handleWriteItems(w http.ResponseWriter, r *http.Request) {
userID := request.UserID(r)
@ -448,10 +447,10 @@ func (h *handler) handleWriteItems(w http.ResponseWriter, r *http.Request) {
}
/*
mark=feed
as=read
id=? where ? is replaced with the id of the feed or group to modify
before=? where ? is replaced with the Unix timestamp of the the local clients most recent items API request
mark=feed
as=read
id=? where ? is replaced with the id of the feed or group to modify
before=? where ? is replaced with the Unix timestamp of the the local clients most recent items API request
*/
func (h *handler) handleWriteFeeds(w http.ResponseWriter, r *http.Request) {
userID := request.UserID(r)
@ -474,10 +473,10 @@ func (h *handler) handleWriteFeeds(w http.ResponseWriter, r *http.Request) {
}
/*
mark=group
as=read
id=? where ? is replaced with the id of the feed or group to modify
before=? where ? is replaced with the Unix timestamp of the the local clients most recent items API request
mark=group
as=read
id=? where ? is replaced with the id of the feed or group to modify
before=? where ? is replaced with the Unix timestamp of the the local clients most recent items API request
*/
func (h *handler) handleWriteGroups(w http.ResponseWriter, r *http.Request) {
userID := request.UserID(r)
@ -510,9 +509,8 @@ func (h *handler) handleWriteGroups(w http.ResponseWriter, r *http.Request) {
/*
A feeds_group object has the following members:
group_id (positive integer)
feed_ids (string/comma-separated list of positive integers)
group_id (positive integer)
feed_ids (string/comma-separated list of positive integers)
*/
func (h *handler) buildFeedGroups(feeds model.Feeds) []feedsGroups {
feedsGroupedByCategory := make(map[int64][]string)

View file

@ -23,8 +23,8 @@ func (b *baseResponse) SetCommonValues() {
/*
The default response is a JSON object containing two members:
api_version contains the version of the API responding (positive integer)
auth whether the request was successfully authenticated (boolean integer)
api_version contains the version of the API responding (positive integer)
auth whether the request was successfully authenticated (boolean integer)
The API can also return XML by passing xml as the optional value of the api argument like so:
@ -37,7 +37,6 @@ at least one additional member:
last_refreshed_on_time contains the time of the most recently refreshed (not updated)
feed (Unix timestamp/integer)
*/
func newBaseResponse() baseResponse {
r := baseResponse{}

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package googlereader implements Google Reader API endpoints.
*/
package googlereader // import "miniflux.app/googlereader"

View file

@ -29,10 +29,9 @@ const (
)
var (
errInvalidCertificate = "Invalid SSL certificate (original error: %q)"
errTemporaryNetworkOperation = "This website is temporarily unreachable (original error: %q)"
errPermanentNetworkOperation = "This website is permanently unreachable (original error: %q)"
errRequestTimeout = "Website unreachable, the request timed out after %d seconds"
errInvalidCertificate = "Invalid SSL certificate (original error: %q)"
errNetworkOperation = "This website is unreachable (original error: %q)"
errRequestTimeout = "Website unreachable, the request timed out after %d seconds"
)
// Client builds and executes HTTP requests.
@ -205,17 +204,11 @@ func (c *Client) executeRequest(request *http.Request) (*Response, error) {
case x509.CertificateInvalidError, x509.HostnameError:
err = errors.NewLocalizedError(errInvalidCertificate, uerr.Err)
case *net.OpError:
if uerr.Err.(*net.OpError).Temporary() {
err = errors.NewLocalizedError(errTemporaryNetworkOperation, uerr.Err)
} else {
err = errors.NewLocalizedError(errPermanentNetworkOperation, uerr.Err)
}
err = errors.NewLocalizedError(errNetworkOperation, uerr.Err)
case net.Error:
nerr := uerr.Err.(net.Error)
if nerr.Timeout() {
err = errors.NewLocalizedError(errRequestTimeout, c.ClientTimeout)
} else if nerr.Temporary() {
err = errors.NewLocalizedError(errTemporaryNetworkOperation, nerr)
}
}
}

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package client provides an HTTP client builder.
*/
package client // import "miniflux.app/http/client"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package cookie provides functions to build cookies.
*/
package cookie // import "miniflux.app/http/cookie"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package request contains helper functions to work with the HTTP request.
*/
package request // import "miniflux.app/http/request"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package response contains everything related to HTTP responses.
*/
package response // import "miniflux.app/http/response"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package html contains HTML response functions.
*/
package html // import "miniflux.app/http/response/html"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package json contains JSON response functions.
*/
package json // import "miniflux.app/http/response/json"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package xml contains XML response functions.
*/
package xml // import "miniflux.app/http/response/xml"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package route contains helper functions to work with defined routes.
*/
package route // import "miniflux.app/http/route"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package locale handles the internationalization of the application.
*/
package locale // import "miniflux.app/locale"

View file

@ -395,8 +395,7 @@
"This feed is empty": "Dieses Abonnement ist leer",
"This web page is empty": "Diese Webseite ist leer",
"Invalid SSL certificate (original error: %q)": "Ungültiges SSL-Zertifikat (ursprünglicher Fehler: %q)",
"This website is temporarily unreachable (original error: %q)": "Diese Webseite ist vorübergehend nicht erreichbar (ursprünglicher Fehler: %q)",
"This website is permanently unreachable (original error: %q)": "Diese Webseite ist dauerhaft nicht erreichbar (ursprünglicher Fehler: %q)",
"This website is unreachable (original error: %q)": "Diese Webseite ist nicht erreichbar (ursprünglicher Fehler: %q)",
"Website unreachable, the request timed out after %d seconds": "Webseite nicht erreichbar, die Anfrage endete nach %d Sekunden",
"You are not authorized to access this resource (invalid username/password)": "Sie sind nicht berechtigt, auf diese Ressource zuzugreifen (Benutzername/Passwort ungültig)",
"Unable to fetch this resource (Status Code = %d)": "Ressource konnte nicht abgerufen werden (code=%d)",

View file

@ -395,8 +395,7 @@
"This feed is empty": "Cet abonnement est vide",
"This web page is empty": "Cette page web est vide",
"Invalid SSL certificate (original error: %q)": "Certificat SSL invalide (erreur originale : %q)",
"This website is temporarily unreachable (original error: %q)": "Ce site web est temporairement injoignable (erreur originale : %q)",
"This website is permanently unreachable (original error: %q)": "Ce site web n'est pas joignable de façon permanente (erreur originale : %q)",
"This website is unreachable (original error: %q)": "Ce site web n'est pas joignable (erreur originale : %q)",
"Website unreachable, the request timed out after %d seconds": "Site web injoignable, la requête à échouée après %d secondes",
"You are not authorized to access this resource (invalid username/password)": "Vous n'êtes pas autorisé à accéder à cette ressource (nom d'utilisateur / mot de passe incorrect)",
"Unable to fetch this resource (Status Code = %d)": "Impossible de récupérer cette ressource (code=%d)",

View file

@ -396,7 +396,6 @@
"Category not found for this user": "Categorie niet gevonden voor deze gebruiker",
"This web page is empty": "Deze webpagina is leeg",
"Invalid SSL certificate (original error: %q)": "Ongeldig SSL-certificaat (originele error: %q)",
"This website is temporarily unreachable (original error: %q)": "Deze website is tijdelijk onbereikbaar (originele error: %q)",
"This website is permanently unreachable (original error: %q)": "Deze website is permanent onbereikbaar (originele error: %q)",
"This website is unreachable (original error: %q)": "Deze website is onbereikbaar (originele error: %q)",
"Website unreachable, the request timed out after %d seconds": "Website onbereikbaar, de request gaf een timeout na %d seconden"
}

View file

@ -404,7 +404,6 @@
"This feed is empty": "Ten kanał jest pusty",
"This web page is empty": "Ta strona jest pusta",
"Invalid SSL certificate (original error: %q)": "Certyfikat SSL jest nieprawidłowy (błąd: %q)",
"This website is temporarily unreachable (original error: %q)": "Ta strona jest tymczasowo niedostępna (błąd: %q)",
"This website is permanently unreachable (original error: %q)": "Ta strona jest niedostępna (błąd: %q)",
"This website is unreachable (original error: %q)": "Ta strona jest niedostępna (błąd: %q)",
"Website unreachable, the request timed out after %d seconds": "Strona internetowa nieosiągalna, żądanie wygasło po %d sekundach"
}

View file

@ -389,7 +389,6 @@
"This feed is empty": "该源是空的",
"This web page is empty": "该网页是空的",
"Invalid SSL certificate (original error: %q)": "无效的 SSL 证书 (原始错误: %q)",
"This website is temporarily unreachable (original error: %q)": "该网站暂时不可达 (原始错误: %q)",
"This website is permanently unreachable (original error: %q)": "该网站永久不可达 (原始错误: %q)",
"This website is unreachable (original error: %q)": "该网站永久不可达 (原始错误: %q)",
"Website unreachable, the request timed out after %d seconds": "网站不可达, 请求已在 %d 秒后超时"
}

View file

@ -397,7 +397,6 @@
"This feed is empty": "該Feed是空的",
"This web page is empty": "該網頁是空的",
"Invalid SSL certificate (original error: %q)": "無效的 SSL 憑證 (錯誤: %q)",
"This website is temporarily unreachable (original error: %q)": "該網站暫時無法訪問 (原始錯誤: %q)",
"This website is permanently unreachable (original error: %q)": "該網站永久無法訪問(原始錯誤: %q)",
"This website is unreachable (original error: %q)": "該網站永久無法訪問(原始錯誤: %q)",
"Website unreachable, the request timed out after %d seconds": "網站無法訪問, 請求已在 %d 秒後超時"
}

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package logger handles application log messages with different levels.
*/
package logger // import "miniflux.app/logger"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package model contains all data structures used by the application.
*/
package model // import "miniflux.app/model"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package oauth2 abstracts different OAuth2 providers.
*/
package oauth2 // import "miniflux.app/oauth2"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package atom provides an Atom feed parser.
*/
package atom // import "miniflux.app/reader/atom"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package browser handles website crawling.
*/
package browser // import "miniflux.app/reader/browser"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package date provides a feed date parser.
*/
package date // import "miniflux.app/reader/date"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package reader implements everything related to feed parsing.
*/
package reader // import "miniflux.app/reader"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package encoding handles workarounds to deal with encoding edge cases found into feeds.
*/
package encoding // import "miniflux.app/reader/encoding"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package icon provides all the logic to download website icons.
*/
package icon // import "miniflux.app/reader/icon"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package json provides a JSON feed parser.
*/
package json // import "miniflux.app/reader/json"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package opml provides an OPML parser and writer.
*/
package opml // import "miniflux.app/reader/opml"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package parser provides a generic feed parser that abstract all different formats.
*/
package parser // import "miniflux.app/reader/parser"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package processor applies rules and sanitize content for feed entries.
*/
package processor // import "miniflux.app/reader/processor"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package rdf provides a RDF feed parser.
*/
package rdf // import "miniflux.app/reader/rdf"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package readability implements a web page scraper that returns only relevant content.
*/
package readability // import "miniflux.app/reader/readability"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package rewrite provides functions to manipulate feed contents.
*/
package rewrite // import "miniflux.app/reader/rewrite"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package rss provides a RSS feed parser.
*/
package rss // import "miniflux.app/reader/rss"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package sanitizer implements a HTML sanitizer that removes unsafe elements.
*/
package sanitizer // import "miniflux.app/reader/sanitizer"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package scraper implements a web page crawler.
*/
package scraper // import "miniflux.app/reader/scraper"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package subscription implements the logic to find subscriptions on a website.
*/
package subscription // import "miniflux.app/reader/subscription"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package httpd implements the HTTP service.
*/
package httpd // import "miniflux.app/service/httpd"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package scheduler implements the scheduler service.
*/
package scheduler // import "miniflux.app/service/scheduler"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package storage implements a set of functions to interact with the database.
*/
package storage // import "miniflux.app/storage"

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
//go:build integration
// +build integration
package tests

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package tests contains API integration tests.
*/
package tests // import "miniflux.app/tests"

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
//go:build integration
// +build integration
package tests

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
//go:build integration
// +build integration
package tests

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
//go:build integration
// +build integration
package tests

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
//go:build integration
// +build integration
package tests

View file

@ -2,6 +2,7 @@
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
//go:build integration
// +build integration
package tests

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package timer implements utility functions to measure the execution time of a block of code.
*/
package timer // import "miniflux.app/timer"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package timezone contains helper functions to work with timezones.
*/
package timezone // import "miniflux.app/timezone"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package ui implements handlers to render to user interface.
*/
package ui // import "miniflux.app/ui"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package form handles HTML form validation and serialization.
*/
package form // import "miniflux.app/ui/form"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package session provides helper functions to work with the user session.
*/
package session // import "miniflux.app/ui/session"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package static contains assets for the user interface.
*/
package static // import "miniflux.app/ui/static"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package view handles template parameters.
*/
package view // import "miniflux.app/ui/view"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package url implements a set of utility functions to parse URL.
*/
package url // import "miniflux.app/url"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package version contains application and build information.
*/
package version // import "miniflux.app/version"

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
/*
Package worker implements the background workers.
*/
package worker // import "miniflux.app/worker"