make some linters a bit happier

This commit is contained in:
Daniel Martí 2019-03-20 12:06:52 +00:00
parent 92bfcc3c8d
commit 61f0a8da68
4 changed files with 7 additions and 17 deletions

View File

@ -157,9 +157,9 @@ func (t *Target) processEvent(ctxt context.Context, msg *cdproto.Message) error
switch msg.Method.Domain() { switch msg.Method.Domain() {
case "Page": case "Page":
t.pageEvent(ctxt, ev) t.pageEvent(ev)
case "DOM": case "DOM":
t.domEvent(ctxt, ev) t.domEvent(ev)
} }
return nil return nil
} }
@ -194,7 +194,7 @@ func (t *Target) documentUpdated(ctxt context.Context) {
var emptyObj = easyjson.RawMessage([]byte(`{}`)) var emptyObj = easyjson.RawMessage([]byte(`{}`))
// pageEvent handles incoming page events. // pageEvent handles incoming page events.
func (t *Target) pageEvent(ctxt context.Context, ev interface{}) { func (t *Target) pageEvent(ev interface{}) {
var id cdp.FrameID var id cdp.FrameID
var op frameOp var op frameOp
@ -245,7 +245,7 @@ func (t *Target) pageEvent(ctxt context.Context, ev interface{}) {
} }
// domEvent handles incoming DOM events. // domEvent handles incoming DOM events.
func (t *Target) domEvent(ctxt context.Context, ev interface{}) { func (t *Target) domEvent(ev interface{}) {
f := t.cur f := t.cur
var id cdp.NodeID var id cdp.NodeID

View File

@ -898,7 +898,7 @@ func TestFileUpload(t *testing.T) {
// create test server // create test server
mux := http.NewServeMux() mux := http.NewServeMux()
mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) { mux.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
fmt.Fprintf(res, uploadHTML) fmt.Fprintf(res, "%s", uploadHTML)
}) })
mux.HandleFunc("/upload", func(res http.ResponseWriter, req *http.Request) { mux.HandleFunc("/upload", func(res http.ResponseWriter, req *http.Request) {
f, _, err := req.FormFile("upload") f, _, err := req.FormFile("upload")

10
sel.go
View File

@ -115,16 +115,6 @@ func (s *Selector) selAsString() string {
return fmt.Sprintf("%s", s.sel) return fmt.Sprintf("%s", s.sel)
} }
// selAsInt forces sel into a int.
/*func (s *Selector) selAsInt() int {
sel, ok := s.sel.(int)
if !ok {
panic("selector must be int")
}
return sel
}*/
// QueryAfter is an action that will match the specified sel using the supplied // QueryAfter is an action that will match the specified sel using the supplied
// query options, and after the visibility conditions of the query have been // query options, and after the visibility conditions of the query have been
// met, will execute f. // met, will execute f.

View File

@ -37,9 +37,9 @@ func frameDetached(f *cdp.Frame) {
clearFrameState(f, cdp.FrameAttached) clearFrameState(f, cdp.FrameAttached)
} }
func frameStartedLoading(f *cdp.Frame) { /*func frameStartedLoading(f *cdp.Frame) {
setFrameState(f, cdp.FrameLoading) setFrameState(f, cdp.FrameLoading)
} }*/
func frameStoppedLoading(f *cdp.Frame) { func frameStoppedLoading(f *cdp.Frame) {
clearFrameState(f, cdp.FrameLoading) clearFrameState(f, cdp.FrameLoading)