-
Notifications
You must be signed in to change notification settings - Fork 113
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
Support Wasm #163
Support Wasm #163
Conversation
test: TEST_RELAY_URL=<relay_url> GOOS=js GOARCH=wasm go test -short ./...
I always wanted to do this, thank you! So really the only part that was needed was the WebSocket connection and you just did it? |
@@ -1,4 +1,4 @@ | |||
//go:build !sqlite_math_functions | |||
//go:build !js && !sqlite_math_functions |
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.
doesn't this mean it will compile this test when js
is true but sqlite_math_functions
is false or vice-versa? shouldn't it be ||
? (I really don't know)
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 means js
is false and sqlite_math_functions
is false, I guess.
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.
So if one of them is true this will be compiled, which is not what we want.
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.
It seems to be working as expected:
20:47 sdk/hints/test wasm $ GOOS=js GOARCH=wasm go test -run TestSQLiteHintsLibsql
testing: warning: no tests to run
PASS
ok github.com/nbd-wtf/go-nostr/sdk/hints/test 1.115s
20:47 sdk/hints/test wasm $ go test -tags sqlite_math_functions -run TestSQLiteHintsLibsql
testing: warning: no tests to run
PASS
ok github.com/nbd-wtf/go-nostr/sdk/hints/test 0.289s
20:47 sdk/hints/test wasm $ go test -run TestSQLiteHintsLibsql
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://aaa.com ::> 57245
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://ccc.org ::> 20930
2 :: wss://aaa.com ::> -1437816
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://aaa.com ::> -1437816
2 :: wss://ccc.org ::> -1459181
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://aaa.com ::> -1425031
2 :: wss://ccc.org ::> -1459181
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://aaa.com ::> -1425031
2 :: wss://ccc.org ::> -1459181
== relay scores for 0000000000000000000000000000000000000000000000000000000000000002
0 :: wss://ccc.org ::> 125585
1 :: wss://aaa.com ::> 19370
2 :: wss://bbb.net ::> 19370
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://aaa.com ::> -1425031
2 :: wss://ccc.org ::> -1459181
== relay scores for 0000000000000000000000000000000000000000000000000000000000000002
0 :: wss://ccc.org ::> 125585
1 :: wss://aaa.com ::> 19370
2 :: wss://bbb.net ::> 19370
== relay scores for 0000000000000000000000000000000000000000000000000000000000000003
0 :: wss://bbb.net ::> 20190
1 :: wss://aaa.com ::> 4583
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://aaa.com ::> -1425031
2 :: wss://ccc.org ::> -1459181
== relay scores for 0000000000000000000000000000000000000000000000000000000000000002
0 :: wss://ccc.org ::> 125585
1 :: wss://aaa.com ::> 19370
2 :: wss://bbb.net ::> 19370
== relay scores for 0000000000000000000000000000000000000000000000000000000000000003
0 :: wss://aaa.com ::> -403324
1 :: wss://bbb.net ::> -1444050
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://aaa.com ::> -1425031
2 :: wss://ccc.org ::> -1459181
== relay scores for 0000000000000000000000000000000000000000000000000000000000000002
0 :: wss://ccc.org ::> 125585
1 :: wss://aaa.com ::> 19370
2 :: wss://bbb.net ::> 19370
== relay scores for 0000000000000000000000000000000000000000000000000000000000000003
0 :: wss://aaa.com ::> -403324
1 :: wss://bbb.net ::> -1444050
== relay scores for 0000000000000000000000000000000000000000000000000000000000000004
0 :: wss://aaa.com ::> 115904
1 :: wss://bbb.net ::> 110716
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://aaa.com ::> -1425031
2 :: wss://ccc.org ::> -1459181
== relay scores for 0000000000000000000000000000000000000000000000000000000000000002
0 :: wss://ccc.org ::> 125585
1 :: wss://aaa.com ::> 19370
2 :: wss://bbb.net ::> 19370
== relay scores for 0000000000000000000000000000000000000000000000000000000000000003
0 :: wss://aaa.com ::> -403324
1 :: wss://bbb.net ::> -1444050
== relay scores for 0000000000000000000000000000000000000000000000000000000000000004
0 :: wss://aaa.com ::> 115904
1 :: wss://bbb.net ::> 110716
2 :: wss://ccc.org ::> 7446
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://aaa.com ::> -1425031
2 :: wss://ccc.org ::> -1459181
== relay scores for 0000000000000000000000000000000000000000000000000000000000000002
0 :: wss://ccc.org ::> 125585
1 :: wss://aaa.com ::> 19370
2 :: wss://bbb.net ::> 19370
== relay scores for 0000000000000000000000000000000000000000000000000000000000000003
0 :: wss://aaa.com ::> -403324
1 :: wss://bbb.net ::> -1444050
== relay scores for 0000000000000000000000000000000000000000000000000000000000000004
0 :: wss://ccc.org ::> 7446
1 :: wss://aaa.com ::> -1294495
2 :: wss://bbb.net ::> -1299683
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://aaa.com ::> -1425031
2 :: wss://ccc.org ::> -1459181
== relay scores for 0000000000000000000000000000000000000000000000000000000000000002
0 :: wss://ccc.org ::> 125585
1 :: wss://aaa.com ::> 19370
2 :: wss://bbb.net ::> 19370
== relay scores for 0000000000000000000000000000000000000000000000000000000000000003
0 :: wss://aaa.com ::> -403324
1 :: wss://bbb.net ::> -1444050
== relay scores for 0000000000000000000000000000000000000000000000000000000000000004
0 :: wss://aaa.com ::> 680064
1 :: wss://bbb.net ::> 674876
2 :: wss://ccc.org ::> 7446
= print scores
== relay scores for 0000000000000000000000000000000000000000000000000000000000000001
0 :: wss://bbb.net ::> 59616
1 :: wss://aaa.com ::> -1425031
2 :: wss://ccc.org ::> -1459181
== relay scores for 0000000000000000000000000000000000000000000000000000000000000002
0 :: wss://ccc.org ::> 125585
1 :: wss://aaa.com ::> 19370
2 :: wss://bbb.net ::> 19370
== relay scores for 0000000000000000000000000000000000000000000000000000000000000003
0 :: wss://aaa.com ::> -403324
1 :: wss://bbb.net ::> -1444050
== relay scores for 0000000000000000000000000000000000000000000000000000000000000004
0 :: wss://ccc.org ::> 1516650
1 :: wss://aaa.com ::> 680064
2 :: wss://bbb.net ::> 674876
PASS
ok github.com/nbd-wtf/go-nostr/sdk/hints/test 0.432s
20:48 sdk/hints/test wasm $ GOOS=js GOARCH=wasm go test -tags sqlite_math_functions -run TestSQLiteHintsLibsql
testing: warning: no tests to run
PASS
ok github.com/nbd-wtf/go-nostr/sdk/hints/test 0.724s
That's lovely to hear. Yeah, just as you wrote. But I'm not sure whether there could be edge cases that fail. |
And this doesn't support TinyGo unfortunately. At least |
Oh, this is sad. Maybe we can work on removing these dependencies. I'll try that later. |
I can't run any of these tests. What am I doing wrong?
|
Did you rename |
Maybe this annoys you.
ref: https://njump.me/nevent1qvzqqqqqqypzq0raz2nv9acla89z2fepdaff5ymmkrewkqvtrresqqun8w2nyqf7qy88wumn8ghj77tpvf6jumt99uq3qamnwvaz7tmwdaehgu3wd4hk6tcqypzkn265slt4smjxeler3rh4kvyz5kysxtvkggk0ccmkwhcdmqznw8c0dme