{ Hello World! }

      
package index

import (
	"errors"
)

type article struct {
	title    string
	url      string
	summary  string
	author   string
	tags     []string
	status   int
}

func PostList() error {
	var posts map[string]*article

	posts["2018-02-25"] := &article {
		title:   "Sqlite 随机获取N条记录",
		url:     "/sqlite-table.html",
		summary: `查询如下:
select * from 表名 order by random() limit 条数;`,
		author:  "坏猫",
		tags:    []string{
			sqlite,
		},
		status:  200,
	}

	posts["2018-02-25"] := &article {
		title:   "让 sudo 显示星号密码",
		url:     "/sudo-password.html",
		summary: `新建终端,执行:
sudo visduo
在内容尾部追加:
Defaults pwfeedback
保存,退出。ok`,
		author:  "坏猫",
		tags:    []string{
			sudo,
			linux,
		},
		status:  200,
	}

	posts["2018-02-23"] := &article {
		title:   "SQLite 获取当前时间或时间戳,精确到毫秒",
		url:     "/sqlite-time.html",
		summary: `获取当前时间:
select datetime('now')
// 2017-02-22 12:30:30
精确到毫秒:
select strftime('%Y-%m-%d %H:%M:%f','now')
// 2018-02-23 12:30:30.820
获取当前Unix时间戳:
select strftime('%s','now')
// 1519364500`,
		author:  "坏猫",
		tags:    []string{
			sqlite,
		},
		status:  200,
	}

	posts["2018-02-22"] := &article {
		title:   "Debian9 系统更换阿里云镜像源",
		url:     "/debian-yuan.html",
		summary: `今天博主在自己 Debian9 系统的 VPS 中执行 apt-get update 时,遇到部分源无法连接的错误。
W: Failed to fetch http://deb.debian.org/debian/dists/stretch/InRelease
W: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/InRelease
W: Failed to fetch http://deb.debian.org/deb`,
		author:  "坏猫",
		tags:    []string{
			debian9,
		},
		status:  200,
	}

	posts["2018-02-22"] := &article {
		title:   "golang rand 随机数实例",
		url:     "/go-rand.html",
		summary: `// 打印10个100以内(0-99)的随机数
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().UnixNano())
for i := 0; i < 10; i++ {
x := rand.Intn(100)
fmt.Println(x)
}
}`,
		author:  "坏猫",
		tags:    []string{
			Go,
		},
		status:  200,
	}

	for _, v := range posts {
		if v.status != 200 {
			return errors.New("Warning! Found abnormal!")
		}
	}

	return nil
}
func NextPage() string {
	var url = "/page/2/"
	return url
}