Go Doc Tip and Request

100 views
Skip to first unread message

Rich

unread,
Aug 4, 2021, 2:27:54 PM8/4/21
to golang-nuts
I've been dabbling in Go since 2009 -- I grew accustomed to godoc.com, and the way godoc formats the documentation. Not that the new pkg.go.dev isn't any good -- its a matter of preference because you're used to seeing it one way, and pkg.go.dev displays it another. I am not a full time developer, and therefore in the hour or so I actually get to write code per day -- well I just have not found the time to get to know pkg.go.dev.

My solution is to run my own godoc server on my Mac.  First fire it up, godoc -http=localhost:6060 -play.  Then go in to Microsoft Edge, and go to http://localhost:6060. Click on the 'packages' button.  Once you've done this you can stop the godoc server. Next click on the three dots on the far upper right of 'Edge'. Select 'Apps'-->'Install This Site As An App'.  I called it 'GoDoc'. 

Open Terminal, go to ~/Applications/Edge\ Apps.localized/GoDoc.app/Contents/MacOS.  Move app_mode_loader to appGoDoc.  Edit a file in this directory called app_mode_loader.  Put the following in that file:
```
#!/bin/bash

nohup /Users/youruser/go/bin/godoc -http=localhost:6060 -play &
/Users/youruser/Applications/Edge\ Apps.localized/GoDoc.app/Contents/MacOS/appGoDoc
```

The first line starts the godoc server and listens on port 6060. The second line launches Microsoft Edge in App mode for your page.  If you close the window -- godoc still runs in the background, I've not found this to be a problem. On the first start you do have to give it a second or two as the page loads faster than godoc can start to serve. Just refresh. 

The request I have is that if at some point Go Doc takes on a new look like pkg.go.dev, consider that some may like the older format, maybe have godoc and godoc-old or something like that. 
Reply all
Reply to author
Forward
0 new messages