mirror of
https://github.com/jwetzell/osc-go.git
synced 2026-08-27 09:09:03 +00:00
cleanup logging and panics
This commit is contained in:
+4
-10
@@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ func integerToOSCBytes(number int32) []byte {
|
|||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
err := binary.Write(&buf, binary.BigEndian, number)
|
err := binary.Write(&buf, binary.BigEndian, number)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("binary.Write failed:", err)
|
panic(err)
|
||||||
}
|
}
|
||||||
return buf.Bytes()
|
return buf.Bytes()
|
||||||
}
|
}
|
||||||
@@ -52,7 +51,7 @@ func floatToOSCBytes(number float32) []byte {
|
|||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
err := binary.Write(&buf, binary.BigEndian, number)
|
err := binary.Write(&buf, binary.BigEndian, number)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("binary.Write failed:", err)
|
panic(err)
|
||||||
}
|
}
|
||||||
return buf.Bytes()
|
return buf.Bytes()
|
||||||
}
|
}
|
||||||
@@ -142,10 +141,6 @@ func main() {
|
|||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "sendosc",
|
Use: "sendosc",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Println(Host)
|
|
||||||
fmt.Println(Port)
|
|
||||||
fmt.Println(Address)
|
|
||||||
fmt.Println(Args)
|
|
||||||
send(Host, Port, Address, Args, Types, Protocol, Slip)
|
send(Host, Port, Address, Args, Types, Protocol, Slip)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -223,7 +218,6 @@ func send(host string, port int32, address string, args []string, types []string
|
|||||||
|
|
||||||
oscArgs = append(oscArgs, argToTypedArg(arg, oscType))
|
oscArgs = append(oscArgs, argToTypedArg(arg, oscType))
|
||||||
}
|
}
|
||||||
fmt.Println(oscArgs)
|
|
||||||
|
|
||||||
oscMessage := OSCMessage{
|
oscMessage := OSCMessage{
|
||||||
Address: address,
|
Address: address,
|
||||||
@@ -240,12 +234,12 @@ func send(host string, port int32, address string, args []string, types []string
|
|||||||
conn, err := net.Dial(protocol, netAddress)
|
conn, err := net.Dial(protocol, netAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Dial err %v", err)
|
fmt.Printf("Dial err %v", err)
|
||||||
os.Exit(-1)
|
panic(err)
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
if _, err = conn.Write([]byte(oscMessageBuffer)); err != nil {
|
if _, err = conn.Write([]byte(oscMessageBuffer)); err != nil {
|
||||||
fmt.Printf("Write err %v", err)
|
fmt.Printf("Write err %v", err)
|
||||||
os.Exit(-1)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user