Skip to content

Commit

Permalink
Reverting support back to go1.16 minimum
Browse files Browse the repository at this point in the history
  • Loading branch information
kenshaw committed Mar 10, 2023
1 parent 3656e47 commit 5aeb67f
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 15 deletions.
1 change: 1 addition & 0 deletions allocate_linux.go
@@ -1,4 +1,5 @@
//go:build linux
// +build linux

package chromedp

Expand Down
1 change: 1 addition & 0 deletions allocate_other.go
@@ -1,4 +1,5 @@
//go:build !linux
// +build !linux

package chromedp

Expand Down
13 changes: 11 additions & 2 deletions chromedp_test.go
Expand Up @@ -30,7 +30,6 @@ import (
"github.com/chromedp/cdproto/runtime"
"github.com/chromedp/cdproto/target"
"github.com/ledongthuc/pdf"
"golang.org/x/exp/slices"
)

var (
Expand Down Expand Up @@ -903,7 +902,7 @@ func TestBrowserContext(t *testing.T) {
t.Fatal(err)
}

disposed := !slices.Contains(ids, want)
disposed := !contains(ids, want)

if disposed != tt.wantDisposed {
t.Errorf("browser context disposed = %v, want %v", disposed, tt.wantDisposed)
Expand All @@ -925,6 +924,7 @@ func getBrowserContext(tb testing.TB, ctx context.Context) cdp.BrowserContextID
}
return id
}

func TestLargeOutboundMessages(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -1521,3 +1521,12 @@ func TestPDFTemplate(t *testing.T) {
t.Errorf("page.PrintToPDF produces unexpected content. got: %q, want: %q", buf, want)
}
}

func contains(v []cdp.BrowserContextID, id cdp.BrowserContextID) bool {
for _, i := range v {
if i == id {
return true
}
}
return false
}
1 change: 1 addition & 0 deletions device/gen.go
@@ -1,4 +1,5 @@
//go:build ignore
// +build ignore

package main

Expand Down
4 changes: 2 additions & 2 deletions eval.go
Expand Up @@ -78,10 +78,10 @@ func parseRemoteObject(v *runtime.RemoteObject, res interface{}) (err error) {
value := v.Value
if value == nil {
rv := reflect.ValueOf(res)
if rv.Kind() == reflect.Pointer {
if rv.Kind() == reflectPtr {
switch rv.Elem().Kind() {
// Common kinds that can be nil.
case reflect.Pointer, reflect.Map, reflect.Slice:
case reflectPtr, reflect.Map, reflect.Slice:
// It's weird that res is a pointer to the following kinds,
// but they can be nil too.
case reflect.Chan, reflect.Func, reflect.Interface:
Expand Down
10 changes: 10 additions & 0 deletions eval_go1.18.go
@@ -0,0 +1,10 @@
//go:build go1.18
// +build go1.18

package chromedp

import (
"reflect"
)

const reflectPtr = reflect.Pointer
10 changes: 10 additions & 0 deletions eval_old.go
@@ -0,0 +1,10 @@
//go:build !go1.18
// +build !go1.18

package chromedp

import (
"reflect"
)

const reflectPtr = reflect.Ptr
11 changes: 2 additions & 9 deletions go.mod
@@ -1,20 +1,13 @@
module github.com/chromedp/chromedp

go 1.18
go 1.16

require (
github.com/chromedp/cdproto v0.0.0-20230220211738-2b1ec77315c9
github.com/gobwas/ws v1.1.0
github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80
github.com/mailru/easyjson v0.7.7
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde
golang.org/x/exp v0.0.0-20230304125523-9ff063c70017
)

require (
github.com/chromedp/sysutil v1.0.0 // indirect
github.com/gobwas/httphead v0.1.0 // indirect
github.com/gobwas/pool v0.2.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
golang.org/x/sys v0.6.0 // indirect
)
require golang.org/x/sys v0.6.0 // indirect
2 changes: 0 additions & 2 deletions go.sum
Expand Up @@ -16,8 +16,6 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde h1:x0TT0RDC7UhAVbbWWBzr41ElhJx5tXPWkIHA2HWPRuw=
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=
golang.org/x/exp v0.0.0-20230304125523-9ff063c70017 h1:3Ea9SZLCB0aRIhSEjM+iaGIlzzeDJdpi579El/YIhEE=
golang.org/x/exp v0.0.0-20230304125523-9ff063c70017/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1 change: 1 addition & 0 deletions kb/gen.go
@@ -1,4 +1,5 @@
//go:build ignore
// +build ignore

package main

Expand Down

0 comments on commit 5aeb67f

Please sign in to comment.