~mendelmaleh/amazon

c6db9396581e6412ab7f8fdac264cb4d882679ad — Mendel E 2 years ago 3093b00
Switch to strings utilities for tracking
1 files changed, 3 insertions(+), 4 deletions(-)

M types.go
M types.go => types.go +3 -4
@@ 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
}