From c6db9396581e6412ab7f8fdac264cb4d882679ad Mon Sep 17 00:00:00 2001 From: Mendel E Date: Mon, 30 May 2022 03:22:25 -0400 Subject: [PATCH] Switch to strings utilities for tracking --- types.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/types.go b/types.go index 06f2b9c..77d59de 100644 --- a/types.go +++ b/types.go @@ -1,7 +1,6 @@ package amazon import ( - "bytes" "fmt" "strconv" "strings" @@ -76,7 +75,7 @@ type Tracking struct { } func (t *Tracking) UnmarshalText(data []byte) error { - parts := bytes.FieldsFunc(data, func(r rune) bool { + parts := strings.FieldsFunc(string(data), func(r rune) bool { return r == '(' || r == ')' }) @@ -84,8 +83,8 @@ func (t *Tracking) UnmarshalText(data []byte) error { return fmt.Errorf("expected 2 parts from tracking, got %d", len(parts)) } - t.Carrier = string(parts[0]) - t.Number = string(parts[1]) + t.Carrier = parts[0] + t.Number = parts[1] return nil } -- 2.45.2