TruthHun / BookStack

BookStack,基于MinDoc,使用Beego开发的在线文档管理系统,功能类似Gitbook和看云。

Home Page:http://www.bookstack.cn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README.md中能否添源码编译说明

aizaimenghuangu opened this issue · comments

如果想对该项目进行二次开发的,不知道项目该如何编译,能否在README.md中补充这个内容,谢谢。

程序是用Go语言框架beego开发的,关于二次开发等相关文档手册,会争取在这段时间补全。

先简单说下编译。
在配置了Go开发环境的前提下,先安装bee工具:

go get github.com/beego/bee

bee使用:https://beego.me/docs/install/bee.md

使用以下方式进行拉取项目:

go get -v github.com/TruthHun/BookStack

不用git clone的方式,是为了避免项目存放路径不正确导致无法执行编译。
然后执行以下命令:

cd 你的Go Path目录/src/github/TruthHun/BookStack

接着执行bee run,然后看看程序报错,提示缺少啥go包,再用go get的方式安装即可。

go get -v github.com/TruthHun/BookStack 会有如下提示,不知道是什么原因

github.com/TruthHun/BookStack (download)
package github.com/TruthHun/BookStack/models/store: cannot find package "github.com/TruthHun/BookStack/models/store" in any of:
/usr/local/Cellar/go/1.10/libexec/src/github.com/TruthHun/BookStack/models/store (from $GOROOT)
/usr/local/Cellar/go/1.10/src/github.com/TruthHun/BookStack/models/store (from $GOPATH)

刚看了下,确实少了models/store目录下的源码,可能是在开发的时候忘记add里面的源码到git里面一起commit了,我今晚下班回去再重新push上来。更新上来之后再跟你说下,现在暂时先不要做二次开发,源码不完整,疏忽了,抱歉。

现在已经把缺失的这两个代码文件更新上来了,是之前配置的.gitignore导致的问题。你再重新试一下。

完美编译,感谢!同时附上 go get golang.org/x 包失败解决方法

由于限制问题,国内使用 go get 安装 golang 官方包可能会失败,如我自己在安装 collidermain 时,出现了以下报错:

$ go get collidermain
package golang.org/x/net/websocket: unrecognized import path "golang.org/x/net/websocket" (https fetch: Get https://golang.org/x/net/websocket?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)

不翻墙的情况下怎么解决这个问题?其实 golang 在 github 上建立了一个镜像库,如 https://github.com/golang/net 即是 https://golang.org/x/net 的镜像库

获取 golang.org/x/net 包,其实只需要以下步骤:

mkdir -p $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/net.git

其它 golang.org/x 下的包获取皆可使用该方法
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.9.1
2018/03/09 17:41:17 INFO     ▶ 0001 Using 'BookStack' as 'appname'
2018/03/09 17:41:17 INFO     ▶ 0002 Initializing watcher...
2018/03/09 17:41:20 SUCCESS  ▶ 0003 Built Successfully!
2018/03/09 17:41:20 INFO     ▶ 0004 Restarting 'BookStack'...
2018/03/09 17:41:20 SUCCESS  ▶ 0005 './BookStack' is running...
2018/03/09 17:41:21 载入sego词典 /usr/local/Cellar/go/1.10/src/github.com/TruthHun/BookStack/dictionary/dictionary.txt
MinDoc version =>
build time =>
start directory => ./BookStack

2018/03/09 17:41:21 [I] [asm_amd64.s:2361] http server Running on http://:8181
2018/03/09 17:41:24 sego词典载入完毕

2019/10/28 16:02:14 [INFO] Uses 'BookStack' as 'appname'
2019/10/28 16:02:14 [INFO] Initializing watcher...
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/commands)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/commands/daemon)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/commands/migrate)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/conf)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/controllers)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/controllers/api)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/graphics)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/models)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/models/store)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/oauth)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/routers)
2019/10/28 16:02:14 [TRAC] Directory(F:\GoProject\src\github.com\TruthHun\BookStack/utils)
2019/10/28 16:02:14 [INFO] Start building...

github.com/TruthHun/gotil/mdtil

..\gotil\mdtil\md2html.go:9:9: undefined: blackfriday.Run

github.com/TruthHun/html2json/html2json

..\html2json\html2json\html2json.go:58:23: undefined: blackfriday.Run

golang.org/x/sys/windows

......\golang.org\x\sys\windows\dll_windows.go:21:6: missing function body
......\golang.org\x\sys\windows\dll_windows.go:24:6: missing function body
2019/10/28 16:02:28 [ERRO] ============== Build failed ===================

请问这个是什么原因引起的,谢谢

完美编译,感谢!同时附上 go get golang.org/x 包失败解决方法

由于限制问题,国内使用 go get 安装 golang 官方包可能会失败,如我自己在安装 collidermain 时,出现了以下报错:

$ go get collidermain
package golang.org/x/net/websocket: unrecognized import path "golang.org/x/net/websocket" (https fetch: Get https://golang.org/x/net/websocket?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)

不翻墙的情况下怎么解决这个问题?其实 golang 在 github 上建立了一个镜像库,如 https://github.com/golang/net 即是 https://golang.org/x/net 的镜像库

获取 golang.org/x/net 包,其实只需要以下步骤:

mkdir -p $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/net.git

其它 golang.org/x 下的包获取皆可使用该方法
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.9.1
2018/03/09 17:41:17 INFO     ▶ 0001 Using 'BookStack' as 'appname'
2018/03/09 17:41:17 INFO     ▶ 0002 Initializing watcher...
2018/03/09 17:41:20 SUCCESS  ▶ 0003 Built Successfully!
2018/03/09 17:41:20 INFO     ▶ 0004 Restarting 'BookStack'...
2018/03/09 17:41:20 SUCCESS  ▶ 0005 './BookStack' is running...
2018/03/09 17:41:21 载入sego词典 /usr/local/Cellar/go/1.10/src/github.com/TruthHun/BookStack/dictionary/dictionary.txt
MinDoc version =>
build time =>
start directory => ./BookStack

2018/03/09 17:41:21 [I] [asm_amd64.s:2361] http server Running on http://:8181
2018/03/09 17:41:24 sego词典载入完毕

好像没生成数据库

数据库通过命令行导入:./BookStack install

go get -v github.com/TruthHun/BookStack
拉完没报错,但是目录是空的咋回事

先简单说下编译。
在配置了Go开发环境的前提下,先安装bee工具:

go get github.com/beego/bee

bee使用:https://beego.me/docs/install/bee.md

使用以下方式进行拉取项目:

go get -v github.com/TruthHun/BookStack

不用git clone的方式,是为了避免项目存放路径不正确导致无法执行编译。
然后执行以下命令:

cd 你的Go Path目录/src/github/TruthHun/BookStack

接着执行bee run,然后看看程序报错,提示缺少啥go包,再用go get的方式安装即可。

这里的go语言环境,具体是哪个版本的golang,还是说对版本没有限制?

您好,请问下这个问题怎么解决。

360截图20200418154725455

@tlchun
请问这个问题怎么解决?
github.com/TruthHun/gotil/mdtil
..\gotil\mdtil\md2html.go:9:9: undefined: blackfriday.Run

github.com/TruthHun/html2json/html2json
..\html2json\html2json\html2json.go:58:23: undefined: blackfriday.Run

commented

!truth!hun/!book!stack@v1.3.1/controllers/AcountController.go:562:20: assignment mismatch: 2 variables but gocaptcha.NewCaptchaImage returns 1 values
!truth!hun/!book!stack@v1.3.1/controllers/BookController.go:1030:14: undefined: blackfriday.MarkdownCommon