skip2 / go-qrcode

:sparkles: QR Code encoder (Go)
http://go-qrcode.appspot.com
MIT License
2.58k stars 335 forks source link

Export NewWithForcedVersion #34

Closed vsenko closed 4 years ago

vsenko commented 4 years ago

Sometimes it is very convenient to be able to specify a version for QR code generation.

For example in case when QR code would be embedded into a form with specific layout. In this case if data to be encoded has variable length, then smaller data blocks would be encoded in smaller QR codes and potentially ruin form layout.

This pull request exports NewWithForcedVersion function. It also substitutes log.Fatalf invocation with error return to make function behavior more predictable.

skip2 commented 4 years ago

This looks useful, thanks very much :)