24 lines
462 B
Go
24 lines
462 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
appName = "weather"
|
|
appVersion = "0.1"
|
|
appRepo = "https://git.keegandeppe.com/kdeppe/weather"
|
|
appContact = "contact=19keegandeppe@gmail.com"
|
|
)
|
|
|
|
func buildUserAgent() (string, error) {
|
|
host, err := os.Hostname()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
host = strings.ReplaceAll(host, " ", "-")
|
|
return fmt.Sprintf("%s/%s (%s; %s; host=%s)", appName, appVersion, appRepo, appContact, host), nil
|
|
}
|