Skip to content

Commit 6790a43

Browse files
committed
fix(script): fix linter errors
1 parent 92e3374 commit 6790a43

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

render_template.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// For the script to work, the environment variable GITHUB_TOKEN must contain
44
// a valid personal access token (see https://github.com/settings/tokens).
55
//
6-
// Copyright (c) D. Bohdan 2017-2019, 2020, 2023.
6+
// Copyright (c) D. Bohdan 2017-2019, 2020, 2023-2024.
77
// License: MIT.
88
package main
99

@@ -12,7 +12,7 @@ import (
1212
"encoding/json"
1313
"fmt"
1414
"html"
15-
"io/ioutil"
15+
"io"
1616
"log"
1717
"net/http"
1818
"os"
@@ -74,7 +74,7 @@ func loadEntries(glob string) (entries []entry, err error) {
7474

7575
entries = make([]entry, len(matches))
7676
for i, match := range matches {
77-
buf, err := ioutil.ReadFile(match)
77+
buf, err := os.ReadFile(match)
7878
if err != nil {
7979
return nil, err
8080
}
@@ -88,7 +88,7 @@ func loadEntries(glob string) (entries []entry, err error) {
8888
return entries, nil
8989
}
9090

91-
// Convert each entry into a table row.
91+
// Convert each entry to a table row.
9292
func entriesToTable(entries []entry) (tbl table) {
9393
tbl = make(table, len(entries)+1)
9494
tbl[0] = make([]string, 7)
@@ -121,16 +121,16 @@ func entriesToTable(entries []entry) (tbl table) {
121121

122122
// <p>foo</p> -> foo
123123
func stripP(html string) (res string) {
124-
p := regexp.MustCompile("(?s)^\\s*<p>(.*?)</p>\\s*$")
124+
p := regexp.MustCompile(`(?s)^\s*<p>(.*?)</p>\s*$`)
125125
found := p.FindStringSubmatch(html)
126126
if len(found) == 2 {
127127
return found[1]
128128
}
129129
return html
130130
}
131131

132-
// Convert a table with each cell containing Markdown to an HTML <table>
133-
// representation.
132+
// Convert a table with each cell containing Markdown
133+
// to an HTML <table> representation.
134134
func (tbl table) Format() (res string) {
135135
buffer := bytes.NewBufferString("<table>\n")
136136

@@ -193,7 +193,7 @@ func queryGitHub(token string, query string) (body []byte, err error) {
193193
return nil, err
194194
}
195195

196-
body, err = ioutil.ReadAll(resp.Body)
196+
body, err = io.ReadAll(resp.Body)
197197
if err != nil {
198198
return nil, err
199199
}
@@ -345,5 +345,8 @@ func main() {
345345
dot["date"] = time.Now().Format("2006-01-02")
346346
dot["table"] = tbl.Format()
347347

348-
tmpl.Execute(os.Stdout, dot)
348+
err = tmpl.Execute(os.Stdout, dot)
349+
if err != nil {
350+
log.Fatal(err)
351+
}
349352
}

0 commit comments

Comments
 (0)