Skip to content

Instantly share code, notes, and snippets.

@fnzv
Created January 9, 2018 13:44
Show Gist options
  • Save fnzv/b1132314cfa95b4edc7569042e57daca to your computer and use it in GitHub Desktop.
Save fnzv/b1132314cfa95b4edc7569042e57daca to your computer and use it in GitHub Desktop.
qr-code generator in Golang
package main
import "fmt"
import "os"
import qrcode "github.com/skip2/go-qrcode"
func main() {
// if not display usage
if len(os.Args) > 1 {
text := os.Args[1]
err := qrcode.WriteFile(text, qrcode.Medium, 256, "qr.png")
fmt.Println(err)
} else {
fmt.Println("usage: \n ./create-qr TEXT\n will generate qr.png based on input")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment