Skip to content

Json Marshaling Error in Lookup #28

Open
@trvsysadmin

Description

@trvsysadmin

In file lookup.go, line 55, there seems to be an inconsistency of the struct used to marshal the json returned by nsqdlookup. Currently it is:

v := struct {
  StatusCode int          `json:"status_code"`
  StatusTxt  string       `json:"status_txt"`
  Data       LookupResult `json:"data"`
}{}

whereas v should simply be

v := LookupResult{}

Because http://nsqd/lookup?topic=hello returns

{
	"channels": ["chan1", "world"],
	"producers": [{
		"remote_address": "127.0.0.1:34444",
		"hostname": "blah",
		"broadcast_address": "blah",
		"tcp_port": 4150,
		"http_port": 4151,
		"version": "1.0.0-compat"
	}]
}

Did we do something wrong or misunderstood something? Were you supposed to insert StatusCode and StatusTxt into retList when you call c.doAll in line 39?

Note: We are using nsq 1.0.0-compat (https://github.com/nsqio/nsq/releases/tag/v1.0.0-compat) on standard Ubuntu 16 .

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