Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor: move from io/ioutil to io and os packages (#264)

Eng Zer Jun422cc3f251d3
diff --git a/plugin/db/ssl.go b/plugin/db/ssl.go
index 738604a0f0..a9bf5003e3 100644
--- a/plugin/db/ssl.go
+++ b/plugin/db/ssl.go
@@ -4,7 +4,7 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
- "io/ioutil"
+ "os"
)
// TLSConfig is the configuration for SSL connection.
@@ -20,7 +20,7 @@ func (tc TLSConfig) GetSslConfig() (*tls.Config, error) {
return nil, nil
}
rootCertPool := x509.NewCertPool()
- pem, err := ioutil.ReadFile(tc.SslCA)
+ pem, err := os.ReadFile(tc.SslCA)
if err != nil {
return nil, err
}
diff --git a/plugin/webhook/dingtalk.go b/plugin/webhook/dingtalk.go
index 3209cc2aea..e0a04e8304 100644
--- a/plugin/webhook/dingtalk.go
+++ b/plugin/webhook/dingtalk.go
@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"strings"
"time"
@@ -75,7 +75,7 @@ func (receiver *DingTalkReceiver) post(context Context) error {
return fmt.Errorf("failed to POST webhook %v (%w)", context.URL, err)
}
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("failed to read POST webhook response %v (%w)", context.URL, err)
}
diff --git a/plugin/webhook/discord.go b/plugin/webhook/discord.go
index 3a6aa2cc03..eedfeaf763 100644
--- a/plugin/webhook/discord.go
+++ b/plugin/webhook/discord.go
@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"time"
)
@@ -100,7 +100,7 @@ func (receiver *DiscordReceiver) post(context Context) error {
return fmt.Errorf("failed to POST webhook %+v (%w)", context.URL, err)
}
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("failed to read POST webhook response %v (%w)", context.URL, err)
}
diff --git a/plugin/webhook/feishu.go b/plugin/webhook/feishu.go
index 4934ab2bf8..be4f85f1c3 100644
--- a/plugin/webhook/feishu.go
+++ b/plugin/webhook/feishu.go
@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"time"
)
@@ -142,7 +142,7 @@ func (receiver *FeishuReceiver) post(context Context) error {
return fmt.Errorf("failed to POST webhook %+v (%w)", context.URL, err)
}
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("failed to read POST webhook response %v (%w)", context.URL, err)
}
diff --git a/plugin/webhook/slack.go b/plugin/webhook/slack.go
index c1875910a3..ee02685eb4 100644
--- a/plugin/webhook/slack.go
+++ b/plugin/webhook/slack.go
@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"time"
)
@@ -141,7 +141,7 @@ func (receiver *SlackReceiver) post(context Context) error {
return fmt.Errorf("failed to POST webhook %+v (%w)", context.URL, err)
}
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("failed to read POST webhook response %v (%w)", context.URL, err)
}
diff --git a/plugin/webhook/teams.go b/plugin/webhook/teams.go
index 4d06108b4b..4796321142 100644
--- a/plugin/webhook/teams.go
+++ b/plugin/webhook/teams.go
@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"time"
)
@@ -109,7 +109,7 @@ func (receiver *TeamsReceiver) post(context Context) error {
return fmt.Errorf("failed to POST webhook %+v (%w)", context.URL, err)
}
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("failed to read POST webhook response %v (%w)", context.URL, err)
}
diff --git a/plugin/webhook/wecom.go b/plugin/webhook/wecom.go
index ee45a4a1bd..326dbbc0e6 100644
--- a/plugin/webhook/wecom.go
+++ b/plugin/webhook/wecom.go
@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"strings"
"time"
@@ -81,7 +81,7 @@ func (receiver *WeComReceiver) post(context Context) error {
return fmt.Errorf("failed to POST webhook %v (%w)", context.URL, err)
}
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("failed to read POST webhook response %v (%w)", context.URL, err)
}