-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: adds tinygo support. #254
Conversation
9b6a9bf
to
66531fd
Compare
5d2fdce
to
9d6f6cf
Compare
I need to get this sorted first #283 |
Once #296 is merged we can get more greens. |
.github/workflows/tinygo.yml
Outdated
|
||
- name: Tests | ||
run: go list ./... | xargs -I{} tinygo test {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main goal @anuraaga
5cf0df2
to
77ed679
Compare
Answering my own question, I guess it is probably not a good idea to convert the JSON to go. I found what seems to be the original source for the JSON files so we wouldn't want to diverge too much I think. No problem, actually instead of generating some large tinyjson files, I'll rework to use |
@jptosso @jcchavezs Thanks for the patience, I think this is ready for a final review / merge |
eff7b73
to
8693b61
Compare
@jptosso Merged upstream and add some remaining fixes. Would be great if you can take a look at this as it'll be a significant milestone to Envoy support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/corazawaf/coraza/pull/254/files#diff-fbcd29a8693c2ec9956d0422d695d516d8a465ecf998ab4c2f9d17863a65556dL310 could be replaced with type assertion. CRS tests uses this feature. Everything else looks good to me.
Great work!
testing/profile/profile.go
Outdated
@@ -61,7 +61,7 @@ type Profile struct { | |||
|
|||
type ExpectedOutput struct { | |||
Headers map[string]string `yaml:"headers,omitempty"` | |||
Data interface{} `yaml:"data,omitempty"` // Accepts array or string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CRS tests will use an array of lines or a string, we must validate if the tests has been refactored or we can send a PR
Head branch was pushed to by a user without write access
Thanks @jptosso! Fixed the issue. By the way, if you intended for auto-merge to work, not yet unfortunately |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@anuraaga @jcchavezs do we have regression tests for tinygo to avoid breaking this milestone? |
This is amazing milestone. Indeed we have the |
This is amazing milestone. Indeed we have the `tinygo test` command running
on this which avoids regressions
…On Tue, 16 Aug 2022, 17:51 Juan Pablo Tosso, ***@***.***> wrote:
@anuraaga <https://github.com/anuraaga> @jcchavezs
<https://github.com/jcchavezs> do we have regression tests for tinygo to
avoid breaking this milestone?
—
Reply to this email directly, view it on GitHub
<#254 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXOYAVGGD5EDZP5AWFULF3VZO2JTANCNFSM5XDUHDFA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I faced a similar situation with the testdata and was about to open an
issue with the same concern. I think given the simplicity of the data that
it is the same to have it in yaml or in go structs but having it in go
makes them easier to maintain and removes this friction.
…On Tue, 2 Aug 2022, 09:03 Anuraag Agrawal, ***@***.***> wrote:
Hi @jptosso <https://github.com/jptosso> - I am working with @jcchavezs
<https://github.com/jcchavezs> on TinyGo support for coraza. I have
managed to get it to work in jcchavezs#1
<jcchavezs#1>
Before updating this branch, I wanted to confirm one point - because
TinyGo does not support encoding/json due to its use of reflection, the
JSON test harness loading is switched to TinyJson and works fine. There is
nothing similar for yaml though, while I see the testdata/engine test
harnesses likely use yaml because it would be tedious maintaining the
rules section without multi-line string support. For now I've converted
the yaml to json using remarshal and check both in but wondering if this
is reasonable or if you have any other preference. For example, would it be
fine to migrate from yaml to just .go files with structs filled in? I
don't think the maintenability suffers with such an approach.
Thanks!
—
Reply to this email directly, view it on GitHub
<#254 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXOYAQYZKN2GES2XN766HTVXDB2TANCNFSM5XDUHDFA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This PR adds proper support for tinygo.
HTTP server example has been turned into an own module to avoid those files to be considered in the tinygo test.
Depends on #296