package main type Error int const ( ErrorUnknownOpcode Error = iota ErrorDivideByZero ErrorWrongOperandCount ErrorNegativeShiftAmount ) func (err Error) Error () (description string) { switch err { case ErrorUnknownOpcode: description = "unknown opcode" case ErrorDivideByZero: description = "division by zero" case ErrorWrongOperandCount: description = "wrong operand amount" case ErrorNegativeShiftAmount: description = "negative shift amount" } return }