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

Tweak: move private methods from podcast.go to respected usage files #10

Closed
eduncan911 opened this issue Oct 4, 2018 · 1 comment · Fixed by #12
Closed

Tweak: move private methods from podcast.go to respected usage files #10

eduncan911 opened this issue Oct 4, 2018 · 1 comment · Fixed by #12

Comments

@eduncan911
Copy link
Owner

When I originally write podcast.go, everything was in that one file.

As I started to add more and more functionality, it started to make sense to break out that extra functionality to dedicated files. E.g. item.go.

However, I forgot to move the required private methods used in such files from podcast.go out to their usage.

Example:

var parseDuration = func(duration int64) string needs to be moved to where it is being used, item.go.

Off Topic: You may be wondering why I use var parseDuration = func(duration int64) string to define my functions, instead of func parseDuration(duration int64) string. The reason is because of testability. By assigning it to a variable, it allows me to assign custom functionality during tests - e.g. to purposely break or purposely cause an invalid result - to see how the caller would react.

iwittkau pushed a commit to iwittkau/podcast that referenced this issue Jan 26, 2019
@iwittkau
Copy link
Contributor

By assigning it to a variable, it allows me to assign custom functionality during tests - e.g. to purposely break or purposely cause an invalid result - to see how the caller would react.

#12: To make sure a custom function implements the correct signature, I created function types for theses functions. By that you can require a ParseDurationFunc where it is needed. var parseDuration is now just a implementation of that function.

eduncan911 pushed a commit that referenced this issue Feb 4, 2020
* close #10

* remove exported function types

* remove parseDateRFC1123Z function type
eduncan911 pushed a commit that referenced this issue Feb 4, 2020
* Correct count len of UTF8 strings (#9)

* Correctly count len of UTF8 strings (fix panics)
* Sort header
* Fixes Panics

* Will implement duration parser (#8)

* Implement duration parser
* Fix example
* Increase coverage to 100%

* Fix Github and GoDocs Markdown (#14)

* GH Markdown fixes

* Updated format for godoc

* Move podcast.go Private Methods to Respected Files (#12)

* close #10

* remove exported function types

* remove parseDateRFC1123Z function type

* Allow providing GUID on Podcast (#15)

* Allow providing own GUID

* Check length instead of comparing to empty string

* Adding test for user supplied GUID

* Remove coveralls token

Co-authored-by: Maksym Pavlenko <makpav@amazon.com>
Co-authored-by: Konstantin Chukhlomin <mail@chuhlomin.com>
Co-authored-by: iwittkau <iwittkau@users.noreply.github.com>
Co-authored-by: Damian Szeluga <damian.szeluga@gmail.com>
eduncan911 added a commit that referenced this issue Feb 5, 2020
* Catching Develop up to Master (#17)

* Correct count len of UTF8 strings (#9)

* Correctly count len of UTF8 strings (fix panics)
* Sort header
* Fixes Panics

* Will implement duration parser (#8)

* Implement duration parser
* Fix example
* Increase coverage to 100%

* Fix Github and GoDocs Markdown (#14)

* GH Markdown fixes

* Updated format for godoc

* Move podcast.go Private Methods to Respected Files (#12)

* close #10

* remove exported function types

* remove parseDateRFC1123Z function type

* Allow providing GUID on Podcast (#15)

* Allow providing own GUID

* Check length instead of comparing to empty string

* Adding test for user supplied GUID

* Remove coveralls token

Co-authored-by: Maksym Pavlenko <makpav@amazon.com>
Co-authored-by: Konstantin Chukhlomin <mail@chuhlomin.com>
Co-authored-by: iwittkau <iwittkau@users.noreply.github.com>
Co-authored-by: Damian Szeluga <damian.szeluga@gmail.com>

* Update doc.go for release notes

* Update README for Release

Co-authored-by: Jader Brasil <jaderebrasil@gmail.com>
Co-authored-by: Maksym Pavlenko <makpav@amazon.com>
Co-authored-by: Konstantin Chukhlomin <mail@chuhlomin.com>
Co-authored-by: iwittkau <iwittkau@users.noreply.github.com>
Co-authored-by: Damian Szeluga <damian.szeluga@gmail.com>
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 a pull request may close this issue.

2 participants