From 797c52dfd636ce628d519ef6b9b2803e47408392 Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Sat, 15 Apr 2023 11:57:58 -0700 Subject: [PATCH] internal: remove package-level init with fastlyABIInit() We were ignoring the return value anyway and it complicates wizer integration. --- internal/abi/fastly/hostcalls_guest.go | 11 +++-------- internal/abi/fastly/hostcalls_noguest.go | 4 ++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/internal/abi/fastly/hostcalls_guest.go b/internal/abi/fastly/hostcalls_guest.go index c5d8d18..236c815 100644 --- a/internal/abi/fastly/hostcalls_guest.go +++ b/internal/abi/fastly/hostcalls_guest.go @@ -15,10 +15,6 @@ import ( "github.com/fastly/compute-sdk-go/internal/abi/prim" ) -func init() { - fastlyABIInit(1) -} - // witx: // // (module $fastly_abi @@ -32,11 +28,10 @@ func init() { //go:noescape func fastlyABIInit(abiVersion prim.U64) FastlyStatus -// TODO(pb): this doesn't need to be exported, I don't think? // Initialize the Fastly ABI at the given version. -//func Initialize(version uint64) error { -// return fastlyABIInit(version).toError() -//} +func Initialize(version uint64) error { + return fastlyABIInit(version).toError() +} // witx: // diff --git a/internal/abi/fastly/hostcalls_noguest.go b/internal/abi/fastly/hostcalls_noguest.go index 12e559b..7ace1c6 100644 --- a/internal/abi/fastly/hostcalls_noguest.go +++ b/internal/abi/fastly/hostcalls_noguest.go @@ -13,6 +13,10 @@ import ( "net" ) +func Initialize(version uint64) error { + return fmt.Errorf("not implemented") +} + func ParseUserAgent(userAgent string) (family, major, minor, patch string, err error) { return "", "", "", "", fmt.Errorf("not implemented") }