1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
package main
import (
"fmt"
"git.sr.ht/~poptart/x/ua"
"os"
)
func main() {
if _, err := os.Stat("/home/poptart/.config/hosaka_uacache"); err == nil {
b, _ := useragent.GetUACache("/home/poptart/.config/hosaka_uacache")
fmt.Println(b.UserAgent)
} else if os.IsNotExist(err) {
e := useragent.SaveUACache("/home/poptart/.config/hosaka_uacache")
if e != nil {
fmt.Println(e)
}
}
}