-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use new CreateBuildWithUploadUrl endpoint #38
Conversation
internal/commands/build.go
Outdated
if err != nil { | ||
return err | ||
} | ||
print("\n") |
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.
Is this necessary with our logger?
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.
yea because I have \r
in the preceding line, this prevents the next line from mixing characters with the upload progress line
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.
could do something where i'm like "if progress == 100% then use \n otherwise use \r" if you'd prefer
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.
It might be more concise having this line be printed by the processReader.
progressReader := &progressReaderType{
reader: file,
total: fileSize,
callback: func(percentage float64, loaded int64, total int64, eof bool) {
if !eof {
logger.Info(fmt.Sprintf("Upload progress: %.2f%% (%d/%d bytes)\r", percentage, loaded, total))
} else {
logger.Info(fmt.Sprintf("Upload complete: %d bytes\n", total))
}
},
}
func (pr *progressReaderType) Read(p []byte) (int, error) {
n, err := pr.reader.Read(p)
if err != nil && err == io.EOF {
pr.callback(percentage, pr.read, pr.total, true)
}
if n > 0 {
pr.read += int64(n)
percentage := float64(pr.read) / float64(pr.total) * 100
pr.callback(percentage, pr.read, pr.total, false)
}
return n, err
}
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.
ooh yea i like that
Co-authored-by: jared-gs <jared-gs@users.noreply.github.com>
…o gp/use-new-build-endpoint
Switch to using CreateBuildWithUploadUrl