Files
kubesphere/vendor/github.com/projectcalico/calico/libcalico-go/lib/names/hostname.go
Yunkang Ren a3a6a1cd98 gomod: change projectcalico/calico to kubesphere/calico (#5557)
* chore(calico): update calico to 3.25.0

* chore(calico): replace projectcalico/calico to kubesphere/calico

Signed-off-by: root <renyunkang@kubesphere.io>

---------

Signed-off-by: root <renyunkang@kubesphere.io>
2023-02-28 17:03:36 +08:00

17 lines
319 B
Go

package names
import (
"os"
"strings"
)
// Hostname returns this hosts hostname, converting to lowercase so that
// it is valid for use in the Calico API.
func Hostname() (string, error) {
if h, err := os.Hostname(); err != nil {
return "", err
} else {
return strings.ToLower(strings.TrimSpace(h)), nil
}
}