From eaf664e4e9134ab7d5100d7284274a821122fbbc Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 9 Feb 2021 15:39:19 +0100 Subject: device: remove deviceStateNew It's never used and we won't have a use for it. Also, move to go-running stringer, for those without GOPATHs. Signed-off-by: Jason A. Donenfeld --- device/device.go | 14 ++++++-------- device/devicestate_string.go | 14 ++------------ 2 files changed, 8 insertions(+), 20 deletions(-) (limited to 'device') diff --git a/device/device.go b/device/device.go index 0417397..1641c3b 100644 --- a/device/device.go +++ b/device/device.go @@ -91,20 +91,18 @@ type Device struct { } // deviceState represents the state of a Device. -// There are four states: new, down, up, closed. -// However, state new should never be observable. +// There are three states: down, up, closed. // Transitions: // -// new -> down -----+ -// ↑↓ ↓ -// up -> closed +// down -----+ +// ↑↓ ↓ +// up -> closed // type deviceState uint32 -//go:generate stringer -type deviceState -trimprefix=deviceState +//go:generate go run golang.org/x/tools/cmd/stringer -type deviceState -trimprefix=deviceState const ( - deviceStateNew deviceState = iota - deviceStateDown + deviceStateDown deviceState = iota deviceStateUp deviceStateClosed ) diff --git a/device/devicestate_string.go b/device/devicestate_string.go index e8f16b0..6577dd4 100644 --- a/device/devicestate_string.go +++ b/device/devicestate_string.go @@ -4,19 +4,9 @@ package device import "strconv" -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[deviceStateNew-0] - _ = x[deviceStateDown-1] - _ = x[deviceStateUp-2] - _ = x[deviceStateClosed-3] -} - -const _deviceState_name = "NewDownUpClosed" +const _deviceState_name = "DownUpClosed" -var _deviceState_index = [...]uint8{0, 3, 7, 9, 15} +var _deviceState_index = [...]uint8{0, 4, 6, 12} func (i deviceState) String() string { if i >= deviceState(len(_deviceState_index)-1) { -- cgit v1.2.3