Git Product home page Git Product logo

studygolang's Introduction

studygolang

Build Status

Go语言中文网 - Golang中文社区 源码

网站上线时间:2013-03-15 14:38:09

目前在线运行的分支是 Master。欢迎有兴趣的 gopher 们参与进来,一起构建一个完善的 Go 语言中文网,Go 语言爱好者的学习家园,参与方式请参考:https://studygolang.com/topics/4092

本地搭建一个 Go语言中文网

要求 Go 1.16+

1、下载源码到本地某个目录

git clone https://github.com/studygolang/studygolang

2、编译

进入 studygolang 项目目录,执行如下命令:

// unix
make build
// windows
install.bat

这样便编译好了 studygolang

3、在 studygolang 源码中的 bin 目录下应该有了 studygolang 可执行文件。

接下来启动 studygolang。

// unix
make start
// windows
start.bat

或者

// unix
bin/studygolang
// windows
bin\studygolang.exe

一切顺利的话,studygolang 应该就启动了。

4、验证

在浏览器中输入:http://127.0.0.1:8088

应该就能看到了。

接下来你会看到图形化安装界面,一步步照做吧。

  • 如果之后有出现页面空白,请查看 error.log 是否有错误

参与我们

fork + PR。如果有修改 js 和 css,请执行 gulp (需要先安装 gulp)。注意,Node 版本为:v10.16.2

使用该项目搭建的网站

studygolang's People

Contributors

15ho avatar andyhang avatar feixionglee avatar glepnir avatar hafrans avatar haochen233 avatar javasgl avatar jockerxlj avatar lewgun avatar lunny avatar miaogaolin avatar paradeto avatar polaris1119 avatar rifewang avatar tk103331 avatar tomliu-github avatar zhima1234 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

studygolang's Issues

评论支持编辑或删除

网友提的:https://studygolang.com/topics/4933

计划实现:

  • 支持编辑,但是一段时间内可以编辑(可以考虑可配置,好比主题发布后编辑的时间,暂定30分钟),超时不允许编辑,避免恶意修改。如果超时依然想编辑,可以联系管理员。
  • 不支持删除(因为涉及到通知等一系列关联数据问题)。

怎么支持的https,我看echo改变了不少,用新版本的感觉变动太多了。想问下您是怎么搞的?

e := echo.New()

serveStatic(e)

e.Use(thirdmw.EchoLogger())
e.Use(mw.Recover())
e.Use(pwm.Installed(filterPrefixs))
e.Use(pwm.HTTPError())

frontG := e.Group("", thirdmw.EchoCache())
controller.RegisterRoutes(frontG)

std := standard.New(getAddr())
std.SetHandler(e)

//https服务
//e.Logger.Fatal(e.StartTLS(":443", "/opt/cert/cert.pem", "/opt/cert/key.pem"))
//e.StartTLS(":443", "/opt/cert/cert.pem", "/opt/cert/key.pem")
//https服务end

gracefulRun(std)

避免重复文章出现

目前社区有不少重复或相似内容,如何做去重。

比如:发布内容是,发现重复,提示已经存在了~

-bash: bin/studygolang: Permission denied

#26

go version go1.8.3 darwin/amd64

-bash: bin/studygolang: Permission denied
GOARCH="amd64"
GOBIN="/Users/liberxue/www/Go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/liberxue/www/Go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rw/v752k7qn1716hfdh8hwcwjgc0000gn/T/go-build789341727=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

[ bug ] 查看个人文档信息,合计信息有误

详细描述:

  • 查看个人文档信息,统计信息,时间都有错误,具体如下所示:
    image

期待:

  • 可以准确统计出个人合计发表的文章数
  • 平均多少天发表一篇
  • 当前准确日期
  • 距离注册共多少天

依赖写一写

apt-get install mysql-server mysql-client git mercurial golang

请问像studygolang这种项目是如何进行调试的?

像PHP项目的调试都是通过直接将程序exit掉,然后查看程序exit前变量的内容。
那像studygolang这种项目我该如何进行调试?而且golang的项目还需要编译后运行,那这样我该如何进行调试???求救啊。。。

sublime命令行乱码

各位, win7或ubunt下面安装完sublime+gosublime后,执行一个错误的命令时,显示乱码,如:通过ctrl+b进入命令行,执行:evn 回车,显示乱码。但helloworld执行时 能显示中文。请问命令行乱码怎么解决?感谢!!!

在Mac上路径都多了一个/

./studygolang
load config file error: open /Users/xx/Documents/Code/GO//config/env.ini: no such file or directory
get mysql config error: section 'mysql' not found
2017/08/30 11:38:51 config parse redis section error: section 'redis' not found
panic: open /Users/xx/Documents/Code/GO//template/email.html: no such file or directory

goroutine 1 [running]:
html/template.Must(0x0, 0x1ad63a0, 0xc42015b320, 0x1)
/usr/xx/go/src/html/template/template.go:360 +0x54
logic.init()
/Users/xx/Documents/Code/GO/src/studygolang/src/logic/email.go:126 +0x6e5
main.init()
/Users/xx/Documents/Code/GO/src/studygolang/src/server/studygolang/static.go:40 +0x5a

Markdown 是有问题吧, 建议切换 marked?

在论坛上发了帖觉得标记结果好蛋疼,, 建议切换到 marked
https://github.com/chjj/marked

marked.setOptions({
  gfm: true, // GFM 保持和一些论坛一致, 比如 CNode, Ruby-China, Github
  highlight: function (code, lang, callback) {
    // whatever
  },
  tables: true,
  breaks: false, // 换行那个事情,,
  pedantic: false,
  sanitize: true,
  smartLists: true,
  smartypants: false,
  langPrefix: 'lang-'
});

start.bat启动失败

崩溃日志为
panic: GetFileAttributesEx bin\studygolang: The system cannot find the file specified.

goroutine 1 [running]:
global.init.1()
C:/Users/xdeng/Desktop/studygolang-2.x/src/global/app.go:86 +0x3a2
global.init()
C:/Users/xdeng/Desktop/studygolang-2.x/src/global/chan.go:13 +0x18b
main.init()
C:/Users/xdeng/Desktop/studygolang-2.x/src/server/studygolang/static.go:40 +0x57

代码为
fileInfo, err := os.Stat(os.Args[0])
if err != nil {
panic(err)
}

启动命令为
start /b bin\studygolang >> log\panic.log 2>&1 &

os.Args[0] == bin\studygolang 找不到的原因是 不存在这个文件。

应该改为

start /b bin\studygolang.exe >> log\panic.log 2>&1 & 即可。

bin/studygolang: 没有那个文件或目录

你好 ./getpkg.sh ./install.sh ./start.sh 都执行成功,但是没有在当前目录下生成bin/studygolang 服务启动不了
tail -f log/panic.log
./start.sh:行21: bin/studygolang: 没有那个文件或目录

社区首页布局

社区的首页,社区公告可不可以移到右边,放到热门节点下面一栏,用分类导航也放过去,正文宽一些,感觉现在的首页布局不好看

执行install.sh失败

失败信息

vendor/github.com/polaris1119/keyword

src/vendor/github.com/polaris1119/keyword/keyword.go:70: undefined: sort.SliceStable

getpkg.bat 获取依赖库出现重复

获取crypto出现重复获取,不过有noexit 不影响
if not exist "src/golang.org/x/text" (
git clone https://github.com/golang/text src/golang.org/x/text
)
go install golang.org/x/text/...

if not exist "src/golang.org/x/crypto" (
git clone https://github.com/golang/crypto src/golang.org/x/crypto
)
go install golang.org/x/crypto/...

if not exist "src/golang.org/x/crypto" (
git clone https://github.com/golang/crypto src/golang.org/x/crypto
)
go install golang.org/x/crypto/...

安装时一直为空白

我的环境:
lstbao@lstbao-listome software$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/lstbao/work/listomego:/home/lstbao/gowork"
GORACE=""
GOROOT="/home/lstbao/software/go"
GOTOOLDIR="/home/lstbao/software/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

lstbao@lstbao-listome software$ go version
go version go1.6.2 linux/amd64

当我执行./install.sh,打开localhost:8088时,第一个页面是配置mysql数据库的,到这里都很正常,当我点击_进行安装_时,就一直为空白了,然后我关闭了空白页,重新打开localhost:8088,可以正常访问,但是当我注册用户的时候报错了:
17:05:07.998242 [127.0.0.1 POST /account/register 567206db-cb79-413f-9fbb-426a153a30d5 "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36" 200 2.738351ms 12544] user logic UserExists error: Error 1146: Table 'studygolang.user_login' doesn't exist
user logic UserExists error: Error 1146: Table 'studygolang.user_login' doesn't exist
内部服务器错误 : Error 1146: Table 'studygolang.user_info' doesn't exist

看了一下源码,点击_进行安装_的路由是/install/do,这时页面显示空白,也就是数据库的表格没创建,导致不能注册,但不知为何没有创建表格,还是说/install/do要很久?。

专栏管理:我的专栏、他的专栏、添加其他管理员

可以查看我的专栏(创建的和管理的),可以考虑放在 我的 里面

可以查看他的专栏(创建的和管理的);

我的专栏,支持添加、删除其他管理员,管理员可以管理专栏。

参考:

可以仿照 简书 的专题功能来做

centos 64 getpkg

[root@centos-demo thirdparty]# go install golang.org/x/crypto/...

golang.org/x/crypto/ocsp

src/golang.org/x/crypto/ocsp/ocsp.go:162: undefined: elliptic.P224

website_setting方面panic了

我按照你的指南

please help me

[^[[31mPANIC RECOVER^[[0m] runtime error: invalid memory address or nil pointer dereference goroutine 44 [running]:
vendor/github.com/labstack/echo/middleware.RecoverWithConfig.func1.1.1(0x1000, 0xa10000, 0xeb0420, 0xc42576f200)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/vendor/github.com/labstack/echo/middleware/recover.go:64 +0x134

panic(0xabece0, 0xeed8c0)
        /usr/local/go/src/runtime/panic.go:489 +0x2cf
logic.IndexLogic.FindData(0x7f285c5136a8, 0xc42576f200, 0xc42190e8b8, 0x2, 0xc42576f200)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/logic/index.go:31 +0x282
http/controller.IndexController.NewIndex(0xeb0420, 0xc42576f200, 0xb70b3a, 0x5)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/http/controller/index.go:48 +0x1d6
http/controller.(IndexController).NewIndex-fm(0xeb0420, 0xc42576f200, 0xb70b3a, 0x5)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/http/controller/index.go:31 +0x3b
vendor/github.com/labstack/echo.(*Echo).add.func1(0xeb0420, 0xc42576f200, 0x0, 0x0)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/vendor/github.com/labstack/echo/echo.go:471 +0x90
http/middleware.AutoLogin.func1.1(0xeb0420, 0xc42576f200, 0x0, 0x0)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/http/middleware/login.go:61 +0x212
http/middleware.HTTPError.func1.1(0xeb0420, 0xc42576f200, 0xc4243d39e8, 0xc431f88348)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/http/middleware/http_error.go:22 +0x46
http/middleware.Installed.func1.1(0xeb0420, 0xc42576f200, 0x1000, 0xa10000)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/http/middleware/installed.go:38 +0x101
vendor/github.com/labstack/echo/middleware.RecoverWithConfig.func1.1(0xeb0420, 0xc42576f200, 0x0, 0x0)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/vendor/github.com/labstack/echo/middleware/recover.go:71 +0xa2
vendor/github.com/polaris1119/middleware.EchoLogger.func1.1(0xeb0420, 0xc42576f200, 0x0, 0x0)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/vendor/github.com/polaris1119/middleware/logger.go:72 +0x566
vendor/github.com/labstack/echo.(*Echo).ServeHTTP.func1(0xeb0420, 0xc42576f200, 0xc42576f200, 0x40e368)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/vendor/github.com/labstack/echo/echo.go:553 +0x157
vendor/github.com/labstack/echo.(*Echo).ServeHTTP(0xc420200280, 0xead420, 0xc429d082c0, 0xeab0e0, 0xc425809da0)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/vendor/github.com/labstack/echo/echo.go:562 +0x1cb
vendor/github.com/labstack/echo/engine/standard.(*Server).ServeHTTP(0xc4201dea00, 0xea7880, 0xc4352ae0e0, 0xc4201e0c00)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/vendor/github.com/labstack/echo/engine/standard/server.go:138 +0x359
net/http.serverHandler.ServeHTTP(0xc4202440b0, 0xea7880, 0xc4352ae0e0, 0xc4201e0c00)
        /usr/local/go/src/net/http/server.go:2568 +0x92
net/http.(*conn).serve(0xc420428320, 0xea8380, 0xc4201169c0)
        /usr/local/go/src/net/http/server.go:1825 +0x612
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2668 +0x2ce

goroutine 1 [select]:
vendor/github.com/facebookgo/grace/gracehttp.Serve(0xc4201d4500, 0x1, 0x1, 0x0, 0x0)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/vendor/github.com/facebookgo/grace/gracehttp/http.go:162 +0x5e6
main.gracefulRun(0xc4201dea00)
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/server/studygolang/graceful_unix.go:13 +0x6d
main.main()
        /home/gubl/web/shipyard/src/github.com/studygolang/studygolang/src/server/studygolang/main.go:79 +0x63e

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:2197 +0x1

goroutine 5 [syscall]:
os/signal.signal_recv(0x0)
        /usr/local/go/src/runtime/sigqueue.go:116 +0x104
os/signal.loop()
        /usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.1
        /usr/local/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 6 [chan receive]:
vendor/github.com/polaris1119/config.signalReload()
        /home/gubl
{"time":"2017-08-05T21:54:32+08:00","level":"ERROR","prefix":"echo","file":"echo.go","line":"230","message":"runtime error: invalid memory address or nil pointer dereference"}

install一步出错

按教程一步一步来,到sh install一步出错。
是不是依赖版本不对?

# server/indexer
usage: 6l [options] main.6
  -1    use alternate profiling code
  -8    assume 64-bit addresses
  -B info
        define ELF NT_GNU_BUILD_ID note
  -C    check Go calls to C code
  -D addr
        data address
  -E sym
        entry symbol
  -I interp
        set ELF interp
  -L dir
        add dir to library path
  -H head
        header type
  -K    add stack underflow checks
  -O    print pc-line tables
  -Q    debug byte-register code gen
  -R rnd
        address rounding
  -S    check type signatures
  -T addr
        text address
  -V    print version and exit
  -W    disassemble input
  -X name value
        define string data
  -Z    clear stack frame on entry
  -a    disassemble output
  -c    dump call graph
  -d    disable dynamic executable
  -extld ld
        linker to run in external mode
  -extldflags ldflags
        flags for external linker
  -f    ignore version mismatch
  -g    disable go package data checks
  -installsuffix suffix
        pkg directory suffix
  -k sym
        set field tracking symbol
  -linkmode mode
        set link mode (internal, external, auto)
  -n    dump symbol table
  -o outfile
        set output file
  -r dir1:dir2:...
        set ELF dynamic linker search path
  -race
        enable race detector
  -s    disable symbol table
  -shared
        generate shared object (implies -linkmode external)
  -tmpdir dir
        leave temporary files in this directory
  -u    reject unsafe packages
  -v    print link trace
  -w    disable DWARF generation
# server/crawlarticle
usage: 6l [options] main.6
  -1    use alternate profiling code
  -8    assume 64-bit addresses
  -B info
        define ELF NT_GNU_BUILD_ID note
  -C    check Go calls to C code
  -D addr
        data address
  -E sym
        entry symbol
  -I interp
        set ELF interp
  -L dir
        add dir to library path
  -H head
        header type
  -K    add stack underflow checks
  -O    print pc-line tables
  -Q    debug byte-register code gen
  -R rnd
        address rounding
  -S    check type signatures
  -T addr
        text address
  -V    print version and exit
  -W    disassemble input
  -X name value
        define string data
  -Z    clear stack frame on entry
  -a    disassemble output
  -c    dump call graph
  -d    disable dynamic executable
  -extld ld
        linker to run in external mode
  -extldflags ldflags
        flags for external linker
  -f    ignore version mismatch
  -g    disable go package data checks
  -installsuffix suffix
        pkg directory suffix
  -k sym
        set field tracking symbol
  -linkmode mode
        set link mode (internal, external, auto)
  -n    dump symbol table
  -o outfile
        set output file
  -r dir1:dir2:...
        set ELF dynamic linker search path
  -race
        enable race detector
  -s    disable symbol table
  -shared
        generate shared object (implies -linkmode external)
  -tmpdir dir
        leave temporary files in this directory
  -u    reject unsafe packages
  -v    print link trace
  -w    disable DWARF generation
# controller
src/controller/ajax.go:300: undefined: mime.ExtensionsByType

下载不下来

package github.com/qiniu/api
imports github.com/qiniu/api
imports github.com/qiniu/api: no buildable Go source files in /Users/kelunliu/studygolang/websites/code/thirdparty/src/github.com/qiniu/api麻烦楼主看下

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.