clarify that Run won't work with an allocator context

We made the function error with ErrInvalidContext in that case, but the
godoc was still a bit ambiguous. Make it clearer to avoid confusion.

For #299.
This commit is contained in:
Daniel Martí 2019-04-16 14:26:36 +09:00
parent ac47d6ba0e
commit 71ae9f7bbc

View File

@ -149,9 +149,8 @@ func Cancel(ctx context.Context) error {
return c.cancelErr return c.cancelErr
} }
// Run runs an action against the provided context. The provided context must // Run runs an action against context. The provided context must be a valid
// contain a valid Allocator; typically, that will be created via NewContext, or // chromedp context, typically created via NewContext.
// via one of the allocator constructors like NewExecAllocator.
func Run(ctx context.Context, actions ...Action) error { func Run(ctx context.Context, actions ...Action) error {
c := FromContext(ctx) c := FromContext(ctx)
// If c is nil, it's not a chromedp context. // If c is nil, it's not a chromedp context.