]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
device: remove deviceStateNew
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 9 Feb 2021 14:39:19 +0000 (15:39 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 9 Feb 2021 14:39:19 +0000 (15:39 +0100)
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 <Jason@zx2c4.com>
device/device.go
device/devicestate_string.go
go.sum

index 041739700fcbdb59c6d44f85d509dcf0d399d383..1641c3b08b208a8c815ef6a6467e78ab1de42699 100644 (file)
@@ -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
 )
index e8f16b0514eb9bc12a9d9a444fdef45cdc4d797a..6577dd4047702940e336e13e67c9e1c06b346c41 100644 (file)
@@ -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) {
diff --git a/go.sum b/go.sum
index a58d796640af29276a1345d53c764019c433edc1..62a8501763ae49e21c6b92be4655071e9309a880 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -13,4 +13,5 @@ golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXR
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e h1:FDhOuMEY4JVRztM/gsbk+IKUQ8kj74bxZrgw87eMMVc=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=