diff --git a/cmd/wol/alias.go b/cmd/wol/alias.go index 6f6019d..ab5bcdd 100644 --- a/cmd/wol/alias.go +++ b/cmd/wol/alias.go @@ -164,5 +164,3 @@ func (a *Aliases) Close() error { return a.db.Close() } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/cmd/wol/alias_test.go b/cmd/wol/alias_test.go index 1cfc387..306f4dd 100644 --- a/cmd/wol/alias_test.go +++ b/cmd/wol/alias_test.go @@ -213,5 +213,3 @@ func (suite *AliasDBTests) TestGetAlias() { func TestRunAllSuites(t *testing.T) { suite.Run(t, new(AliasDBTests)) } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/cmd/wol/usage.go b/cmd/wol/usage.go index 18a0f1f..d3e4f67 100644 --- a/cmd/wol/usage.go +++ b/cmd/wol/usage.go @@ -99,5 +99,3 @@ func isValidCommand(s string) bool { } return false } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/cmd/wol/version.go b/cmd/wol/version.go deleted file mode 100644 index e16ad22..0000000 --- a/cmd/wol/version.go +++ /dev/null @@ -1,35 +0,0 @@ -/* -wol is a command line Magic Packet generator to enable remote Wake-on-LAN. - -// TODO: Better package comment - -Here are some examples of common usage: - -Wake up a machine with mac address 00:11:22:aa:bb:cc - wol wake 00:11:22:aa:bb:cc - -Store an alias - wol alias skynet 00:11:22:aa:bb:cc - -Wake up a machine using an alias - wol wake skynet - -View all aliases and corresponding MAC addresses - wol list - -Delete an alias - wol remove skynet - -Specify the Broadcast Port and IP - wol wake 00:11:22:aa:bb:cc -b 255.255.255.255 -p 7 - wol wake skynet --bcast 255.255.255.255 --port 7 - -*/ -package main - -//////////////////////////////////////////////////////////////////////////////// - -// Version represents the current Semantic Version of this application -const Version = "1.0.2" - -//////////////////////////////////////////////////////////////////////////////// diff --git a/cmd/wol/version_gen.go b/cmd/wol/version_gen.go new file mode 100644 index 0000000..864d276 --- /dev/null +++ b/cmd/wol/version_gen.go @@ -0,0 +1,13 @@ +package main + +// WARNING: Auto generated version file. Do not edit this file by hand. +// WARNING: go get github.com/sabhiram/gover to manage this file. +// Version: 1.0.3 + +const ( + Major = 1 + Minor = 0 + Patch = 3 + + Version = "1.0.3" +) diff --git a/cmd/wol/wol.go b/cmd/wol/wol.go index dcf47d0..6c51523 100644 --- a/cmd/wol/wol.go +++ b/cmd/wol/wol.go @@ -167,16 +167,16 @@ func main() { parser := flags.NewParser(&Options, flags.Default & ^flags.HelpFlag) args, err = parser.Parse() - exitCode := 0 + ec := 0 switch { // Parse Error, print usage case err != nil: - exitCode = printUsageGetExitCode("", 1) + ec = printUsageGetExitCode("", 1) // No arguments, or help requested, print usage case len(os.Args) == 1 || Options.Help: - exitCode = printUsageGetExitCode("", 0) + ec = printUsageGetExitCode("", 0) // "--version" requested case Options.Version: @@ -184,7 +184,7 @@ func main() { // Make sure we are being asked to run a something case len(args) == 0: - exitCode = printUsageGetExitCode("No command specified, see usage:\n", 1) + ec = printUsageGetExitCode("No command specified, see usage:\n", 1) // All other cases go here case true: @@ -197,11 +197,9 @@ func main() { if err != nil { fmt.Printf("%s\n", err.Error()) - exitCode = 1 + ec = 1 } } - os.Exit(exitCode) + os.Exit(ec) } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/magic_packet.go b/magic_packet.go index d3bad37..b723efc 100644 --- a/magic_packet.go +++ b/magic_packet.go @@ -136,14 +136,12 @@ func SendMagicPacket(macAddr, bcastAddr, iface string) error { defer connection.Close() // Write the bytes of the MagicPacket to the connection - bytesWritten, err := connection.Write(buf.Bytes()) + n, err := connection.Write(buf.Bytes()) if err != nil { return err - } else if bytesWritten != 102 { - fmt.Printf("Warning: %d bytes written, %d expected!\n", bytesWritten, 102) + } else if n != 102 { + fmt.Printf("Warning: %d bytes written, %d expected!\n", n, 102) } return nil } - -//////////////////////////////////////////////////////////////////////////////// diff --git a/magic_packet_test.go b/magic_packet_test.go index 5d38340..1362790 100644 --- a/magic_packet_test.go +++ b/magic_packet_test.go @@ -78,5 +78,3 @@ func TestGetIpFromInterfaceNegative(t *testing.T) { assert.NotNil(t, err) } } - -////////////////////////////////////////////////////////////////////////////////