dsn46282 2019-03-10 06:52
浏览 193

使用Godoc启动本地文档服务器时出现问题

godoc won't return packages list

Build version go1.11.5.

go env:

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\dell\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=E:\Go work
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\dell\AppData\Local\Temp\go-build908876718=/tmp/go-build -gno-record-gcc-switches

Currently learning go, checking go packages docs a lot, so I am trying to start a local go docments server using godoc. the command I am using is:

godoc -http=:54321

The server started without problem, but when I click the "Packages" button on top of the page or visit localhost:54321 it gave me this:

\src\temp.go:1:1: expected 'package', found 'EOF'

instead of packages list like the online doc. But if I visit http://localhost:54321/pkg/io/ or any other packages directly it works fine.

I have an empty temp.go file under my e:\go work\src, so I am pretty sure that's where the error coming from.

What I want is godoc return package list when I visit http://localhost:54321/pkg/, just like visit the online doc https://golang.org/pkg/

  • 写回答

1条回答 默认 最新

  • duanjue6584 2019-03-10 07:21
    关注

    Put at least the package line into temp.go file or remove that file fix the problem. It seems any file directly under $GOPATH/src/ contain syntax error will cause problem

    评论

报告相同问题?

悬赏问题

  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等