flashmob / go-guerrilla

Mini SMTP server written in golang
MIT License
2.78k stars 365 forks source link

Cannot refer to unexported name backends.compressor #190

Closed bsord closed 5 years ago

bsord commented 5 years ago

What I'm trying to do: Customize the Redis and MySQL backends by copying them and importing them a different package while using guerrilla as a module.

Problem: Error 'cannot refer to unexported name backends.compressor' is received when attempting to use compressor outside of the 'backends' package because the definition of the struct in backends/p_compressor.go is lower case, thus non-exportable. It looks like the 'capital' version of compressor is used to export the function used by the processor chain so cannot simply capitalize.

Solution: Rename the compressor struct definition in p_compressor.go to DataCompressor (as well as update the built-in Redis and MySQL backend references) so it can be used by other packages.

flashmob commented 5 years ago

Sounds good, please feel free to submit a PR

On Wed, 30 Oct 2019 at 13:33, bsord notifications@github.com wrote:

What I'm trying to do: Customize the Redis and MySQL backends by copying them and importing them a different package while using guerrilla as a module.

Problem: Error 'cannot refer to unexported name backends.compressor' is received when attempting to use compressor outside of the 'backends' package because the definition of the struct in backends/p_compressor.go is lower case, thus non-exportable. It looks like the 'capital' version of compressor is used to export the function used by the processor chain so cannot simply capitalize.

Solution: Rename the compressor struct definition in p_compressor.go to DataCompressor (as well as update the built-in Redis and MySQL backend references) so it can be used by other packages.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/flashmob/go-guerrilla/issues/190?email_source=notifications&email_token=AAE6MP3MZFYCA4IXJU3VAMLQRDXBNA5CNFSM4JGSPFI2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HVIOC4A, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE6MP6NMVFS3EE7XFT3KS3QRDXBNANCNFSM4JGSPFIQ .

bsord commented 5 years ago

PR submitted. Let me know if there are any concerns. https://github.com/flashmob/go-guerrilla/pull/191

flashmob commented 5 years ago

Merged, thank you!

On Wed, 30 Oct 2019 at 14:06, bsord notifications@github.com wrote:

PR submitted. Let me know if there are any concerns. #191 https://github.com/flashmob/go-guerrilla/pull/191

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flashmob/go-guerrilla/issues/190?email_source=notifications&email_token=AAE6MPZVAV5RFLDGER3UECTQRD245A5CNFSM4JGSPFI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECSYT7Y#issuecomment-547719679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE6MP3JNTTYJXHJPFVU3C3QRD245ANCNFSM4JGSPFIQ .

bsord commented 5 years ago

https://github.com/flashmob/go-guerrilla/pull/192 submitted to also expose the attributes of the struct as well.

bsord commented 5 years ago

Confirmed resolved after second PR. Thanks again for quick responses.