| 1 | package examplescip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare/example`/ |
| 2 | |
| 3 | import ( |
| 4 | "io/ioutilscip-go gomod github.com/golang/go/src go1.14 `io/ioutil`/" |
| 5 | "testingscip-go gomod github.com/golang/go/src go1.14 testing/" |
| 6 | |
| 7 | "git.sr.ht/~sircmpwn/go-barescip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare`/" |
| 8 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/" |
| 9 | ) |
| 10 | |
| 11 | func BenchmarkMarshalscip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare/example`/BenchmarkMarshal().(b *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Bscip-go gomod github.com/golang/go/src go1.14 testing/B#) { |
| 12 | person, _ := makeCustomerscip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare/example`/makeCustomer().(b) |
| 13 | b.ResetTimerscip-go gomod github.com/golang/go/src go1.14 testing/B#ResetTimer().() |
| 14 | |
| 15 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.14 testing/B#N.; i++ { |
| 16 | _, err := barescip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare`/.Marshalscip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare`/Marshal().(person) |
| 17 | if err != nil { |
| 18 | panic(err) |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | } |
| 23 | |
| 24 | func BenchmarkUnmarshalscip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare/example`/BenchmarkUnmarshal().(b *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Bscip-go gomod github.com/golang/go/src go1.14 testing/B#) { |
| 25 | _, buf := makeCustomerscip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare/example`/makeCustomer().(b) |
| 26 | var person Personscip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare/example`/Person# |
| 27 | b.ResetTimerscip-go gomod github.com/golang/go/src go1.14 testing/B#ResetTimer().() |
| 28 | |
| 29 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.14 testing/B#N.; i++ { |
| 30 | err := barescip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare`/.Unmarshalscip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare`/Unmarshal().(buf, &person) |
| 31 | if err != nil { |
| 32 | panic(err) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | } |
| 37 | |
| 38 | func makeCustomerscip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare/example`/makeCustomer().(b *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Bscip-go gomod github.com/golang/go/src go1.14 testing/B#) (Personscip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare/example`/Person#, []byte) { |
| 39 | buf, err := ioutilscip-go gomod github.com/golang/go/src go1.14 `io/ioutil`/.ReadFilescip-go gomod github.com/golang/go/src go1.14 `io/ioutil`/ReadFile().("customer.bin") |
| 40 | assertscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/Nil().(b, err) |
| 41 | |
| 42 | b.SetBytesscip-go gomod github.com/golang/go/src go1.14 testing/B#SetBytes().(int64(len(buf))) |
| 43 | |
| 44 | var person Personscip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare/example`/Person# |
| 45 | err = barescip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare`/.Unmarshalscip-go gomod git.sr.ht/~sircmpwn/go-bare . `git.sr.ht/~sircmpwn/go-bare`/Unmarshal().(buf, &person) |
| 46 | assertscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/Nil().(b, err) |
| 47 | |
| 48 | return person, buf |
| 49 | } |