Skip to content

protoc-gen-go generator missing type in printer #517

Closed
@Tommy-42

Description

@Tommy-42

Hello I had a strange error today while trying to generate some custom code:
2018/02/19 14:10:09 protoc-gen-gogo: error:unknown type in printer: int64

Looking into the P() implementation I am seeing

func (g *Generator) P(str ...interface{}) {
	if !g.writeOutput {
		return
	}
	g.WriteString(g.indent)
	for _, v := range str {
		switch s := v.(type) {
 			...
		case int:
			fmt.Fprintf(g, "%d", s)
		case *int32:
			fmt.Fprintf(g, "%d", *s)
		case *int64:
			fmt.Fprintf(g, "%d", *s)
		case float64:
			fmt.Fprintf(g, "%g", s)
		case *float64:
			fmt.Fprintf(g, "%g", *s)
		default:
			g.Fail(fmt.Sprintf("unknown type in printer: %T", v))
		}
	}
	g.WriteByte('\n')
}

There is no case for case int32: && case int64: ? there is any reason for that ?

If not, an open a PR is available.

Best regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions