How can I make the custom type (Decimal struct that wraps math/big.Int) display correctly in VSCode or Delve debugger?

3 weeks ago 26
ARTICLE AD BOX

I have a custom type defined as follows:

// Package link: https://github.com/shopspring/decimal // type Decimal struct { inner decimal.Decimal }

decimal.Decimal wraps math/big.Int internally.

While debugging, I am facing an issue where the values displayed in VSCode are not human-readable.

My Decimal type implements the following methods:

String() GoString() MarshalText()

Is there a way to configure VSCode or the Delve debugger to use these methods to display the Decimal values correctly when hovering over the variable or in the Debug Console?

Sharing the current Debug screenshoot

Read Entire Article