Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
2cf2126d
Commit
2cf2126d
authored
Apr 02, 2025
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: golangci config
parent
2aca8180
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
15 deletions
+24
-15
.golangci.yaml
.golangci.yaml
+23
-7
html_meta_test.go
plugin/httpgetter/html_meta_test.go
+0
-7
image.go
plugin/httpgetter/image.go
+1
-1
No files found.
.golangci.yaml
View file @
2cf2126d
...
...
@@ -2,8 +2,6 @@ version: "2"
linters
:
enable
:
-
errcheck
-
goimports
-
revive
-
govet
-
staticcheck
...
...
@@ -16,10 +14,18 @@ linters:
-
forbidigo
-
mirror
-
bodyclose
disable
:
-
errcheck
settings
:
goimports
:
# Put imports beginning with prefix after 3rd-party packages.
local-prefixes
:
github.com/usememos/memos
exhaustive
:
explicit-exhaustive-switch
:
false
staticcheck
:
checks
:
-
all
-
-ST1000
-
-ST1003
-
-ST1021
-
-QF1003
revive
:
# Default to run all linters so that new rules in the future could automatically be added to the static check.
enable-all-rules
:
true
...
...
@@ -67,6 +73,8 @@ linters:
disabled
:
true
-
name
:
redefines-builtin-id
disabled
:
true
-
name
:
package-comments
disabled
:
true
gocritic
:
disabled-checks
:
-
ifElseChain
...
...
@@ -81,10 +89,18 @@ linters:
-
shadow
forbidigo
:
forbid
:
-
'
fmt\.Errorf(#
Please
use
errors\.Wrap\|Wrapf\|Errorf
instead)?'
-
'
ioutil\.ReadDir(#
Please
use
os\.ReadDir)?'
-
pattern
:
'
fmt\.Errorf(#
Please
use
errors\.Wrap\|Wrapf\|Errorf
instead)?'
-
pattern
:
'
ioutil\.ReadDir(#
Please
use
os\.ReadDir)?'
issues
:
exclude
:
-
Rollback
-
fmt.Printf
formatters
:
enable
:
-
goimports
settings
:
goimports
:
local-prefixes
:
-
github.com/usememos/memos
plugin/httpgetter/html_meta_test.go
View file @
2cf2126d
...
...
@@ -2,7 +2,6 @@ package httpgetter
import
(
"errors"
"strings"
"testing"
"github.com/stretchr/testify/require"
...
...
@@ -30,10 +29,4 @@ func TestGetHTMLMetaForInternal(t *testing.T) {
if
_
,
err
:=
GetHTMLMeta
(
"http://localhost"
);
!
errors
.
Is
(
err
,
ErrInternalIP
)
{
t
.
Errorf
(
"Expected error for resolved internal IP, got %v"
,
err
)
}
// test for redirected internal IP
// 49.232.126.226:1110 will redirects to 127.0.0.1
if
_
,
err
:=
GetHTMLMeta
(
"http://49.232.126.226:1110"
);
!
(
errors
.
Is
(
err
,
ErrInternalIP
)
&&
strings
.
Contains
(
err
.
Error
(),
"redirect"
))
{
t
.
Errorf
(
"Expected error for redirected internal IP, got %v"
,
err
)
}
}
plugin/httpgetter/image.go
View file @
2cf2126d
...
...
@@ -29,7 +29,7 @@ func GetImage(urlStr string) (*Image, error) {
return
nil
,
err
}
if
!
strings
.
HasPrefix
(
mediatype
,
"image/"
)
{
return
nil
,
errors
.
New
(
"
W
rong image mediatype"
)
return
nil
,
errors
.
New
(
"
w
rong image mediatype"
)
}
bodyBytes
,
err
:=
io
.
ReadAll
(
response
.
Body
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment