pin golangci-lint version to latest available, fix reported errors
This commit is contained in:
committed by
Umputun
parent
877765cda2
commit
661f042cb4
@@ -54,13 +54,13 @@ jobs:
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: latest
|
||||
version: v1.58
|
||||
working-directory: backend/app
|
||||
|
||||
- name: golangci-lint on example directory
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: latest
|
||||
version: v1.58
|
||||
args: --config ../../.golangci.yml
|
||||
working-directory: backend/_example/memory_store
|
||||
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
run:
|
||||
timeout: 5m
|
||||
output:
|
||||
format: tab
|
||||
skip-dirs:
|
||||
- vendor
|
||||
|
||||
linters-settings:
|
||||
govet:
|
||||
check-shadowing: true
|
||||
maligned:
|
||||
suggest-new: true
|
||||
enable:
|
||||
- shadow
|
||||
goconst:
|
||||
min-len: 2
|
||||
min-occurrences: 2
|
||||
@@ -31,11 +26,13 @@ linters-settings:
|
||||
linters:
|
||||
enable:
|
||||
- bodyclose
|
||||
- megacheck
|
||||
- gosimple
|
||||
- staticcheck
|
||||
- unused
|
||||
- revive
|
||||
- govet
|
||||
- unconvert
|
||||
- gas
|
||||
- gosec
|
||||
- gocyclo
|
||||
- dupl
|
||||
- misspell
|
||||
@@ -54,6 +51,8 @@ linters:
|
||||
disable-all: true
|
||||
|
||||
issues:
|
||||
exclude-dirs:
|
||||
- vendor
|
||||
exclude-rules:
|
||||
- text: "at least one file in a package should have a package comment"
|
||||
linters:
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ func getDump() string {
|
||||
return string(stacktrace[:length])
|
||||
}
|
||||
|
||||
// nolint:gochecknoinits // can't avoid it in this place
|
||||
//nolint:gochecknoinits // can't avoid it in this place
|
||||
func init() {
|
||||
// catch SIGQUIT and print stack traces
|
||||
sigChan := make(chan os.Signal, 1)
|
||||
|
||||
@@ -424,11 +424,11 @@ func (b *BoltDB) Close() error {
|
||||
}
|
||||
|
||||
// Last returns up to max last comments for given siteID
|
||||
func (b *BoltDB) lastComments(siteID string, max int, since time.Time) (comments []store.Comment, err error) {
|
||||
func (b *BoltDB) lastComments(siteID string, maximum int, since time.Time) (comments []store.Comment, err error) {
|
||||
comments = []store.Comment{}
|
||||
|
||||
if max > lastLimit || max == 0 {
|
||||
max = lastLimit
|
||||
if maximum > lastLimit || maximum == 0 {
|
||||
maximum = lastLimit
|
||||
}
|
||||
|
||||
bdb, err := b.db(siteID)
|
||||
@@ -466,7 +466,7 @@ func (b *BoltDB) lastComments(siteID string, max int, since time.Time) (comments
|
||||
continue
|
||||
}
|
||||
comments = append(comments, comment)
|
||||
if len(comments) >= max {
|
||||
if len(comments) >= maximum {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,14 +57,14 @@ func (f *CommentFormatter) FormatText(txt string, raw bool) (res string) {
|
||||
}
|
||||
|
||||
// Shortens all the automatic links in HTML: auto link has equal "href" and "text" attributes.
|
||||
func (f *CommentFormatter) shortenAutoLinks(commentHTML string, max int) (resHTML string) {
|
||||
func (f *CommentFormatter) shortenAutoLinks(commentHTML string, maximum int) (resHTML string) {
|
||||
doc, err := goquery.NewDocumentFromReader(strings.NewReader(commentHTML))
|
||||
if err != nil {
|
||||
return commentHTML
|
||||
}
|
||||
doc.Find("a").Each(func(_ int, s *goquery.Selection) {
|
||||
if href, ok := s.Attr("href"); ok {
|
||||
if href != s.Text() || len(href) < max+3 || max < 3 {
|
||||
if href != s.Text() || len(href) < maximum+3 || maximum < 3 {
|
||||
return
|
||||
}
|
||||
commentURL, e := url.Parse(href)
|
||||
@@ -77,7 +77,7 @@ func (f *CommentFormatter) shortenAutoLinks(commentHTML string, max int) (resHTM
|
||||
return
|
||||
}
|
||||
|
||||
short := string([]rune(href)[:max-3])
|
||||
short := string([]rune(href)[:maximum-3])
|
||||
if len(short) < len(host) {
|
||||
short = host
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user