4
4
"context"
5
5
"encoding/json"
6
6
"fmt"
7
- "io/ioutil "
7
+ "io"
8
8
"log"
9
9
"net/http"
10
10
"os"
@@ -77,8 +77,8 @@ func createPullRequestLink(id string) string {
77
77
func main () {
78
78
log .SetFlags (0 )
79
79
if len (os .Args ) != 1 && len (os .Args ) != 3 {
80
- log .Fatalf (`Either specify two date arguments, AFTER and UNTIL,
81
- to create a brand new CHANGELOG, or call it without arguments to
80
+ log .Fatalf (`Either specify two date arguments, AFTER and UNTIL,
81
+ to create a brand new CHANGELOG, or call it without arguments to
82
82
update the current one with new changes.` )
83
83
}
84
84
gitHubToken = os .Getenv ("GITHUB_TOKEN" )
@@ -120,7 +120,7 @@ type MarkdownReleaseBlock struct {
120
120
121
121
func readCHANGELOG () map [string ]MarkdownReleaseBlock {
122
122
releaseBlocks := make (map [string ]MarkdownReleaseBlock )
123
- rawBytes , _ := ioutil .ReadFile ("./CHANGELOG.md" )
123
+ rawBytes , _ := os .ReadFile ("./CHANGELOG.md" )
124
124
rawString := string (rawBytes )
125
125
if match := latestHashRegexp .FindStringSubmatch (rawString ); len (match ) > 0 {
126
126
latestHash = match [1 ]
@@ -181,7 +181,7 @@ func updateToMarkdownReleaseBlock(releaseBlocks map[string]MarkdownReleaseBlock,
181
181
func createCHANGELOG (releaseBlocks map [string ]MarkdownReleaseBlock ) {
182
182
file , _ := os .Create ("CHANGELOG.md" )
183
183
defer file .Close ()
184
- _ , _ = file .WriteString (`# Note: This CHANGELOG is only for the changes in insights operator.
184
+ _ , _ = file .WriteString (`# Note: This CHANGELOG is only for the changes in insights operator.
185
185
Please see OpenShift release notes for official changes\n` )
186
186
_ , _ = file .WriteString (fmt .Sprintf ("<!--Latest hash: %s-->\n " , latestHash ))
187
187
var releases []string
@@ -231,7 +231,11 @@ func getPullRequestFromGitHub(id string) *Change {
231
231
// There is a limit for the GitHub API, if you use auth then its 5000/hour
232
232
var bearer = "token " + gitHubToken
233
233
234
- req , err := http .NewRequestWithContext (context .Background (), "GET" , fmt .Sprintf (gitHubAPIFormat , gitHubRepoOwner , gitHubRepo , id ), nil )
234
+ req , err := http .NewRequestWithContext (
235
+ context .Background (),
236
+ "GET" ,
237
+ fmt .Sprintf (gitHubAPIFormat , gitHubRepoOwner , gitHubRepo , id ),
238
+ http .NoBody )
235
239
if err != nil {
236
240
log .Fatalf (err .Error ())
237
241
}
@@ -242,7 +246,7 @@ func getPullRequestFromGitHub(id string) *Change {
242
246
log .Fatalf (err .Error ())
243
247
}
244
248
defer resp .Body .Close ()
245
- body , err := ioutil .ReadAll (resp .Body )
249
+ body , err := io .ReadAll (resp .Body )
246
250
if err != nil {
247
251
defer log .Fatalf (err .Error ())
248
252
return nil
0 commit comments