From 924b9251d52bde20c56bc173dcc05f39f808d74d Mon Sep 17 00:00:00 2001 From: Fabrizio Sestito Date: Wed, 26 Jul 2023 12:11:50 +0200 Subject: [PATCH] docs: update README.md Signed-off-by: Fabrizio Sestito --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f3cb54d..adca4e0 100644 --- a/README.md +++ b/README.md @@ -35,23 +35,26 @@ policy. ## Implementation details > **DISCLAIMER:** WebAssembly is a constantly evolving topic. This document -> describes the status of the Go ecosystem at April 2021. +> describes the status of the Go ecosystem at July 2023. Currently the official Go compiler cannot produce WebAssembly binaries that can be run **outside** of the browser. Because of that, Kubewarden Go policies can be built only with the [TinyGo](https://tinygo.org/) compiler. -TinyGo doesn't yet support all the Go features (see [here](https://tinygo.org/lang-support/) -to see the current project status). Currently its biggest limitation -is the lack of a fully supported `reflect` package. Among other things, that -leads to the inability to use the `encoding/json` package against structures -and user defined types. - Kubewarden policies need to process JSON data like the policy settings and the actual request received by Kubernetes. +TinyGo doesn't yet support the full Go Standard Library, plus it has limited +support of Go reflection. +Because of that, it is not possible to import the official Kubernetes Go library +from upstream (e.g.: `k8s.io/api/core/v1`). +Importing these official Kubernetes types will result in a compilation failure. + However it's still possible to write a Kubewarden policy by using some 3rd party libraries. +> **Warning** +> Using an older version of TinyGo will result in runtime errors due to the limited support for Go reflection. + This is a list of libraries that can be useful when writing a Kubewarden policy: