Skip to content

Commit

Permalink
refactor: make Platform's receiver to pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke committed Jan 24, 2021
1 parent 32369fd commit 27e130b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (runner *Runner) execAction(c *cli.Context) error {

var pt api.Platform
if p, f := platform.Get(); f {
pt = p
pt = &p
}

cfgReader := config.Reader{
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (runner *Runner) postAction(c *cli.Context) error {

var pt api.Platform
if p, f := platform.Get(); f {
pt = p
pt = &p
}

cfgReader := config.Reader{
Expand Down
6 changes: 3 additions & 3 deletions pkg/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Platform struct {
Platform cienv.Platform
}

func (pt Platform) ComplementPost(opts *option.PostOptions) error {
func (pt *Platform) ComplementPost(opts *option.PostOptions) error {
if opts.Org == "" {
opts.Org = pt.Platform.RepoOwner()
}
Expand All @@ -34,14 +34,14 @@ func (pt Platform) ComplementPost(opts *option.PostOptions) error {
return nil
}

func (pt Platform) CI() string {
func (pt *Platform) CI() string {
if pt.Platform == nil {
return ""
}
return pt.Platform.CI()
}

func (pt Platform) ComplementExec(opts *option.ExecOptions) error {
func (pt *Platform) ComplementExec(opts *option.ExecOptions) error {
if opts.Org == "" {
opts.Org = pt.Platform.RepoOwner()
}
Expand Down

0 comments on commit 27e130b

Please sign in to comment.