go-nostr icon indicating copy to clipboard operation
go-nostr copied to clipboard

dedicated `Kind` type

Open fiatjaf opened this issue 1 year ago • 2 comments

I'll just leave this here for the future, maybe.

fiatjaf avatar Jan 01 '24 15:01 fiatjaf

Sweeping

Fixing PR: track the progress here.

I'm currently fixing this PR to address the following:

[Sweep GHA Fix] The GitHub Actions run failed with the following error logs:

The command:
Run go test ./...
yielded the following error:
##[error]binary/binary_test.go:33:67: invalid operation: kind != evt.Kind (mismatched types int and nostr.Kind)
# github.com/nbd-wtf/go-nostr [github.com/nbd-wtf/go-nostr.test]
##[error]./count_test.go:15:11: cannot use []int{…} (value of type []int) as []Kind value in struct literal
##[error]./count_test.go:15:17: cannot use KindContactList (constant 3 of type Kind) as int value in array or slice literal
##[error]./envelopes_test.go:164:87: cannot use []int{…} (value of type []int) as []Kind value in struct literal
FAIL	github.com/nbd-wtf/go-nostr [build failed]
##[error]./eose_test.go:14:11: cannot use []int{…} (value of type []int) as []Kind value in struct literal
##[error]./eose_test.go:14:17: cannot use KindTextNote (constant 1 of type Kind) as int value in array or slice literal
##[error]./filter_test.go:28:10: cannot use []int{…} (value of type []int) as []Kind value in struct literal
##[error]./filter_test.go:28:16: cannot use KindTextNote (constant 1 of type Kind) as int value in array or slice literal
##[error]./filter_test.go:28:30: cannot use KindRecommendServer (constant 2 of type Kind) as int value in array or slice literal
##[error]./filter_test.go:28:51: cannot use KindEncryptedDirectMessage (constant 4 of type Kind) as int value in array or slice literal
##[error]./filter_test.go:56:23: cannot use KindEncryptedDirectMessage (constant 4 of type Kind) as int value in array or slice literal
##[error]./filter_test.go:56:23: too many errors
FAIL	github.com/nbd-wtf/go-nostr/binary [build failed]
?   	github.com/nbd-wtf/go-nostr/example	[no test files]
?   	github.com/nbd-wtf/go-nostr/nip05	[no test files]
?   	github.com/nbd-wtf/go-nostr/nip06	[no test files]
?   	github.com/nbd-wtf/go-nostr/nip10	[no test files]
ok  	github.com/nbd-wtf/go-nostr/nip04	0.024s
ok  	github.com/nbd-wtf/go-nostr/nip11	0.005s
# github.com/nbd-wtf/go-nostr/nip19 [github.com/nbd-wtf/go-nostr/nip19.test]
##[error]nip19/nip19_test.go:115:3: cannot use nostr.KindArticle (constant 30023 of type nostr.Kind) as int value in argument to EncodeEntity
##[error]nip19/nip19_test.go:139:16: invalid operation: ep.Kind != nostr.KindArticle (mismatched types int and nostr.Kind)
##[error]nip19/nip19_test.go:162:16: invalid operation: ep.Kind != nostr.KindArticle (mismatched types int and nostr.Kind)
?   	github.com/nbd-wtf/go-nostr/nip42	[no test files]
?   	github.com/nbd-wtf/go-nostr/nip46	[no test files]
# github.com/nbd-wtf/go-nostr/nson [github.com/nbd-wtf/go-nostr/nson.test]
##[error]nson/nson_test.go:42:41: invalid operation: kind != evt.Kind (mismatched types int and nostr.Kind)
ok  	github.com/nbd-wtf/go-nostr/nip13	0.042s
FAIL	github.com/nbd-wtf/go-nostr/nip19 [build failed]
FAIL	github.com/nbd-wtf/go-nostr/nson [build failed]
FAIL
##[error]Process completed with exit code 1.

Here are the logs:
go: downloading github.com/btcsuite/btcd/btcec/v2 v2.3.2
go: downloading github.com/tyler-smith/go-bip32 v1.0.0
go: downloading github.com/tyler-smith/go-bip39 v1.1.0
go: downloading github.com/mailru/easyjson v0.7.7
go: downloading golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
go: downloading github.com/btcsuite/btcd/btcutil v1.1.3
go: downloading github.com/gobwas/httphead v0.1.0
go: downloading github.com/gobwas/ws v1.2.0
go: downloading github.com/puzpuzpuz/xsync/v2 v2.5.1
go: downloading github.com/tidwall/gjson v1.14.4
go: downloading golang.org/x/net v0.8.0
go: downloading github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
go: downloading golang.org/x/crypto v0.7.0
go: downloading github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2
go: downloading github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e
go: downloading github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec
go: downloading github.com/josharian/intern v1.0.0
go: downloading github.com/tidwall/match v1.1.1
go: downloading github.com/tidwall/pretty v1.2.0
go: downloading github.com/gobwas/pool v0.2.1
go: downloading github.com/decred/dcrd/crypto/blake256 v1.0.1
# github.com/nbd-wtf/go-nostr/binary [github.com/nbd-wtf/go-nostr/binary.test]

sweep-ai[bot] avatar Jan 01 '24 15:01 sweep-ai[bot]

Sweeping

Fixing PR: track the progress here.

I'm currently fixing this PR to address the following:

[Sweep GHA Fix] The GitHub Actions run failed with the following error logs:

The command:
Run go test ./...
yielded the following error:
##[error]binary/binary_test.go:33:67: invalid operation: kind != evt.Kind (mismatched types int and nostr.Kind)
# github.com/nbd-wtf/go-nostr [github.com/nbd-wtf/go-nostr.test]
##[error]./count_test.go:15:11: cannot use []int{…} (value of type []int) as []Kind value in struct literal
FAIL	github.com/nbd-wtf/go-nostr [build failed]
##[error]./count_test.go:15:17: cannot use KindContactList (constant 3 of type Kind) as int value in array or slice literal
##[error]./envelopes_test.go:164:87: cannot use []int{…} (value of type []int) as []Kind value in struct literal
##[error]./eose_test.go:14:11: cannot use []int{…} (value of type []int) as []Kind value in struct literal
##[error]./eose_test.go:14:17: cannot use KindTextNote (constant 1 of type Kind) as int value in array or slice literal
##[error]./filter_test.go:28:10: cannot use []int{…} (value of type []int) as []Kind value in struct literal
##[error]./filter_test.go:28:16: cannot use KindTextNote (constant 1 of type Kind) as int value in array or slice literal
##[error]./filter_test.go:28:30: cannot use KindRecommendServer (constant 2 of type Kind) as int value in array or slice literal
##[error]./filter_test.go:28:51: cannot use KindEncryptedDirectMessage (constant 4 of type Kind) as int value in array or slice literal
##[error]./filter_test.go:56:23: cannot use KindEncryptedDirectMessage (constant 4 of type Kind) as int value in array or slice literal
##[error]./filter_test.go:56:23: too many errors
FAIL	github.com/nbd-wtf/go-nostr/binary [build failed]
?   	github.com/nbd-wtf/go-nostr/example	[no test files]
?   	github.com/nbd-wtf/go-nostr/nip05	[no test files]
?   	github.com/nbd-wtf/go-nostr/nip06	[no test files]
ok  	github.com/nbd-wtf/go-nostr/nip04	0.018s
?   	github.com/nbd-wtf/go-nostr/nip10	[no test files]
ok  	github.com/nbd-wtf/go-nostr/nip11	0.003s
# github.com/nbd-wtf/go-nostr/nip19 [github.com/nbd-wtf/go-nostr/nip19.test]
##[error]nip19/nip19_test.go:115:3: cannot use nostr.KindArticle (constant 30023 of type nostr.Kind) as int value in argument to EncodeEntity
##[error]nip19/nip19_test.go:139:16: invalid operation: ep.Kind != nostr.KindArticle (mismatched types int and nostr.Kind)
##[error]nip19/nip19_test.go:162:16: invalid operation: ep.Kind != nostr.KindArticle (mismatched types int and nostr.Kind)
?   	github.com/nbd-wtf/go-nostr/nip42	[no test files]
?   	github.com/nbd-wtf/go-nostr/nip46	[no test files]
# github.com/nbd-wtf/go-nostr/nson [github.com/nbd-wtf/go-nostr/nson.test]
##[error]nson/nson_test.go:42:41: invalid operation: kind != evt.Kind (mismatched types int and nostr.Kind)
ok  	github.com/nbd-wtf/go-nostr/nip13	0.029s
FAIL	github.com/nbd-wtf/go-nostr/nip19 [build failed]
FAIL	github.com/nbd-wtf/go-nostr/nson [build failed]
FAIL
##[error]Process completed with exit code 1.

Here are the logs:
go: downloading github.com/btcsuite/btcd/btcec/v2 v2.3.2
go: downloading github.com/mailru/easyjson v0.7.7
go: downloading github.com/tyler-smith/go-bip32 v1.0.0
go: downloading github.com/tyler-smith/go-bip39 v1.1.0
go: downloading golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
go: downloading github.com/btcsuite/btcd/btcutil v1.1.3
go: downloading github.com/gobwas/httphead v0.1.0
go: downloading github.com/gobwas/ws v1.2.0
go: downloading github.com/puzpuzpuz/xsync/v2 v2.5.1
go: downloading github.com/tidwall/gjson v1.14.4
go: downloading golang.org/x/net v0.8.0
go: downloading github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e
go: downloading github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec
go: downloading golang.org/x/crypto v0.7.0
go: downloading github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
go: downloading github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2
go: downloading github.com/josharian/intern v1.0.0
go: downloading github.com/tidwall/match v1.1.1
go: downloading github.com/tidwall/pretty v1.2.0
go: downloading github.com/gobwas/pool v0.2.1
go: downloading github.com/decred/dcrd/crypto/blake256 v1.0.1
# github.com/nbd-wtf/go-nostr/binary [github.com/nbd-wtf/go-nostr/binary.test]

sweep-ai[bot] avatar Jan 01 '24 15:01 sweep-ai[bot]