-
Notifications
You must be signed in to change notification settings - Fork 24
/
init_tinygo.go
32 lines (25 loc) · 973 Bytes
/
init_tinygo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright The OWASP Coraza contributors
// SPDX-License-Identifier: Apache-2.0
//go:build tinygo
package main
import (
"unsafe"
_ "github.com/wasilibs/nottinygc"
)
// Some host functions that are not implemented by Envoy end up getting imported anyways
// by code that gets compiled but not executed at runtime. Because we know they are not
// executed, we can stub them out to allow functioning on Envoy. Note, these match the
// names and signatures of wasi-libc, used by TinyGo, not WASI ABI. Review these exports when either
// the minimum supported version of Envoy changes or the maximum version of TinyGo.
// fdopendir is re-exported to avoid TinyGo 0.28's import of wasi_snapshot_preview1.fd_readdir.
//
//export fdopendir
func fdopendir(fd int32) unsafe.Pointer {
return nil
}
// readdir is re-exported to avoid TinyGo 0.28's import of wasi_snapshot_preview1.fd_readdir.
//
//export readdir
func readdir(unsafe.Pointer) unsafe.Pointer {
return nil
}