This is a creation in Article, where the information may have evolved or changed.
How to run Godoc under Launchd on OS X
Godoc is an amazing reference utility. I use the launchd to keep it running for me.
<?xml version= "1.0" encoding= "UTF-8"? ><! DOCTYPE plist Public "-//apple//dtd plist 1.0//en" "Http://www.apple.com/DTDs/PropertyList-1.0.dtd" ><plist Version= "1.0" ><dict> <key>Label</key> <string>org.golang.godoc</string> <key& Gt Programarguments</key> <array> <!--Ensure this was the absolute path to your Godoc install-- <string>/Users/dave/go/bin/godoc</string> <string>-http=127.0.0.1:6060</string> </arr ay> <key>Sockets</key> <dict> <key>Listeners</key> <dict> < ;key>sockservicename</key> <string>6060</string> </dict> </dict> <key >RunAtLoad</key> <false/> </dict></plist>
Place this file in and ~/Library/LaunchAgents/org.golang.godoc.plist
edit the absolute path to your Godoc binary. Then issue the command
$ launchctl load ~/Library/LaunchAgents/org.golang.godoc.plist
You can then browse to http://127.0.0.1:6060 to view the current documentation for your Go installation.
To stop Godoc just issue a killall Godoc and Launchd would restart it when necessary. You can use the same command after updating to the latest release to ensure your ' re viewing the most up to date Documentati On.
--– I'm a split line ——— –
Launchctl is not particularly friendly, load the plist file with load, will only report an error, but will not tell you what error, today toss for a long time, only to find the format problem, missing a number.
The original does not seem to mention using start start, in this case, the start Godoc need to use the start command:
launchctl start org.golang.godoc
Do not know why to start Godoc also configure Socketservice, see others Configure Redis also not specified, the results of the Redis configuration, has not started, fortunately, someone wrote a ready-made. Look for a chance to see the detailed format of plist to go.