Skip to content

Commit

Permalink
start working around gopherjs issues for #974
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Jul 25, 2024
1 parent eadf90d commit 9aabe2c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
11 changes: 7 additions & 4 deletions base/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package errors

import (
"log/slog"
"log"
"runtime"
"strconv"
)
Expand All @@ -20,7 +20,8 @@ import (
// return errors.Log(MyFunc(v))
func Log(err error) error {
if err != nil {
slog.Error(err.Error() + " | " + CallerInfo())
log.Println(err)
// slog.Error(err.Error() + " | " + CallerInfo())
}
return err
}
Expand All @@ -32,7 +33,8 @@ func Log(err error) error {
// a := errors.Log1(MyFunc(v))
func Log1[T any](v T, err error) T { //yaegi:add
if err != nil {
slog.Error(err.Error() + " | " + CallerInfo())
log.Println(err)
// slog.Error(err.Error() + " | " + CallerInfo())
}
return v
}
Expand All @@ -44,7 +46,8 @@ func Log1[T any](v T, err error) T { //yaegi:add
// a, b := errors.Log2(MyFunc(v))
func Log2[T1, T2 any](v1 T1, v2 T2, err error) (T1, T2) {
if err != nil {
slog.Error(err.Error() + " | " + CallerInfo())
log.Println(err)
// slog.Error(err.Error() + " | " + CallerInfo())
}
return v1, v2
}
Expand Down
4 changes: 2 additions & 2 deletions base/errors/stdlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import "errors"
//
// Functions and methods should document the cases in which an error
// wrapping this will be returned.
var ErrUnsupported = errors.ErrUnsupported
// var ErrUnsupported = errors.ErrUnsupported

// As finds the first error in err's tree that matches target, and if one is found, sets
// target to that error value and returns true. Otherwise, it returns false.
Expand Down Expand Up @@ -69,7 +69,7 @@ func Is(err, target error) bool { return errors.Is(err, target) }
// between each string.
//
// A non-nil error returned by Join implements the Unwrap() []error method.
func Join(errs ...error) error { return errors.Join(errs...) }
func Join(errs ...error) error { return nil }

// New returns an error that formats as the given text.
// Each call to New returns a distinct error value even if the text is identical.
Expand Down
6 changes: 3 additions & 3 deletions base/num/abs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package num

// Abs returns the absolute value of the given value.
func Abs[T Signed | Float](x T) T {
if x < 0 {
return -x
}
// if x < 0 {
// return -x
// }
return x
}
5 changes: 3 additions & 2 deletions enums/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package enums
import (
"errors"
"fmt"
"log/slog"
"log"
"strconv"
"strings"
"sync/atomic"
Expand Down Expand Up @@ -310,7 +310,8 @@ func SetFlag(i *int64, on bool, f ...BitFlag) {
// one modified enum from tanking an entire object loading operation.
func UnmarshalText[T EnumSetter](i T, text []byte, typeName string) error {
if err := i.SetString(string(text)); err != nil {
slog.Error(typeName+".UnmarshalText", "err", err)
log.Println(err)
// slog.Error(typeName+".UnmarshalText", "err", err)
}
return nil
}
Expand Down

0 comments on commit 9aabe2c

Please sign in to comment.