Add gokrazy build tags
This commit is contained in:
parent
fc12ae41ad
commit
ae85cf1cea
20
cmd.go
Normal file
20
cmd.go
Normal file
@ -0,0 +1,20 @@
|
||||
//go:build !gokrazy
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if os.Getenv("GCD_USERNAME") == "" || os.Getenv("GCD_PASSWORD") == "" {
|
||||
log.Println("Username and password not provided")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
createDirs()
|
||||
|
||||
downlod()
|
||||
}
|
32
gokrazy.go
Normal file
32
gokrazy.go
Normal file
@ -0,0 +1,32 @@
|
||||
//go:build gokrazy
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/gokrazy/gokrazy"
|
||||
)
|
||||
|
||||
|
||||
|
||||
func main() {
|
||||
gokrazy.WaitForClock()
|
||||
flag.Parse()
|
||||
if os.Getenv("GCD_USERNAME") == "" || os.Getenv("GCD_PASSWORD") == "" {
|
||||
log.Println("Username and password not provided")
|
||||
os.Exit(0)
|
||||
}
|
||||
for {
|
||||
createDirs()
|
||||
if shouldUpdate() {
|
||||
downlod()
|
||||
log.Println("update complete, waiting 1h to check again")
|
||||
} else {
|
||||
log.Println("It's too early, waiting 1h to check again")
|
||||
}
|
||||
time.Sleep(time.Hour)
|
||||
}
|
||||
}
|
18
main.go
18
main.go
@ -278,21 +278,3 @@ func shouldUpdate() bool {
|
||||
log.Printf("can't update for another %v", timeTillUpdate)
|
||||
return false
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if os.Getenv("GCD_USERNAME") == "" || os.Getenv("GCD_PASSWORD") == "" {
|
||||
log.Println("Username and password not provided")
|
||||
os.Exit(0)
|
||||
}
|
||||
for {
|
||||
createDirs()
|
||||
if shouldUpdate() {
|
||||
downlod()
|
||||
log.Println("update complete, waiting 1h to check again")
|
||||
} else {
|
||||
log.Println("It's too early, waiting 1h to check again")
|
||||
}
|
||||
time.Sleep(time.Hour)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user