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 #!/bin/bash
set -ve 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 \ go get -u \
golang.org/x/tools/cmd/goimports \
github.com/mailru/easyjson/easyjson \ github.com/mailru/easyjson/easyjson \
github.com/valyala/quicktemplate/qtc github.com/valyala/quicktemplate/qtc
date +%s > .last
fi
set -ve
go generate go generate
gofmt -w -s templates/*.go gofmt -w -s templates/*.go

View File

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