Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Plain Go Type #49

Closed
AngangGuo opened this issue Sep 26, 2020 · 3 comments
Closed

Using Plain Go Type #49

AngangGuo opened this issue Sep 26, 2020 · 3 comments

Comments

@AngangGuo
Copy link

From example:

browser, err := pw.Chromium.Launch(playwright.BrowserTypeLaunchOptions{
    Headless: playwright.Bool(false),
})

Is it possible to use plain Go type bool like:

browser, err := pw.Chromium.Launch(playwright.BrowserTypeLaunchOptions{
    Headless: false,
})

You can convert false to playwright.Bool(false) in Launch() method.

This will be easier for end user.
Also the you may not need to export Bool() or similar type convert method as a public method.

@AngangGuo AngangGuo changed the title Plain Go Type Using Plain Go Type Sep 26, 2020
@mxschmitt
Copy link
Member

mxschmitt commented Sep 26, 2020

Hi,

yeah, the point of that is it's otherwise not possible to differentiate if a value was set or not internally which have to check somehow. GRPC/Protobuf are using it in the same way.
(These methods are basically returning it's pointer value)

But I fully agree, that this harms the DX.

@AngangGuo
Copy link
Author

Understand. Thanks.

@AngangGuo
Copy link
Author

Go Nuts Mailing List:
https://groups.google.com/u/1/g/golang-nuts/c/ucgTYyBe0es

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants