diff --git a/file/json.go b/file/json.go index 188ba32..4149ea7 100644 --- a/file/json.go +++ b/file/json.go @@ -4,12 +4,12 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "os" ) const ( - fileModeReadWrite = 0600 // nolint + fileModeReadWrite = 0600 //nolint indent = " " prefix = "" ) @@ -29,7 +29,7 @@ func PrepareJSONData(payload interface{}) ([]byte, error) { } func CreateJSONFile(path string, data []byte) error { - err := ioutil.WriteFile(path, data, fileModeReadWrite) + err := os.WriteFile(path, data, fileModeReadWrite) if err != nil { return fmt.Errorf("failed to write json to file: %w", err) } @@ -44,7 +44,7 @@ func ReadJSONFile(path string, result interface{}) error { } defer file.Close() - data, err := ioutil.ReadAll(file) + data, err := io.ReadAll(file) if err != nil { return fmt.Errorf("failed to read data from file: %w", err) } @@ -64,7 +64,7 @@ func FormatJSONFile(path string) error { } defer file.Close() - data, err := ioutil.ReadAll(file) + data, err := io.ReadAll(file) if err != nil { return fmt.Errorf("failed to read data from file: %w", err) } @@ -76,7 +76,7 @@ func FormatJSONFile(path string) error { return fmt.Errorf("failed to indent json: %w", err) } - err = ioutil.WriteFile(path, prettyJSON.Bytes(), fileModeReadWrite) + err = os.WriteFile(path, prettyJSON.Bytes(), fileModeReadWrite) if err != nil { return fmt.Errorf("failed to write json to file: %w", err) } diff --git a/http/http.go b/http/http.go index 9411b5b..430c8e5 100644 --- a/http/http.go +++ b/http/http.go @@ -3,7 +3,7 @@ package http import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" ) @@ -21,9 +21,8 @@ func GetHTTPResponse(url string, result interface{}) error { return nil } -// nolint func GetHTTPResponseBytes(url string) ([]byte, error) { - resp, err := http.Get(url) + resp, err := http.Get(url) //nolint if err != nil { return nil, fmt.Errorf("failed to make GET request: %w", err) } @@ -33,7 +32,7 @@ func GetHTTPResponseBytes(url string) ([]byte, error) { return nil, fmt.Errorf("unsuccessful status code: %d", resp.StatusCode) } - bodyBytes, err := ioutil.ReadAll(resp.Body) + bodyBytes, err := io.ReadAll(resp.Body) if err != nil { return nil, fmt.Errorf("failed to read body: %w", err) } diff --git a/validation/info/external/external.go b/validation/info/external/external.go index f69ba57..4d33733 100644 --- a/validation/info/external/external.go +++ b/validation/info/external/external.go @@ -11,7 +11,7 @@ import ( var ( holdersRegexp = regexp.MustCompile(`(\d+)\saddresses`) - decimalsRegexp = regexp.MustCompile(`(\d+)\s<\/div>`) + decimalsRegexp = regexp.MustCompile(`(\d+)\s+<\/div>`) symbolRegexp = regexp.MustCompile(`(\w+)<\/b>\s