(t *testing.T)
| 420 | } |
| 421 | |
| 422 | func TestShortenFunctionName(t *testing.T) { |
| 423 | type testCase struct { |
| 424 | name string |
| 425 | want string |
| 426 | } |
| 427 | testcases := []testCase{ |
| 428 | { |
| 429 | "root", |
| 430 | "root", |
| 431 | }, |
| 432 | { |
| 433 | "syscall.Syscall", |
| 434 | "syscall.Syscall", |
| 435 | }, |
| 436 | { |
| 437 | "net/http.(*conn).serve", |
| 438 | "http.(*conn).serve", |
| 439 | }, |
| 440 | { |
| 441 | "github.com/blahBlah/foo.Foo", |
| 442 | "foo.Foo", |
| 443 | }, |
| 444 | { |
| 445 | "github.com/BlahBlah/foo.Foo", |
| 446 | "foo.Foo", |
| 447 | }, |
| 448 | { |
| 449 | "github.com/BlahBlah/foo.Foo[...]", |
| 450 | "foo.Foo[...]", |
| 451 | }, |
| 452 | { |
| 453 | "github.com/blah-blah/foo_bar.(*FooBar).Foo", |
| 454 | "foo_bar.(*FooBar).Foo", |
| 455 | }, |
| 456 | { |
| 457 | "encoding/json.(*structEncoder).(encoding/json.encode)-fm", |
| 458 | "json.(*structEncoder).(encoding/json.encode)-fm", |
| 459 | }, |
| 460 | { |
| 461 | "github.com/blah/blah/vendor/gopkg.in/redis.v3.(*baseClient).(github.com/blah/blah/vendor/gopkg.in/redis.v3.process)-fm", |
| 462 | "redis.v3.(*baseClient).(github.com/blah/blah/vendor/gopkg.in/redis.v3.process)-fm", |
| 463 | }, |
| 464 | { |
| 465 | "github.com/foo/bar/v4.(*Foo).Bar", |
| 466 | "bar.(*Foo).Bar", |
| 467 | }, |
| 468 | { |
| 469 | "github.com/foo/bar/v4/baz.Foo.Bar", |
| 470 | "baz.Foo.Bar", |
| 471 | }, |
| 472 | { |
| 473 | "github.com/foo/bar/v123.(*Foo).Bar", |
| 474 | "bar.(*Foo).Bar", |
| 475 | }, |
| 476 | { |
| 477 | "github.com/foobar/v0.(*Foo).Bar", |
| 478 | "v0.(*Foo).Bar", |
| 479 | }, |
nothing calls this directly
no test coverage detected
searching dependent graphs…