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