https://github.com/wgh-/socket-activated-godoc
https://github.com/wgh-/socket-activated-godoc
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/wgh-/socket-activated-godoc
- Owner: WGH-
- License: bsd-3-clause
- Created: 2017-12-23T20:48:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-24T00:18:38.000Z (over 7 years ago)
- Last Synced: 2025-01-25T16:43:40.932Z (5 months ago)
- Language: Go
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is a systemd socket-activated version of godoc's HTTP mode.
If you'd like to use godoc's built-in HTTP server to browse Go documentation offline,
you can use this package instead to make it start lazily, the first time it's accessed, and
to make it shutdown automatically after period of inactivity.It imports `golang.org/x/tools/godoc` package, so the interface is exactly the same.
However, because of the fact that some logic is kept privately in `golang.org/x/tools/cmd/godoc`
package, in order to avoid copy-pasting too much code, I decided to skip that functionality. As a result,
blog page, playground and codewalk don't work. If you need them, feel free to open an issue.## Installation
This instruction assumes you want to install the binary for your current user,
and to use the user systemd instance.If you want to install it globally, you'll need to run different commands and edit
systemd unit files as necessary.1. Install it to your `GOPATH` with `go install github.com/WGH-/socket-activated-godoc`
2. Put systemd units into `~/.config/systemd/user` directory: `cp $GOPATH/src/github.com/WGH-/socket-activated-godoc/godoc.{service,socket} ~/.config/systemd/user`, edit them (e.g. listening address) as needed.
3. Reload systemd state and start the socket: `systemctl --user daemon-reload && systemctl --user enable --now godoc.socket`