Skip to content

[Go] Refactor go error by centralized error state and lazy raise #3026

Description

@chaokunyang

Feature Request

No response

Is your feature request related to a problem? Please describe

Current we return error in every function call, and check error in every place, the code is kind of messy:

	if writeRef {
		if value.IsNil() {
			ctx.Buffer().WriteInt8(NullFlag)
			return nil
		}
		refWritten, err := ctx.RefResolver().WriteRefOrNull(ctx.Buffer(), value)
		if err != nil {
			return err
		}
		if refWritten {
			return nil
		}
	}

Describe the solution you'd like

Use centralized error state in WriteContext/ReadContext to simplify error handle, as we did in c++ #3009

Describe alternatives you've considered

No response

Additional context

#2982

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions