mirror of
https://github.com/kovetskiy/mark.git
synced 2025-06-02 03:32:42 +08:00
Fix lint issues detected by golangci v2
This commit is contained in:
parent
a0c6abfa6d
commit
f24d8c8957
@ -201,7 +201,9 @@ func prepareAttachment(opener vfs.Opener, base, name string) (Attachment, error)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return Attachment{}, karma.Format(err, "unable to open file: %q", attachmentPath)
|
return Attachment{}, karma.Format(err, "unable to open file: %q", attachmentPath)
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer func() {
|
||||||
|
_ = file.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
fileBytes, err := io.ReadAll(file)
|
fileBytes, err := io.ReadAll(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -260,7 +260,7 @@ func (api *API) CreateAttachment(
|
|||||||
|
|
||||||
if len(result.Results) == 0 {
|
if len(result.Results) == 0 {
|
||||||
return info, errors.New(
|
return info, errors.New(
|
||||||
"Confluence REST API for creating attachments returned " +
|
"the Confluence REST API for creating attachments returned " +
|
||||||
"0 json objects, expected at least 1",
|
"0 json objects, expected at least 1",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -794,21 +794,23 @@ func (api *API) RestrictPageUpdates(
|
|||||||
func newErrorStatusNotOK(request *gopencils.Resource) error {
|
func newErrorStatusNotOK(request *gopencils.Resource) error {
|
||||||
if request.Raw.StatusCode == http.StatusUnauthorized {
|
if request.Raw.StatusCode == http.StatusUnauthorized {
|
||||||
return errors.New(
|
return errors.New(
|
||||||
"Confluence API returned unexpected status: 401 (Unauthorized)",
|
"the Confluence API returned unexpected status: 401 (Unauthorized)",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if request.Raw.StatusCode == http.StatusNotFound {
|
if request.Raw.StatusCode == http.StatusNotFound {
|
||||||
return errors.New(
|
return errors.New(
|
||||||
"Confluence API returned unexpected status: 404 (Not Found)",
|
"the Confluence API returned unexpected status: 404 (Not Found)",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
output, _ := io.ReadAll(request.Raw.Body)
|
output, _ := io.ReadAll(request.Raw.Body)
|
||||||
defer request.Raw.Body.Close()
|
defer func() {
|
||||||
|
_ = request.Raw.Body.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"Confluence API returned unexpected status: %v, "+
|
"the Confluence API returned unexpected status: %v, "+
|
||||||
"output: %q",
|
"output: %q",
|
||||||
request.Raw.Status, output,
|
request.Raw.Status, output,
|
||||||
)
|
)
|
||||||
|
@ -72,7 +72,7 @@ func (r *ConfluenceTextRenderer) renderText(w util.BufWriter, source []byte, nod
|
|||||||
case html.EastAsianLineBreaksNone:
|
case html.EastAsianLineBreaksNone:
|
||||||
writeLineBreak = false
|
writeLineBreak = false
|
||||||
case html.EastAsianLineBreaksSimple:
|
case html.EastAsianLineBreaksSimple:
|
||||||
writeLineBreak = !(util.IsEastAsianWideRune(thisLastRune) && util.IsEastAsianWideRune(siblingFirstRune))
|
writeLineBreak = !util.IsEastAsianWideRune(thisLastRune) || !util.IsEastAsianWideRune(siblingFirstRune)
|
||||||
case html.EastAsianLineBreaksCSS3Draft:
|
case html.EastAsianLineBreaksCSS3Draft:
|
||||||
writeLineBreak = eastAsianLineBreaksCSS3DraftSoftLineBreak(thisLastRune, siblingFirstRune)
|
writeLineBreak = eastAsianLineBreaksCSS3DraftSoftLineBreak(thisLastRune, siblingFirstRune)
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ func processFile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
var finalVersionMessage string
|
var finalVersionMessage string
|
||||||
var shouldUpdatePage bool = true
|
var shouldUpdatePage = true
|
||||||
|
|
||||||
if cCtx.Bool("changes-only") {
|
if cCtx.Bool("changes-only") {
|
||||||
contentHash := getSHA1Hash(html)
|
contentHash := getSHA1Hash(html)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user