Minor changes to chromedp-gen/build.sh

This commit is contained in:
Kenneth Shaw 2017-06-17 07:56:52 +07:00
parent 74075d513f
commit 57160a279e
3 changed files with 24 additions and 4 deletions

1
cmd/chromedp-gen/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.last

View File

@ -1,10 +1,26 @@
#!/bin/bash
set -ve
go get -u \
github.com/mailru/easyjson/easyjson \
github.com/valyala/quicktemplate/qtc
UPDATE=0
LASTUPDATE=0
if [ -f .last ]; then
LASTUPDATE=$(cat .last)
fi
NOW=$(date +%s)
if (( "$NOW" >= $(($LASTUPDATE + 86400*5)) )); then
UPDATE=1
fi
if [[ "$UPDATE" == 1 ]]; then
go get -u \
golang.org/x/tools/cmd/goimports \
github.com/mailru/easyjson/easyjson \
github.com/valyala/quicktemplate/qtc
date +%s > .last
fi
set -ve
go generate
gofmt -w -s templates/*.go

View File

@ -19,6 +19,7 @@ const (
DomainConsole DomainType = "Console"
DomainDOM DomainType = "DOM"
DomainDOMDebugger DomainType = "DOMDebugger"
DomainDOMSnapshot DomainType = "DOMSnapshot"
DomainDOMStorage DomainType = "DOMStorage"
DomainDatabase DomainType = "Database"
DomainDebugger DomainType = "Debugger"
@ -83,6 +84,8 @@ func (dt *DomainType) UnmarshalJSON(buf []byte) error {
*dt = DomainDOM
case DomainDOMDebugger:
*dt = DomainDOMDebugger
case DomainDOMSnapshot:
*dt = DomainDOMSnapshot
case DomainDOMStorage:
*dt = DomainDOMStorage
case DomainDatabase: