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

Update source.go #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update source.go #6

wants to merge 1 commit into from

Conversation

KiedaTamashi
Copy link

增加一个获取result, 为了获取[]byte

@GwynethLlewelyn
Copy link

GwynethLlewelyn commented Nov 11, 2023

I don't quite get it. What is the difference between the existing toResult() and your own proposed ToRawResult()? AFAICS, they're identical — except that ToRawResult() gets exported by the Tinify package, while toResult() does not.

I'd suggest one of the following instead...

  1. Export toResult(), i.e. rename it as ToResult() (and of course search & replace that on the rest of the code)
  2. Call toResult() from ToRawResult() instead of duplicating code, e.g.:
  func (s *Source) ToRawResult() (r *Result, err error) {
      return s.toResult()
  }

That way, if toResult() (internally) changes, ToRawResult() will continue to point to the right place; if additional processing is required by ToRawResult(), well, it can always be added to it — without interfering with whatever toResult() is actually returning.

Unless, of course, I'm not really understanding the point of this PR :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants