github.com/jshiv/can-go@v0.2.1-0.20210224011015-069e90e90bdf/pkg/socketcan/controllererror_string.go (about)

     1  // Code generated by "stringer -type ControllerError -trimprefix ControllerError"; 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[ControllerErrorUnspecified-0]
    12  	_ = x[ControllerErrorRxBufferOverflow-1]
    13  	_ = x[ControllerErrorTxBufferOverflow-2]
    14  	_ = x[ControllerErrorRxWarning-4]
    15  	_ = x[ControllerErrorTxWarning-8]
    16  	_ = x[ControllerErrorRxPassive-16]
    17  	_ = x[ControllerErrorTxPassive-32]
    18  	_ = x[ControllerErrorActive-64]
    19  }
    20  
    21  const (
    22  	_ControllerError_name_0 = "UnspecifiedRxBufferOverflowTxBufferOverflow"
    23  	_ControllerError_name_1 = "RxWarning"
    24  	_ControllerError_name_2 = "TxWarning"
    25  	_ControllerError_name_3 = "RxPassive"
    26  	_ControllerError_name_4 = "TxPassive"
    27  	_ControllerError_name_5 = "Active"
    28  )
    29  
    30  var (
    31  	_ControllerError_index_0 = [...]uint8{0, 11, 27, 43}
    32  )
    33  
    34  func (i ControllerError) String() string {
    35  	switch {
    36  	case i <= 2:
    37  		return _ControllerError_name_0[_ControllerError_index_0[i]:_ControllerError_index_0[i+1]]
    38  	case i == 4:
    39  		return _ControllerError_name_1
    40  	case i == 8:
    41  		return _ControllerError_name_2
    42  	case i == 16:
    43  		return _ControllerError_name_3
    44  	case i == 32:
    45  		return _ControllerError_name_4
    46  	case i == 64:
    47  		return _ControllerError_name_5
    48  	default:
    49  		return "ControllerError(" + strconv.FormatInt(int64(i), 10) + ")"
    50  	}
    51  }