weldr/upload: uploadRequestToTarget() cannot fail

Drop the error return and simplify code accordingly.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-03-24 01:19:52 +01:00
parent 87b0bb6e5d
commit c66db42677
2 changed files with 5 additions and 14 deletions

View file

@ -13,7 +13,7 @@ import (
)
type uploadResponse struct {
Uuid uuid.UUID `json:"uuid"`
UUID uuid.UUID `json:"uuid"`
Status common.ImageBuildState `json:"status"`
ProviderName string `json:"provider_name"`
ImageName string `json:"image_name"`
@ -87,7 +87,7 @@ func targetsToUploadResponses(targets []*target.Target) []uploadResponse {
var uploads []uploadResponse
for _, t := range targets {
upload := uploadResponse{
Uuid: t.Uuid,
UUID: t.Uuid,
Status: t.Status,
ImageName: t.ImageName,
CreationTime: float64(t.Created.UnixNano()) / 1000000000,
@ -118,7 +118,7 @@ func targetsToUploadResponses(targets []*target.Target) []uploadResponse {
return uploads
}
func uploadRequestToTarget(u uploadRequest, imageType distro.ImageType) (*target.Target, error) {
func uploadRequestToTarget(u uploadRequest, imageType distro.ImageType) *target.Target {
var t target.Target
t.Uuid = uuid.New()
@ -147,5 +147,5 @@ func uploadRequestToTarget(u uploadRequest, imageType distro.ImageType) (*target
}
}
return &t, nil
return &t
}