Skip to content

Commit b4b2af4

Browse files
committed
Panic on err
1 parent 5110cd3 commit b4b2af4

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

pkg/workflows/wasm/host/internal/rawsdk/helpers_wasip1.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ func SendSubscription(subscriptions *pb.TriggerSubscriptionRequest) {
6060
sendResponse(BufferToPointerLen(Must(proto.Marshal(execResult))))
6161
}
6262

63-
func Now() (time.Time, error) {
63+
func Now() time.Time {
6464
var buf [8]byte // host writes UnixNano as little-endian uint64
6565
rc := now(unsafe.Pointer(&buf[0]))
6666
if rc != ErrnoSuccess {
67-
return time.Time{}, fmt.Errorf("failed to fetch time from host: now() returned errno %d", rc)
67+
panic(fmt.Errorf("failed to fetch time from host: now() returned errno %d", rc))
6868
}
6969
ns := int64(binary.LittleEndian.Uint64(buf[:]))
70-
return time.Unix(0, ns), nil
70+
return time.Unix(0, ns)
7171
}
7272

7373
var donCall = int32(0)

pkg/workflows/wasm/host/standard_tests/mode_switch/successful_mode_switch/main_wasip1.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ func main() {
5050

5151
// ignoreTimeCall makes a rawsdk now call and forces the compiler not to optimize it away.
5252
func ignoreTimeCall() {
53-
t, err := rawsdk.Now()
54-
if err != nil {
55-
panic(err)
56-
}
53+
t := rawsdk.Now()
5754
if t.Before(time.Unix(-1, 322)) {
5855
panic("Test should not run before 1970")
5956
}

0 commit comments

Comments
 (0)