Skip to content

Commit c250705

Browse files
committed
Fix the spelling of un/marshaler to match go's spelling.
1 parent 58bf6ef commit c250705

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

buffer.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func AddBuffer(recordName string, in []byte, opts ...BufferOption) Option {
2626
return &buffer{
2727
text: print.P("AddBuffer", print.String(recordName), print.Bytes(in), print.LiteralStringers(opts)),
2828
recordName: recordName,
29-
getter: func(_ string, _ Unmarshaller) ([]byte, error) {
29+
getter: func(_ string, _ Unmarshaler) ([]byte, error) {
3030
return in, nil
3131
},
3232
opts: opts,
@@ -35,7 +35,7 @@ func AddBuffer(recordName string, in []byte, opts ...BufferOption) Option {
3535

3636
// AddBufferFunc adds a function that is called during compile time of the
3737
// configuration. The recordName of this record is passed into the getter
38-
// function that is called as well as an Unmarshaller that represents the
38+
// function that is called as well as an Unmarshaler that represents the
3939
// existing state of the merged configuration prior to adding the buffer that
4040
// results in the call to getter.
4141
//
@@ -47,15 +47,15 @@ func AddBuffer(recordName string, in []byte, opts ...BufferOption) Option {
4747
// - [BufferOption]
4848
// - [BufferValueOption]
4949
// - [GlobalOption]
50-
func AddBufferFunc(recordName string, getter func(recordName string, u Unmarshaller) ([]byte, error), opts ...BufferOption) Option {
50+
func AddBufferFunc(recordName string, getter func(recordName string, u Unmarshaler) ([]byte, error), opts ...BufferOption) Option {
5151
rv := buffer{
5252
text: print.P("AddBufferFunc", print.String(recordName), print.Func(getter), print.LiteralStringers(opts)),
5353
recordName: recordName,
5454
opts: opts,
5555
}
5656

5757
if getter != nil {
58-
rv.getter = func(name string, u Unmarshaller) ([]byte, error) {
58+
rv.getter = func(name string, u Unmarshaler) ([]byte, error) {
5959
return getter(name, u)
6060
}
6161
}
@@ -71,7 +71,7 @@ type buffer struct {
7171
recordName string
7272

7373
// The function to use to get the value.
74-
getter func(string, Unmarshaller) ([]byte, error)
74+
getter func(string, Unmarshaler) ([]byte, error)
7575

7676
// Options that configure how this buffer is treated and processed.
7777
// These options are in addition to any default settings set with
@@ -118,7 +118,7 @@ func (b buffer) String() string {
118118

119119
// toTree converts an buffer into a meta.Object tree. This will happen
120120
// during the compilation stage.
121-
func (b *buffer) toTree(delimiter string, u Unmarshaller, decoders *codecRegistry[decoder.Decoder]) (meta.Object, error) {
121+
func (b *buffer) toTree(delimiter string, u Unmarshaler, decoders *codecRegistry[decoder.Decoder]) (meta.Object, error) {
122122
data, err := b.getter(b.recordName, u)
123123
if err != nil {
124124
return meta.Object{}, err

goschtalt_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func TestCompile(t *testing.T) {
204204
opts: []Option{
205205
AddBuffer("3.json", []byte(`{"Madd": "cat"}`)),
206206
AddBuffer("2.json", []byte(`{"Blue": "${thing}"}`)),
207-
AddBufferFunc("1.json", func(_ string, _ Unmarshaller) ([]byte, error) {
207+
AddBufferFunc("1.json", func(_ string, _ Unmarshaler) ([]byte, error) {
208208
return []byte(`{"Hello": "Mr. Blue Sky"}`), nil
209209
}),
210210
WithDecoder(&testDecoder{extensions: []string{"json"}}),
@@ -221,12 +221,12 @@ func TestCompile(t *testing.T) {
221221
description: "A case with an encoded buffer function that looks up something from the tree.",
222222
opts: []Option{
223223
AddBuffer("1.json", []byte(`{"Madd": "cat"}`)),
224-
AddBufferFunc("2.json", func(_ string, un Unmarshaller) ([]byte, error) {
224+
AddBufferFunc("2.json", func(_ string, un Unmarshaler) ([]byte, error) {
225225
var s string
226226
_ = un("Madd", &s)
227227
return []byte(fmt.Sprintf(`{"Blue": "%s"}`, s)), nil
228228
}),
229-
AddBufferFunc("3.json", func(_ string, un Unmarshaller) ([]byte, error) {
229+
AddBufferFunc("3.json", func(_ string, un Unmarshaler) ([]byte, error) {
230230
var s string
231231
_ = un("Blue", &s)
232232
return []byte(fmt.Sprintf(`{"Hello": "%s"}`, s)), nil
@@ -273,7 +273,7 @@ func TestCompile(t *testing.T) {
273273
opts: []Option{
274274
WithDecoder(&testDecoder{extensions: []string{"json"}}),
275275
AutoCompile(),
276-
AddBufferFunc("3.json", func(_ string, _ Unmarshaller) ([]byte, error) {
276+
AddBufferFunc("3.json", func(_ string, _ Unmarshaler) ([]byte, error) {
277277
return nil, unknownErr
278278
}),
279279
},
@@ -284,7 +284,7 @@ func TestCompile(t *testing.T) {
284284
opts: []Option{
285285
WithDecoder(&testDecoder{extensions: []string{"json"}}),
286286
AutoCompile(),
287-
AddBufferFunc("3.json", func(_ string, _ Unmarshaller) ([]byte, error) {
287+
AddBufferFunc("3.json", func(_ string, _ Unmarshaler) ([]byte, error) {
288288
return []byte(`invalid`), nil
289289
}),
290290
},
@@ -529,7 +529,7 @@ func TestCompile(t *testing.T) {
529529
opts: []Option{
530530
AutoCompile(),
531531
AddValueFunc("record", Root,
532-
func(string, Unmarshaller) (any, error) {
532+
func(string, Unmarshaler) (any, error) {
533533
return nil, testErr
534534
},
535535
),

options_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestOptions(t *testing.T) {
3131
list := []string{"zeta", "alpha", "19beta", "19alpha", "4tango",
3232
"1alpha", "7alpha", "bravo", "7alpha10", "7alpha2", "7alpha0"}
3333

34-
retBuf := func(name string, un Unmarshaller) ([]byte, error) {
34+
retBuf := func(name string, un Unmarshaler) ([]byte, error) {
3535
return []byte(name), nil
3636
}
3737

@@ -541,7 +541,7 @@ func TestOptions(t *testing.T) {
541541
},
542542
}, {
543543
description: "AddValueFunc( record1, '', func )",
544-
opt: AddValueFunc("record1", Root, func(_ string, un Unmarshaller) (any, error) { return nil, nil }),
544+
opt: AddValueFunc("record1", Root, func(_ string, un Unmarshaler) (any, error) { return nil, nil }),
545545
str: "AddValueFunc( 'record1', '', custom, none )",
546546
check: func(cfg *options) bool {
547547
if len(cfg.values) == 1 {

record.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type record struct {
1818
}
1919

2020
// fetch normalizes the calls to the val or encoded types of records.
21-
func (rec *record) fetch(delimiter string, u Unmarshaller, decoders *codecRegistry[decoder.Decoder], defaultOpts []ValueOption) error {
21+
func (rec *record) fetch(delimiter string, u Unmarshaler, decoders *codecRegistry[decoder.Decoder], defaultOpts []ValueOption) error {
2222
if rec.val != nil {
2323
tree, err := rec.val.toTree(delimiter, u, defaultOpts...)
2424
if err != nil {

unmarshal.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import (
1515
"github.com/mitchellh/mapstructure"
1616
)
1717

18-
// Unmarshaller provides a special use [Unmarshal]() function during [AddBufferFunc]()
18+
// Unmarshaler provides a special use [Unmarshal]() function during [AddBufferFunc]()
1919
// and [AddValueFunc]() option provided callbacks. This pattern allows the specified
2020
// function access to the configuration values up to this point. Expansion of
2121
// any [Expand]() or [ExpandEnv]() options is also applied to the configuration tree
2222
// provided.
23-
type Unmarshaller func(key string, result any, opts ...UnmarshalOption) error
23+
type Unmarshaler func(key string, result any, opts ...UnmarshalOption) error
2424

2525
// Unmarshal provides a generics based strict typed approach to fetching parts
2626
// of the configuration tree.
@@ -44,7 +44,7 @@ func Unmarshal[T any](c *Config, key string, opts ...UnmarshalOption) (T, error)
4444
}
4545

4646
// UnmarshalFunc returns a function that takes a goschtalt Config structure and
47-
// returns a function that allows for unmarshalling of a portion of the tree
47+
// returns a function that allows for unmarshaling of a portion of the tree
4848
// specified by the key into a zero value type.
4949
//
5050
// This function is specifically helpful with DI frameworks like Uber's fx

value.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func AddValue(recordName, key string, val any, opts ...ValueOption) Option {
2929
text: "AddValue",
3030
recordName: recordName,
3131
key: key,
32-
getter: func(_ string, _ Unmarshaller) (any, error) {
32+
getter: func(_ string, _ Unmarshaler) (any, error) {
3333
return val, nil
3434
},
3535
opts: opts,
@@ -49,7 +49,7 @@ func AddValue(recordName, key string, val any, opts ...ValueOption) Option {
4949
// - [GlobalOption]
5050
// - [ValueOption]
5151
// - [UnmarshalValueOption]
52-
func AddValueFunc(recordName, key string, f func(recordName string, u Unmarshaller) (any, error), opts ...ValueOption) Option {
52+
func AddValueFunc(recordName, key string, f func(recordName string, u Unmarshaler) (any, error), opts ...ValueOption) Option {
5353
return &value{
5454
text: "AddValueFunc",
5555
recordName: recordName,
@@ -70,7 +70,7 @@ type value struct {
7070
key string
7171

7272
// The function to use to get the value.
73-
getter func(recordName string, u Unmarshaller) (any, error)
73+
getter func(recordName string, u Unmarshaler) (any, error)
7474

7575
// Options that configure how to process the Value provided.
7676
// These options are in addition to any default settings set with
@@ -80,7 +80,7 @@ type value struct {
8080

8181
// toTree does the work of converting from a structure of some sort to the
8282
// normalized object tree goschtalt uses.
83-
func (v value) toTree(delimiter string, u Unmarshaller, defaultOpts ...ValueOption) (meta.Object, error) {
83+
func (v value) toTree(delimiter string, u Unmarshaler, defaultOpts ...ValueOption) (meta.Object, error) {
8484
cfg := valueOptions{
8585
tagName: defaultTag,
8686
}

0 commit comments

Comments
 (0)