@@ -14,12 +14,12 @@ import (
1414 "github.com/benchttp/sdk/internal/errorutil"
1515)
1616
17- // Representation is a raw data model for formatted runner config (json, yaml).
17+ // representation is a raw data model for formatted runner config (json, yaml).
1818// It serves as a receiver for unmarshaling processes and for that reason
1919// its types are kept simple (certain types are incompatible with certain
2020// unmarshalers).
2121// It exposes a method Unmarshal to convert its values into a runner.Config.
22- type Representation struct {
22+ type representation struct {
2323 Extends * string `yaml:"extends" json:"extends"`
2424
2525 Request struct {
@@ -49,14 +49,14 @@ type Representation struct {
4949 } `yaml:"tests" json:"tests"`
5050}
5151
52- func (repr Representation ) validate () error {
53- return repr .Into (& benchttp.Runner {})
52+ func (repr representation ) validate () error {
53+ return repr .parseAndMutate (& benchttp.Runner {})
5454}
5555
56- // Into parses the Representation receiver as a benchttp.Runner
56+ // parseAndMutate parses the Representation receiver as a benchttp.Runner
5757// and stores any non-nil field value into the corresponding field
5858// of dst.
59- func (repr Representation ) Into (dst * benchttp.Runner ) error {
59+ func (repr representation ) parseAndMutate (dst * benchttp.Runner ) error {
6060 if err := repr .parseRequestInto (dst ); err != nil {
6161 return err
6262 }
@@ -66,7 +66,7 @@ func (repr Representation) Into(dst *benchttp.Runner) error {
6666 return repr .parseTestsInto (dst )
6767}
6868
69- func (repr Representation ) parseRequestInto (dst * benchttp.Runner ) error {
69+ func (repr representation ) parseRequestInto (dst * benchttp.Runner ) error {
7070 if dst .Request == nil {
7171 dst .Request = & http.Request {}
7272 }
@@ -103,7 +103,7 @@ func (repr Representation) parseRequestInto(dst *benchttp.Runner) error {
103103 return nil
104104}
105105
106- func (repr Representation ) parseRunnerInto (dst * benchttp.Runner ) error {
106+ func (repr representation ) parseRunnerInto (dst * benchttp.Runner ) error {
107107 if requests := repr .Runner .Requests ; requests != nil {
108108 dst .Requests = * requests
109109 }
@@ -139,7 +139,7 @@ func (repr Representation) parseRunnerInto(dst *benchttp.Runner) error {
139139 return nil
140140}
141141
142- func (repr Representation ) parseTestsInto (dst * benchttp.Runner ) error {
142+ func (repr representation ) parseTestsInto (dst * benchttp.Runner ) error {
143143 testSuite := repr .Tests
144144 if len (testSuite ) == 0 {
145145 return nil
@@ -254,7 +254,7 @@ func requireConfigFields(fields map[string]interface{}) error {
254254 return nil
255255}
256256
257- type representations []Representation
257+ type representations []representation
258258
259259// mergeInto successively parses the given representations into dst.
260260//
@@ -265,7 +265,7 @@ func (reprs representations) mergeInto(dst *benchttp.Runner) error {
265265 }
266266
267267 for _ , repr := range reprs {
268- if err := repr .Into (dst ); err != nil {
268+ if err := repr .parseAndMutate (dst ); err != nil {
269269 return errorutil .WithDetails (ErrFileParse , err )
270270 }
271271 }
0 commit comments