Skip to content

Commit f24d8c8

Browse files
committed
Fix lint issues detected by golangci v2
1 parent a0c6abf commit f24d8c8

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

attachment/attachment.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ func prepareAttachment(opener vfs.Opener, base, name string) (Attachment, error)
201201
if err != nil {
202202
return Attachment{}, karma.Format(err, "unable to open file: %q", attachmentPath)
203203
}
204-
defer file.Close()
204+
defer func() {
205+
_ = file.Close()
206+
}()
205207

206208
fileBytes, err := io.ReadAll(file)
207209
if err != nil {

confluence/api.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func (api *API) CreateAttachment(
260260

261261
if len(result.Results) == 0 {
262262
return info, errors.New(
263-
"Confluence REST API for creating attachments returned " +
263+
"the Confluence REST API for creating attachments returned " +
264264
"0 json objects, expected at least 1",
265265
)
266266
}
@@ -794,21 +794,23 @@ func (api *API) RestrictPageUpdates(
794794
func newErrorStatusNotOK(request *gopencils.Resource) error {
795795
if request.Raw.StatusCode == http.StatusUnauthorized {
796796
return errors.New(
797-
"Confluence API returned unexpected status: 401 (Unauthorized)",
797+
"the Confluence API returned unexpected status: 401 (Unauthorized)",
798798
)
799799
}
800800

801801
if request.Raw.StatusCode == http.StatusNotFound {
802802
return errors.New(
803-
"Confluence API returned unexpected status: 404 (Not Found)",
803+
"the Confluence API returned unexpected status: 404 (Not Found)",
804804
)
805805
}
806806

807807
output, _ := io.ReadAll(request.Raw.Body)
808-
defer request.Raw.Body.Close()
808+
defer func() {
809+
_ = request.Raw.Body.Close()
810+
}()
809811

810812
return fmt.Errorf(
811-
"Confluence API returned unexpected status: %v, "+
813+
"the Confluence API returned unexpected status: %v, "+
812814
"output: %q",
813815
request.Raw.Status, output,
814816
)

renderer/text.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (r *ConfluenceTextRenderer) renderText(w util.BufWriter, source []byte, nod
7272
case html.EastAsianLineBreaksNone:
7373
writeLineBreak = false
7474
case html.EastAsianLineBreaksSimple:
75-
writeLineBreak = !(util.IsEastAsianWideRune(thisLastRune) && util.IsEastAsianWideRune(siblingFirstRune))
75+
writeLineBreak = !util.IsEastAsianWideRune(thisLastRune) || !util.IsEastAsianWideRune(siblingFirstRune)
7676
case html.EastAsianLineBreaksCSS3Draft:
7777
writeLineBreak = eastAsianLineBreaksCSS3DraftSoftLineBreak(thisLastRune, siblingFirstRune)
7878
}

util/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ func processFile(
325325
}
326326

327327
var finalVersionMessage string
328-
var shouldUpdatePage bool = true
328+
var shouldUpdatePage = true
329329

330330
if cCtx.Bool("changes-only") {
331331
contentHash := getSHA1Hash(html)

0 commit comments

Comments
 (0)