-
Notifications
You must be signed in to change notification settings - Fork 585
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
Implement starting instances from a HTTP URL #276
Conversation
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tested with
limactl start https://raw.githubusercontent.com/lima-vm/lima/master/examples/podman.yaml
Thanks! |
return nil, err | ||
} | ||
defer resp.Body.Close() | ||
yBytes, err = io.ReadAll(resp.Body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check body size before calling ReadAll
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for jumping the gun on merging already 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, hopefully it would return an error in that case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just used the https://pkg.go.dev/net/http sample code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use https://pkg.go.dev/io#LimitedReader and it raises io.EOF when it reaches the limit (e.g., 1MB).
We should wrap the io.EOF error with a human-readable text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, so it was limit "protection" rather than looking for zero bytes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but wouldn't the same thing happen with a local file as well ?
yBytes, err = os.ReadFile(arg)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR: #279
Follow-up to `Implement starting instances from a HTTP URL ` (#276)
Closes #237