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

Allow go2idl to generate non-Go file types #17853

Merged
merged 1 commit into from
Nov 29, 2015

Conversation

smarterclayton
Copy link
Contributor

Remove some indentation from file generation for specific languages,
allow SnippetWriter's io.Writer to be accessed, and add Path to
types.Name for languages where Package and Path can be disjoint.

Extracted from #16649, prereq for protobuf generation support.

@k8s-github-robot
Copy link

Labelling this PR as size/L

@k8s-github-robot k8s-github-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 27, 2015
@k8s-bot
Copy link

k8s-bot commented Nov 27, 2015

GCE e2e test build/test passed for commit cf08e17f63e3de23268053567f47488c1efc03fe.

@wojtek-t wojtek-t assigned wojtek-t and unassigned dchen1107 Nov 27, 2015
@wojtek-t
Copy link
Member

@smarterclayton - it seems that something doesn't compile correctly:

16:22:23 # k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators
16:22:23 /go/src/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators/generator-for-type.go:57: too few values in struct initializer
16:22:23 /go/src/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators/generator-for-type.go:58: too few values in struct initializer
16:22:23 /go/src/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators/generator-for-type.go:59: too few values in struct initializer
16:22:23 /go/src/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators/generator-for-type.go:60: too few values in struct initializer
16:22:23 /go/src/k8s.io/kubernetes/cmd/libs/go2idl/client-gen/generators/generator-for-type.go:61: too few values in struct initializer

Can you please fix it?

}

// format should be one line only, and not end with \n.
func addIndentHeaderComment(b *bytes.Buffer, format string, args ...interface{}) {
if b.Len() > 0 {
fmt.Fprintf(b, "\n\t// "+format+"\n", args...)
fmt.Fprintf(b, "\n// "+format+"\n", args...)
Copy link
Member

Choose a reason for hiding this comment

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

nit: I'm not sure we need it - it will be added by gofmt anyway (note that the whole code is not formatted, to formatting just these comments makes it non-consistent).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, and it makes formatting proto idl (which has no gofmt equivalent)
harder.

On Nov 27, 2015, at 5:20 AM, Wojciech Tyczynski notifications@github.com
wrote:

In cmd/libs/go2idl/generator/execute.go
#17853 (comment):

}

// format should be one line only, and not end with \n.
func addIndentHeaderComment(b *bytes.Buffer, format string, args ...interface{}) {
if b.Len() > 0 {

  • fmt.Fprintf(b, "\n\t// "+format+"\n", args...)
    
  • fmt.Fprintf(b, "\n// "+format+"\n", args...)
    

nit: I'm not sure we need it - it will be added by gofmt anyway (note that
the whole code is not formatted, to formatting just these comments makes it
non-consistent).


Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/17853/files#r46033739.

Copy link
Member

Choose a reason for hiding this comment

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

That's a good point.
I'm completely fine with adding it, although, I'm not sure if that helps much for protos (but probably it's better with that).

@wojtek-t
Copy link
Member

LGTM - (just two very minor comments).

Feel-free to self-lgtm after fixing compile errors

@smarterclayton
Copy link
Contributor Author

Ah, new code. Will fix.

@wojtek-t
Copy link
Member

@smarterclayton - thanks

LGTM
Feel free to self-apply LGTM label after fixing the compile errors.

@smarterclayton smarterclayton added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 28, 2015
@smarterclayton
Copy link
Contributor Author

Errors fixed, applying LGTM

@k8s-github-robot
Copy link

Continuous integration appears to have missed, closing and re-opening to trigger it

@smarterclayton
Copy link
Contributor Author

@k8s-bot unit test this

@k8s-bot
Copy link

k8s-bot commented Nov 28, 2015

GCE e2e test build/test passed for commit c0ea45520cc1b1a0f2b7e19ec3aa872e9ee7594b.

Remove some indentation from file generation for specific languages,
allow SnippetWriter's io.Writer to be accessed, and add Path to
types.Name for languages where Package and Path can be disjoint.
@k8s-github-robot
Copy link

PR changed after LGTM, removing LGTM.

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 28, 2015
@k8s-bot
Copy link

k8s-bot commented Nov 28, 2015

GCE e2e build/test failed for commit 72df8bb.

@smarterclayton
Copy link
Contributor Author

ok to test

@k8s-bot
Copy link

k8s-bot commented Nov 29, 2015

GCE e2e test build/test passed for commit 72df8bb.

@smarterclayton smarterclayton added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 29, 2015
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Nov 29, 2015

GCE e2e test build/test passed for commit 72df8bb.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Nov 29, 2015

GCE e2e test build/test passed for commit 72df8bb.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Nov 29, 2015
@k8s-github-robot k8s-github-robot merged commit 585a876 into kubernetes:master Nov 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants