You've already forked nginx_exporter
mirror of
https://github.com/nginxinc/nginx-prometheus-exporter.git
synced 2025-08-06 17:42:38 +03:00
Stop using io/ioutil
This commit is contained in:
@@ -2,7 +2,7 @@ package client
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -53,7 +53,7 @@ func (client *NginxClient) GetStubStats() (*StubStats, error) {
|
|||||||
return nil, fmt.Errorf("expected %v response, got %v", http.StatusOK, resp.StatusCode)
|
return nil, fmt.Errorf("expected %v response, got %v", http.StatusOK, resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to read the response body: %v", err)
|
return nil, fmt.Errorf("failed to read the response body: %v", err)
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,6 @@ import (
|
|||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -327,7 +326,7 @@ func main() {
|
|||||||
|
|
||||||
sslConfig := &tls.Config{InsecureSkipVerify: !*sslVerify}
|
sslConfig := &tls.Config{InsecureSkipVerify: !*sslVerify}
|
||||||
if *sslCaCert != "" {
|
if *sslCaCert != "" {
|
||||||
caCert, err := ioutil.ReadFile(*sslCaCert)
|
caCert, err := os.ReadFile(*sslCaCert)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Loading CA cert failed: %v", err)
|
log.Fatalf("Loading CA cert failed: %v", err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user