Skip to content
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

Json Marshaling Error in Lookup #28

Open
trvsysadmin opened this issue Jun 28, 2018 · 4 comments
Open

Json Marshaling Error in Lookup #28

trvsysadmin opened this issue Jun 28, 2018 · 4 comments

Comments

@trvsysadmin
Copy link

trvsysadmin commented Jun 28, 2018

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 .

@achille-roussel
Copy link
Contributor

It might be an API that changed between nsq 0.3.8 and 1.0, we are still on 0.3.8 at segment so it may be why we haven’t had issues with it.

If you want to send a fix I’ll be happy to take a look and merge it.

@abourget
Copy link

Hit that issue too. PR coming..

@abourget
Copy link

#35

@zljohn-ux
Copy link

please fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants