forked from yeqown/go-qrcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
55 lines (45 loc) · 1.23 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"fmt"
"github.com/yeqown/go-qrcode/v2"
"github.com/yeqown/go-qrcode/writer/standard"
)
func main() {
repo()
//issue17()
}
func repo() {
qrc, err := qrcode.New("https://github.com/yeqown/go-qrcode")
if err != nil {
fmt.Printf("could not generate QRCode: %v", err)
return
}
w, err := standard.New("../assets/repo-qrcode.jpeg")
if err != nil {
fmt.Printf("standard.New failed: %v", err)
return
}
// save file
if err = qrc.Save(w); err != nil {
fmt.Printf("could not save image: %v", err)
}
}
func issue17() {
qrc, err := qrcode.New("Övrigt asdasd asdas djaskl djaslk djaslkj dlaiodqjwiodjaskldj aksldjlk Övrigt")
//qrc, err := qrcode.New("text content this is custom text content this is custom text content70123")
// content over than 74 length would trigger this
//qrc, err := qrcode.New("text content this is custom text content this is custom text content701234",
// qrcode.WithCircleShape())
if err != nil {
fmt.Printf("could not generate QRCode: %v", err)
}
w, err := standard.New("./testdata/issue-17.jpeg")
if err != nil {
fmt.Printf("standard.New failed: %v", err)
return
}
// save file
if err = qrc.Save(w); err != nil {
fmt.Printf("could not save image: %v", err)
}
}