Skip to content

add detect ip check #7

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

Merged
merged 2 commits into from
Jun 1, 2017
Merged

add detect ip check #7

merged 2 commits into from
Jun 1, 2017

Conversation

mnaboka
Copy link
Contributor

@mnaboka mnaboka commented Jun 1, 2017

No description provided.

@mnaboka mnaboka force-pushed the mnaboka/add-checks branch from 9636ec1 to 99ea75a Compare June 1, 2017 18:16
cmd/ip_check.go Outdated
return "", 0, errors.Errorf("detect_ip returned stderr: %s", string(stderr))
}

trimmedIP := bytes.Trim(stdout, "\n")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could also use bytes.TrimSpace here.

cmd/ip_check.go Outdated

ip := net.ParseIP(string(trimmedIP))
if ip == nil {
return "", 0, errors.Errorf("invalid IP address %s", string(stdout))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need string(stdout) here? I am pretty sure the formatting parameter %s will do that implicitly.

@mnaboka mnaboka force-pushed the mnaboka/add-checks branch from 99ea75a to fc01fe4 Compare June 1, 2017 18:48
@mnaboka mnaboka merged commit 1d2d69d into master Jun 1, 2017
@mnaboka mnaboka deleted the mnaboka/add-checks branch June 1, 2017 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants