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

Implement work with slices #1

Open
awskii opened this issue Apr 14, 2018 · 0 comments
Open

Implement work with slices #1

awskii opened this issue Apr 14, 2018 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@awskii
Copy link
Owner

awskii commented Apr 14, 2018

For now, we can't pass slice of pointers to struct to parse data to, instead of that we should pass one pointer to struct at itreration.

Current state:

var dest []*MyStructure
for i := 0; i < len(dest) && i < len(lines); i++ {
  if err := hunkee.ParseLine(lines[i], dest[i]); err != nil {
    fmt.Println(err)
  }
}

With ability to parse lines into slice becomes next:

var dest []*MyStructure
// dest len will be extended as much as needed to
// parse all presented lines into
if err := hunkee.Parse(lines, dest); err != nil {
  fmt.Println(err)
}
@awskii awskii added enhancement New feature or request help wanted Extra attention is needed labels Apr 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant