Wie wollen Sie dienen der einfachen Dokumentation für die go-Programme mit godoc als eine Webseite?

Ich versuche zu dienen, eine bestimmte lokale gehen, die Datei als Dokumentation, web-Seite, aber nicht in der Lage war, es zu tun.

Den offizielle godoc Dokumentation sagt:

Mit der-http-flag (d.h. die godoc Befehl), es läuft als web-server und stellt die Dokumentation als web-Seite.

user_me$ godoc -http=:6060

Dies bedeutet etwas ähnliches wie die Seite Los ist, aber es nicht dazu, dass die spezifische Datei, die ich Rendern möchten. So habe ich versucht, geben Sie den Namen der Datei, die ich wollte:

user_me$ godoc -http=:6000 hello.go

Allerdings nur Antworten mit:

usage: godoc package [name ...]
    godoc -http=:6060
  -ex=false: show examples in command line mode
  -goroot="/usr/local/go": Go root directory
  -html=false: print HTML in command-line mode
  -http="": HTTP service address (e.g., ':6060')
  -httptest.serve="": if non-empty, httptest.NewServer serves on this address and blocks
  -index=false: enable search index
  -index_files="": glob pattern specifying index files;if not empty, the index is read from these files in sorted order
  -index_throttle=0.75: index throttle value; 0.0 = no time allocated, 1.0 = full throttle
  -links=true: link identifiers to their declarations
  -maxresults=10000: maximum number of full text search results shown
  -notes="BUG": regular expression matching note markers to show
  -play=false: enable playground in web interface
  -q=false: arguments are considered search queries
  -server="": webserver address for command line searches
  -src=false: print (exported) source in command-line mode
  -tabwidth=4: tab width
  -templates="": directory containing alternate template files
  -timestamps=false: show timestamps with directory listings
  -url="": print HTML for named URL
  -v=false: verbose mode
  -write_index=false: write index to a file; the file name must be specified with -index_files
  -zip="": zip file providing the file system to serve; disabled if empty

Ich auch versucht:

user_me$ godoc -url="localhost:8080" hello.go

aber es hat nicht funktioniert.

Ich auch versucht:

godoc -server=localhost:8080 hello.go

aber es antwortete mit:

2014/07/01 10:45:56 open /usr/local/go/src/pkg/hello.go: no such file or directory

Ich habe sogar versucht nur die Generierung der html-Sache selbst:

godoc -html hello.go > hello.html

gleichen Fehler wie oben.

Ich habe auch versucht (da war es beklagen, dass es keine Datei in der pkg-dir):

godoc -html -goroo=$GOPATH hello.go > hello.html

Am Ende, ich gab auf. Ich weiß nicht, wie diese godoc Ding funktioniert. Ich installierte die Hallo.gehen Sie das Programm so, dass ich es war etwas in der pkg Datei in den Arbeitsbereich. Wie Sie erstellen eine Webseite mit Ihren Unterlagen für Ihren code?

InformationsquelleAutor Pinocchio | 2014-07-01
Schreibe einen Kommentar