aboutsummaryrefslogtreecommitdiff
path: root/forged/internal/common/scfg/unmarshal.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-11-12 00:31:04 +0800
committerRunxi Yu <me@runxiyu.org>2025-11-12 00:31:04 +0800
commitdb03e1a2a84b5edfd95ce190c849eb5afa5a464e (patch)
treedf2bc2b2445cc7fb684575b0d5ca258960db430b /forged/internal/common/scfg/unmarshal.go
parentRefactor (diff)
downloadforge-db03e1a2a84b5edfd95ce190c849eb5afa5a464e.tar.gz
forge-db03e1a2a84b5edfd95ce190c849eb5afa5a464e.tar.zst
forge-db03e1a2a84b5edfd95ce190c849eb5afa5a464e.zip
Update READMEHEADmaster
Diffstat (limited to '')
-rw-r--r--forged/internal/common/scfg/unmarshal.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/forged/internal/common/scfg/unmarshal.go b/forged/internal/common/scfg/unmarshal.go
index 8befc10..e60bcc7 100644
--- a/forged/internal/common/scfg/unmarshal.go
+++ b/forged/internal/common/scfg/unmarshal.go
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2020 Simon Ser <https://emersion.fr>
// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>
-package scfg
+package scfgs
import (
"encoding"
@@ -12,7 +12,7 @@ import (
"strconv"
)
-// Decoder reads and decodes an scfg document from an input stream.
+// Decoder reads and decodes an scfgs document from an input stream.
type Decoder struct {
r io.Reader
unknownDirectives []*Directive
@@ -29,7 +29,7 @@ func (dec *Decoder) UnknownDirectives() []*Directive {
return dec.unknownDirectives
}
-// Decode reads scfg document from the input and stores it in the value pointed
+// Decode reads scfgs document from the input and stores it in the value pointed
// to by v.
//
// If v is nil or not a pointer, Decode returns an error.
@@ -60,7 +60,7 @@ func (dec *Decoder) UnknownDirectives() []*Directive {
// unmarshaled into the value. Children blocks are not allowed.
//
// The decoding of each struct field can be customized by the format string
-// stored under the "scfg" key in the struct field's tag. The tag contains the
+// stored under the "scfgs" key in the struct field's tag. The tag contains the
// name of the field possibly followed by a comma-separated list of options.
// The name may be empty in order to specify options without overriding the
// default field name. As a special case, if the field name is "-", the field
@@ -74,7 +74,7 @@ func (dec *Decoder) Decode(v interface{}) error {
rv := reflect.ValueOf(v)
if rv.Kind() != reflect.Ptr || rv.IsNil() {
- return fmt.Errorf("scfg: invalid value for unmarshaling")
+ return fmt.Errorf("scfgs: invalid value for unmarshaling")
}
return dec.unmarshalBlock(block, rv)
@@ -92,7 +92,7 @@ func (dec *Decoder) unmarshalBlock(block Block, v reflect.Value) error {
switch v.Kind() {
case reflect.Map:
if t.Key().Kind() != reflect.String {
- return fmt.Errorf("scfg: map key type must be string")
+ return fmt.Errorf("scfgs: map key type must be string")
}
if v.IsNil() {
v.Set(reflect.MakeMap(t))
@@ -134,12 +134,12 @@ func (dec *Decoder) unmarshalBlock(block Block, v reflect.Value) error {
continue
}
if _, ok := seen[fieldIndex]; !ok {
- return fmt.Errorf("scfg: missing required directive %q", name)
+ return fmt.Errorf("scfgs: missing required directive %q", name)
}
}
default:
- return fmt.Errorf("scfg: unsupported type for unmarshaling blocks: %v", t)
+ return fmt.Errorf("scfgs: unsupported type for unmarshaling blocks: %v", t)
}
return nil