github.com/blueinnovationsgroup/can-go@v0.0.0-20230518195432-d0567cda0028/pkg/socketcan/transceivererror_string.go (about)

     1  // Code generated by "stringer -type TransceiverError -trimprefix TransceiverError"; DO NOT EDIT.
     2  
     3  package socketcan
     4  
     5  import "strconv"
     6  
     7  func _() {
     8  	// An "invalid array index" compiler error signifies that the constant values have changed.
     9  	// Re-run the stringer command to generate them again.
    10  	var x [1]struct{}
    11  	_ = x[TransceiverErrorUnspecified-0]
    12  	_ = x[TransceiverErrorCANHNoWire-4]
    13  	_ = x[TransceiverErrorCANHShortToBat-5]
    14  	_ = x[TransceiverErrorCANHShortToVCC-6]
    15  	_ = x[TransceiverErrorCANHShortToGND-7]
    16  	_ = x[TransceiverErrorCANLNoWire-64]
    17  	_ = x[TransceiverErrorCANLShortToBat-80]
    18  	_ = x[TransceiverErrorCANLShortToVcc-96]
    19  	_ = x[TransceiverErrorCANLShortToGND-112]
    20  	_ = x[TransceiverErrorCANLShortToCANH-128]
    21  }
    22  
    23  const (
    24  	_TransceiverError_name_0 = "Unspecified"
    25  	_TransceiverError_name_1 = "CANHNoWireCANHShortToBatCANHShortToVCCCANHShortToGND"
    26  	_TransceiverError_name_2 = "CANLNoWire"
    27  	_TransceiverError_name_3 = "CANLShortToBat"
    28  	_TransceiverError_name_4 = "CANLShortToVcc"
    29  	_TransceiverError_name_5 = "CANLShortToGND"
    30  	_TransceiverError_name_6 = "CANLShortToCANH"
    31  )
    32  
    33  var (
    34  	_TransceiverError_index_1 = [...]uint8{0, 10, 24, 38, 52}
    35  )
    36  
    37  func (i TransceiverError) String() string {
    38  	switch {
    39  	case i == 0:
    40  		return _TransceiverError_name_0
    41  	case 4 <= i && i <= 7:
    42  		i -= 4
    43  		return _TransceiverError_name_1[_TransceiverError_index_1[i]:_TransceiverError_index_1[i+1]]
    44  	case i == 64:
    45  		return _TransceiverError_name_2
    46  	case i == 80:
    47  		return _TransceiverError_name_3
    48  	case i == 96:
    49  		return _TransceiverError_name_4
    50  	case i == 112:
    51  		return _TransceiverError_name_5
    52  	case i == 128:
    53  		return _TransceiverError_name_6
    54  	default:
    55  		return "TransceiverError(" + strconv.FormatInt(int64(i), 10) + ")"
    56  	}
    57  }