commit e4ad50b973973310a1823f00ea975697e93e3182 from: Oliver Lowe date: Wed Feb 02 15:26:08 2022 UTC panic on unlikely test case We're just in test mode, so it's ok to panic if we reach this highly unlikely scenario when, for example, the testdata file changes or something. commit - c26e0f9dab045063f9fb15a64233322532b18dcb commit + e4ad50b973973310a1823f00ea975697e93e3182 blob - b1658421cdbb8d78aba72e7a5683d1e94b840947 blob + f73240cfb1b4e93b27b8dcd523f2ed520ceae03c --- service_test.go +++ service_test.go @@ -27,12 +27,7 @@ func TestServiceUnmarshal(t *testing.T) { Output: "HTTP OK: HTTP/1.1 200 OK - 1714 bytes in 1.083 second response time ", }, } - var got Service - for _, r := range resp.Results { - if r.name() == "9p.io!http" { - got = r.(Service) - } - } + got := resp.Results[0].(Service) if !reflect.DeepEqual(want, got) { t.Errorf("want %+v, got %+v", want, got) }