Skip to content

pkg/generator: add stub/handler.go generator#32

Merged
fanminshi merged 1 commit intooperator-framework:masterfrom
fanminshi:gen_stub
Feb 21, 2018
Merged

pkg/generator: add stub/handler.go generator#32
fanminshi merged 1 commit intooperator-framework:masterfrom
fanminshi:gen_stub

Conversation

@fanminshi
Copy link
Copy Markdown
Contributor

No description provided.

@fanminshi
Copy link
Copy Markdown
Contributor Author

manual test:

func TestGenHandler(t *testing.T) {
	buf := &bytes.Buffer{}
	if err := renderHandler(buf); err != nil {
		t.Error(err)
		return
	}
	if err := ioutil.WriteFile("./handler.go", buf.Bytes(), 0644); err != nil {
		t.Error(err)
	}
}

Output:

package stub

import (
	"github.com/coreos/operator-sdk/pkg/sdk/types"
)

type Handler struct {
	// Fill me
}

func (h *Handler) Handle(ctx types.Context, event types.Event) {
	// Fill me
}

@fanminshi
Copy link
Copy Markdown
Contributor Author

cc/ @hongchaodeng @hasbro17

@fanminshi fanminshi mentioned this pull request Feb 21, 2018
21 tasks
Comment thread pkg/generator/gen_handler.go Outdated
}

// renderHandler generates the stub/handler.go file.
// for example:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this example. Developers can look into the template directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure will remove.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@hongchaodeng
Copy link
Copy Markdown
Contributor

LGTM after nit

@fanminshi fanminshi merged commit 8f89af9 into operator-framework:master Feb 21, 2018
@hasbro17 hasbro17 deleted the gen_stub branch February 21, 2018 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants