Skip to content

Inverted bool in type Decoder docs #34

@JASKevinWhite

Description

@JASKevinWhite

In the doc page for type Decode, located:

https://pkg.go.dev/github.com/openrdap/rdap#Decoder

it says 👍

result, err := d.Decode()

if err != nil {
  if domain, ok := result.(*rdap.Domain); ok {
    fmt.Printf("Domain name = %s\n", domain.LDHName)
  }
}

I know this is just sample code (and thanks for having it there, it is exactly what I needed), but I think the err check is inverted. You want to go into the block and cast the result if the decode didn't have an error...if err == nil.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions