Skip to content

Commit

Permalink
Merge pull request #37 from telia-oss/make-skip-download-boolean
Browse files Browse the repository at this point in the history
Make skip_download a boolean instead of string
  • Loading branch information
Kristian authored Sep 24, 2018
2 parents 243aad4 + ab60c8f commit e61d418
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions in.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@ import (

// Get (business logic)
func Get(request GetRequest, github Github, git Git, outputDir string) (*GetResponse, error) {
if request.Params.SkipDownload != "" {
skipDownload, err := strconv.ParseBool(request.Params.SkipDownload)
if err != nil {
return nil, fmt.Errorf("failed to parse skip_download: %s", err)
}
if skipDownload {
return &GetResponse{Version: request.Version}, nil
}
if request.Params.SkipDownload {
return &GetResponse{Version: request.Version}, nil
}

pull, err := github.GetPullRequest(request.Version.PR, request.Version.Commit)
Expand Down Expand Up @@ -86,7 +80,7 @@ func Get(request GetRequest, github Github, git Git, outputDir string) (*GetResp

// GetParameters ...
type GetParameters struct {
SkipDownload string `json:"skip_download"`
SkipDownload bool `json:"skip_download"`
}

// GetRequest ...
Expand Down
2 changes: 1 addition & 1 deletion in_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestGetSkipDownload(t *testing.T) {
Commit: "commit1",
CommittedDate: time.Time{},
},
parameters: resource.GetParameters{SkipDownload: "true"},
parameters: resource.GetParameters{SkipDownload: true},
},
}

Expand Down

0 comments on commit e61d418

Please sign in to comment.