1
0
mirror of https://github.com/IBM/fp-go.git synced 2025-08-10 22:31:32 +02:00

fix: disable inlining of debug functions

Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
Dr. Carsten Leue
2024-02-07 13:41:47 +01:00
parent a774d63e66
commit 79652d8474
2 changed files with 11 additions and 0 deletions

View File

@@ -30,6 +30,8 @@ type (
)
// String prints some debug info for the object
//
// go:noinline
func eitherString(s *either) string {
if s.isLeft {
return fmt.Sprintf("Left[%T](%v)", s.value, s.value)
@@ -38,6 +40,8 @@ func eitherString(s *either) string {
}
// Format prints some debug info for the object
//
// go:noinline
func eitherFormat(e *either, f fmt.State, c rune) {
switch c {
case 's':

View File

@@ -34,6 +34,8 @@ type Option[A any] struct {
}
// optString prints some debug info for the object
//
// go:noinline
func optString(isSome bool, value any) string {
if isSome {
return fmt.Sprintf("Some[%T](%v)", value, value)
@@ -42,6 +44,8 @@ func optString(isSome bool, value any) string {
}
// optFormat prints some debug info for the object
//
// go:noinline
func optFormat(isSome bool, value any, f fmt.State, c rune) {
switch c {
case 's':
@@ -72,6 +76,9 @@ func (s Option[A]) MarshalJSON() ([]byte, error) {
return optMarshalJSON(s.isSome, s.value)
}
// optUnmarshalJSON unmarshals the [Option] from a JSON string
//
// go:noinline
func optUnmarshalJSON(isSome *bool, value any, data []byte) error {
// decode the value
if bytes.Equal(data, jsonNull) {