Skip to content
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

Make skip_download a boolean instead of string #37

Merged
merged 2 commits into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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