You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/09/28 16:35:03 UTC

[GitHub] rawlinp closed pull request #2887: Remove unused symbols

rawlinp closed pull request #2887: Remove unused symbols
URL: https://github.com/apache/trafficcontrol/pull/2887
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/lib/go-util/num.go b/lib/go-util/num.go
index a9dd45089..32ccd4750 100644
--- a/lib/go-util/num.go
+++ b/lib/go-util/num.go
@@ -88,21 +88,6 @@ func (i JSONIntStr) String() string {
 	return strconv.FormatInt(int64(i), 10)
 }
 
-// JSONNumAsStr unmarshals JSON strings or numbers into strings
-// This is designed to handle backwards-compatibility for old Perl endpoints which accept both. Please do not use this for new endpoints or new APIs, APIs should be well-typed.
-type JSONNumAsStr string
-
-func (s *JSONNumAsStr) UnmarshalJSON(d []byte) error {
-	if len(d) == 0 {
-		return errors.New("empty object")
-	}
-	if d[0] == '"' {
-		d = d[1 : len(d)-1] // strip JSON quotes
-	}
-	*s = JSONNumAsStr(d)
-	return nil
-}
-
 // BytesLenSplit splits the given byte array into an n-length arrays. If n > len(s), returns a slice with a single []byte containing all of s. If n <= 0, returns an empty slice.
 func BytesLenSplit(s []byte, n int) [][]byte {
 	ss := [][]byte{}
diff --git a/lib/go-util/num_test.go b/lib/go-util/num_test.go
index a1fa12df4..dd3798698 100644
--- a/lib/go-util/num_test.go
+++ b/lib/go-util/num_test.go
@@ -179,21 +179,3 @@ func TestBytesLenSplit(t *testing.T) {
 		}
 	}
 }
-
-func TestJSONNumAsStrUnmarshalJSON(t *testing.T) {
-	type T struct {
-		V JSONNumAsStr `json:"v"`
-	}
-	jNum := `{"v":42}`
-	expected := T{V: "42"}
-	actual := T{}
-	json.Unmarshal([]byte(jNum), &actual)
-	if expected != actual {
-		t.Errorf("JSONNumAsStr number unmarshal expected %v actual %v", expected, actual)
-	}
-	jStr := `{"v":"42"}`
-	json.Unmarshal([]byte(jStr), &actual)
-	if expected != actual {
-		t.Errorf("JSONNumAsStr string unmarshal expected %v actual %v", expected, actual)
-	}
-}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services