internal/wasm-tools, internal/cm: udpate to go.bytecodealliance.org@v0.6.1 and cm@v0.2.1

This commit is contained in:
Randy Reddig
2025-03-16 13:35:44 -07:00
committed by Ron Evans
parent 8e009de8a8
commit d63d8e0899
5 changed files with 18 additions and 69 deletions
+11 -6
View File
@@ -1,7 +1,5 @@
package cm
import "errors"
// CaseUnmarshaler returns an function that can unmarshal text into
// [variant] or [enum] case T.
//
@@ -33,8 +31,7 @@ func CaseUnmarshaler[T ~uint8 | ~uint16 | ~uint32](cases []string) func(v *T, te
if len(text) == 0 {
return errEmpty
}
s := string(text)
c, ok := m[s]
c, ok := m[string(text)]
if !ok {
return errNoMatchingCase
}
@@ -46,6 +43,14 @@ func CaseUnmarshaler[T ~uint8 | ~uint16 | ~uint32](cases []string) func(v *T, te
const linearScanThreshold = 16
var (
errEmpty = errors.New("empty text")
errNoMatchingCase = errors.New("no matching case")
errEmpty = &stringError{"empty text"}
errNoMatchingCase = &stringError{"no matching case"}
)
type stringError struct {
err string
}
func (err *stringError) Error() string {
return err.err
}