Skip to content

Commit

Permalink
fix(lint): remove genID as it's no longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
Integralist committed Apr 14, 2023
1 parent 13885ca commit 7b810e8
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions provider/lib.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package provider

import (
"bytes"
"crypto/sha512"
"encoding/json"
"fmt"
"io"
"net/http"
"sort"
"strconv"
Expand Down Expand Up @@ -587,21 +583,3 @@ func validateRegion(val interface{}, key string) ([]string, []error) {

return nil, []error{fmt.Errorf("received region name %q is invalid. should be in (%s)", val.(string), strings.Join(regionList, ", "))}
}

// genID marshals data into JSON and returns a hash of the bytes.
//
// The returned hash is typically used as input to SetId().
func genID(data any) (string, error) {
bs, err := json.Marshal(data)
if err != nil {
return "", err
}

h := sha512.New()
if _, err := io.Copy(h, bytes.NewReader(bs)); err != nil {
return "", err
}

digest := fmt.Sprintf("%x\n", h.Sum(nil))
return digest, nil
}

0 comments on commit 7b810e8

Please sign in to comment.