cleanups to startup code and goroutine code
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"net"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -172,17 +171,6 @@ func Map[A, B any](in []A, fn func(A) B) []B {
|
||||
return rc
|
||||
}
|
||||
|
||||
// MyIPAddress returns the local IP address of this machine.
|
||||
func MyIPAddress() (net.IP, error) {
|
||||
conn, err := net.Dial("udp", "8.8.8.8:80")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer conn.Close()
|
||||
localAddr := conn.LocalAddr().(*net.UDPAddr)
|
||||
return localAddr.IP, nil
|
||||
}
|
||||
|
||||
// IIF is an "immediate-if" function returning its second argument if the first one is true, the third one if not.
|
||||
func IIF[A any](expr bool, v1, v2 A) A {
|
||||
if expr {
|
||||
|
||||
Reference in New Issue
Block a user