From 643ab53ae7d727e260e8efd50ea4195bc8139cef Mon Sep 17 00:00:00 2001 From: chai2010 Date: Tue, 12 Jan 2016 13:52:13 +0800 Subject: [PATCH] add mkqrcode.go --- Makefile | 3 +++ gopl-zh-qrcode.png | Bin 2173 -> 2144 bytes mkqrcode.go | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 mkqrcode.go diff --git a/Makefile b/Makefile index 87cf96f..afe476c 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,9 @@ review: gitbook build go run zh2tw.go . .md$$ zh2tw +qrcode: + go run mkqrcode.go + fixlink: go run fixlinks.go . .md$$ diff --git a/gopl-zh-qrcode.png b/gopl-zh-qrcode.png index 8e7df0daed90543827dd596f9f3ecde875d8b87b..49120888ddd39c381e48f899bb5133f3f7d0a02e 100644 GIT binary patch delta 62 zcmew>@IYXKim_ISYeY$Kep*R+Vo@qXV32NrpSyxhaz. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ingore + +package main + +import ( + "fmt" + "io/ioutil" + "log" + + qr "github.com/chai2010/image/qrencoder" +) + +const ( + gopl_zh_url = "http://golang-china.github.io/gopl-zh/" + output = "gopl-zh-qrcode.png" +) + +func main() { + c, err := qr.Encode(gopl_zh_url, qr.H) + if err != nil { + log.Fatal(err) + } + err = ioutil.WriteFile(output, c.PNG(), 0666) + if err != nil { + log.Fatal(err) + } + + fmt.Println("output:", output) +}