Telegraf processor convert : use of int16() int64()

Hi, I’m trying to integrate the processor converter, adding the HEX string to integer conversion:

result, err: = strconv.ParseInt (value, 16, 64)

The problem is that the ParseInt function returns an int64 and how much I try to do the conversion to int16 (the starting HEX string is 16 bit and to take the sign into account I have to do a conversion to int16):
i16: = int16 (result)

return i16, true
The system seems to completely ignore this instruction, always returning the representation of the number to int64.


thanks for your patience


Are you just looking for the Go code to convert a hex string to a string? Luckily it’s pretty easy you can just use hex.DecodeString to handle it, check the example code included with the link.