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

Pointers in returned structs #29

Closed
chrissnell opened this issue Oct 3, 2018 · 2 comments
Closed

Pointers in returned structs #29

chrissnell opened this issue Oct 3, 2018 · 2 comments

Comments

@chrissnell
Copy link

So many of the struct members that are returned by library calls are pointers. This presents a messy problem for third-party software using the library, because we have to check for nil pointers before accessing struct members. I see little advantage to using pointers here. It adds a lot of ugly checks. It's not a massive amount of data, so I think that it would be fine to just use regular data types, not pointers to data.

Thoughts?

@JensRantil
Copy link

I this issue is going to be worked on, I think #28 is a prerequisite before working on this.

As to why using pointers instead of values, the README states

This project draws a lot of it's structure and testing methods from go-github.

and google/go-github#537 (comment) and google/go-github#79 give some insights into this decision.

@lox
Copy link
Contributor

lox commented Feb 3, 2019

Yup, the AWS SDK uses this approach too. It's slightly gross, but allows nilable fields. I don't think we are likely to change this in the short term.

@lox lox closed this as completed Mar 24, 2019
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

3 participants