style: using effective go and refactoring

This commit is contained in:
Kay
2023-08-21 20:17:25 +08:00
committed by fiatjaf_
parent abb66db97e
commit ac2350c722
17 changed files with 81 additions and 68 deletions

View File

@@ -9,7 +9,7 @@ import (
"github.com/nbd-wtf/go-nostr/nip19"
)
// InputToProfile turns any npub/nprofile/hex/nip05 input into a ProfilePointer (or nil)
// InputToProfile turns any npub/nprofile/hex/nip05 input into a ProfilePointer (or nil).
func InputToProfile(ctx context.Context, input string) *nostr.ProfilePointer {
// handle if it is a hex string
if len(input) == 64 {
@@ -38,7 +38,7 @@ func InputToProfile(ctx context.Context, input string) *nostr.ProfilePointer {
return nil
}
// InputToEventPointer turns any note/nevent/hex input into a EventPointer (or nil)
// InputToEventPointer turns any note/nevent/hex input into a EventPointer (or nil).
func InputToEventPointer(input string) *nostr.EventPointer {
// handle if it is a hex string
if len(input) == 64 {

View File

@@ -33,7 +33,7 @@ func ParseReferences(evt *nostr.Event) []*Reference {
}
if ref[6] == -1 {
// didn't find a NIP-10 #[0] reference, so it's it's a NIP-27 mention
// didn't find a NIP-10 #[0] reference, so it's a NIP-27 mention
nip19code := content[ref[2]:ref[3]]
if prefix, data, err := nip19.Decode(nip19code); err == nil {