Skip to content

logging: aoid json.marshall for proto objects #7785

@daniel-sanche

Description

@daniel-sanche

Error report:

one of our static analysis tools found a bug in PR #7083

The error message is

do not call encoding/json.Marshal on composite types containing protobuf message types

The explanation is go/goprotoapi-findings#message-goreflect-json

The line in question is

data, err := json.Marshal(Alias(s))

It might be a false positive but you should probably take a look.

It appears that we need to write custom MarshalJSON functions for the proto types that make up structuredLogEntry

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the Cloud Logging API.priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions