Skip to content

protoc-gen-go: XXX_ fields break code back compatibility #607

Closed
@sitano

Description

@sitano

having []byte XXX_ fields in generated code prevents those structs to be able to be compared by value.

package main

import (
	"fmt"
)

type Hash struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func main() {
	fmt.Println(Hash{} == Hash{})
}

This breaks an existent code.

Another argument to the issue #276

Even if the []byte field will be removed, those third-party states being embed into the structs makes it pointless.

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