3
3
// For the script to work, the environment variable GITHUB_TOKEN must contain
4
4
// a valid personal access token (see https://github.com/settings/tokens).
5
5
//
6
- // Copyright (c) D. Bohdan 2017-2019, 2020, 2023.
6
+ // Copyright (c) D. Bohdan 2017-2019, 2020, 2023-2024 .
7
7
// License: MIT.
8
8
package main
9
9
@@ -12,7 +12,7 @@ import (
12
12
"encoding/json"
13
13
"fmt"
14
14
"html"
15
- "io/ioutil "
15
+ "io"
16
16
"log"
17
17
"net/http"
18
18
"os"
@@ -74,7 +74,7 @@ func loadEntries(glob string) (entries []entry, err error) {
74
74
75
75
entries = make ([]entry , len (matches ))
76
76
for i , match := range matches {
77
- buf , err := ioutil .ReadFile (match )
77
+ buf , err := os .ReadFile (match )
78
78
if err != nil {
79
79
return nil , err
80
80
}
@@ -88,7 +88,7 @@ func loadEntries(glob string) (entries []entry, err error) {
88
88
return entries , nil
89
89
}
90
90
91
- // Convert each entry into a table row.
91
+ // Convert each entry to a table row.
92
92
func entriesToTable (entries []entry ) (tbl table ) {
93
93
tbl = make (table , len (entries )+ 1 )
94
94
tbl [0 ] = make ([]string , 7 )
@@ -121,16 +121,16 @@ func entriesToTable(entries []entry) (tbl table) {
121
121
122
122
// <p>foo</p> -> foo
123
123
func stripP (html string ) (res string ) {
124
- p := regexp .MustCompile (" (?s)^\\ s*<p>(.*?)</p>\\ s*$" )
124
+ p := regexp .MustCompile (` (?s)^\s*<p>(.*?)</p>\s*$` )
125
125
found := p .FindStringSubmatch (html )
126
126
if len (found ) == 2 {
127
127
return found [1 ]
128
128
}
129
129
return html
130
130
}
131
131
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.
134
134
func (tbl table ) Format () (res string ) {
135
135
buffer := bytes .NewBufferString ("<table>\n " )
136
136
@@ -193,7 +193,7 @@ func queryGitHub(token string, query string) (body []byte, err error) {
193
193
return nil , err
194
194
}
195
195
196
- body , err = ioutil .ReadAll (resp .Body )
196
+ body , err = io .ReadAll (resp .Body )
197
197
if err != nil {
198
198
return nil , err
199
199
}
@@ -345,5 +345,8 @@ func main() {
345
345
dot ["date" ] = time .Now ().Format ("2006-01-02" )
346
346
dot ["table" ] = tbl .Format ()
347
347
348
- tmpl .Execute (os .Stdout , dot )
348
+ err = tmpl .Execute (os .Stdout , dot )
349
+ if err != nil {
350
+ log .Fatal (err )
351
+ }
349
352
}
0 commit comments