Skip to content

Commit

Permalink
replace deprecated ioutil import with io
Browse files Browse the repository at this point in the history
`io/ioutil` has been deprecated since Go 1.16 and this application is
now on Go 1.23, so replacing it with `io` the replacement stable
package.
  • Loading branch information
dhollinger committed Nov 23, 2024
1 parent 075c0ec commit dcdc121
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/chatops/rcserver/rcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package rcserver
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/http/httptest"
"net/url"
Expand Down Expand Up @@ -44,7 +44,7 @@ func parseAttachment(data string) []Attachment {
}

func handlePostMessage(w http.ResponseWriter, r *http.Request) {
body, _ := ioutil.ReadAll(r.Body)
body, _ := io.ReadAll(r.Body)
kvs := strings.Split(string(body), "&")

m := make(map[string]string)
Expand Down
4 changes: 2 additions & 2 deletions lib/parsers/azure-devops.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package parsers
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"strings"

"github.com/gin-gonic/gin"
Expand All @@ -13,7 +13,7 @@ import (
// parseAzureDevops processes an Azure DevOps webhook, extracting event details such as branch, module name, and repository info.
// It handles the PushEvent type and marks the data as completed and successful upon successful parsing.
func (d *Data) parseAzureDevops(c *gin.Context) error {
payload, err := ioutil.ReadAll(c.Request.Body)
payload, err := io.ReadAll(c.Request.Body)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions lib/parsers/gitea.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package parsers

import (
"fmt"
"io/ioutil"
"io"
"net/http"

api "code.gitea.io/gitea/modules/structs"
Expand All @@ -17,7 +17,7 @@ func giteaWebhookType(r *http.Request) string {
// parseGitea processes a Gitea webhook, extracting branch, repository, and user information.
// Handles "push" events to set relevant fields based on the payload.
func (d *Data) parseGitea(c *gin.Context) error {
payload, err := ioutil.ReadAll(c.Request.Body)
payload, err := io.ReadAll(c.Request.Body)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions lib/parsers/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package parsers

import (
"fmt"
"io/ioutil"
"io"
"strings"

"github.com/gin-gonic/gin"
Expand All @@ -12,7 +12,7 @@ import (
// parseGithub processes a GitHub webhook, extracting branch, repository, and user information.
// Handles both "push" and "workflow_run" events to set relevant fields based on the payload.
func (d *Data) parseGithub(c *gin.Context) error {
payload, err := ioutil.ReadAll(c.Request.Body)
payload, err := io.ReadAll(c.Request.Body)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions lib/parsers/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package parsers

import (
"fmt"
"io/ioutil"
"io"
"strings"

"github.com/gin-gonic/gin"
"github.com/xanzy/go-gitlab"
)

func (d *Data) parseGitlab(c *gin.Context) error {
payload, err := ioutil.ReadAll(c.Request.Body)
payload, err := io.ReadAll(c.Request.Body)
if err != nil {
return err
}
Expand Down

0 comments on commit dcdc121

Please sign in to comment.