ROOTPLOIT
Server: LiteSpeed
System: Linux in-mum-web1878.main-hosting.eu 5.14.0-570.21.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 11 07:22:35 EDT 2025 x86_64
User: u435929562 (435929562)
PHP: 7.4.33
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/go/pkg/mod/github.com/gogo/[email protected]/test/jsonpb-gogo/jsonpb_gogo_test.go
package jsonpb_gogo

import (
	"testing"

	"github.com/gogo/protobuf/jsonpb"
)

// customFieldMessage implements protobuf.Message but is not a normal generated message type.
type customFieldMessage struct {
	someField string //this is not a proto field
}

func (m *customFieldMessage) Reset() {
	m.someField = "hello"
}

func (m *customFieldMessage) String() string {
	return m.someField
}

func (m *customFieldMessage) ProtoMessage() {
}

func TestUnmarshalWithJSONPBUnmarshaler(t *testing.T) {
	rawJson := `{}`
	marshaler := &jsonpb.Marshaler{}
	msg := &customFieldMessage{someField: "Ignore me"}
	str, err := marshaler.MarshalToString(msg)
	if err != nil {
		t.Errorf("an unexpected error occurred when marshaling message: %v", err)
	}
	if str != rawJson {
		t.Errorf("marshaled JSON was incorrect: got %s, wanted %s", str, rawJson)
	}
}