Sunday January 22 2017

gosrv A simple Go file server

There’s not really too much to say here, I saw this was possible when digging through the excellent documentation and decided it would be something worth putting on my git server allowing me to go get to install it.

If you have go installed properly it is indeed as easy as:

$ got get

You can view the source code for the program on my git server.


$ gosrv  -h
Usage of Simple File Server:
  -d string
    	Directory to serve. (default ".")
  -l string
    	Listening address (default "")

Should I actually use this instead of Nginx, Apache or $other_server

Maybe? Maybe not. I wrote it to facilitate quick and easy file transfers over HTTP, I can message someone an internal URL e.g. So using it instead of Nginx in that case saves time.

It’s not meant for long running constant usage, although you could use it that way and you will not likely see an issue. Go’s HTTP stack is solid.

So, if you want to save time, yes. If you want a production server? No.

If you don’t have go setup properly here’s a quick start:

Then it’s usually as simple as adding:

export GOPATH="$HOME/go"
export PATH="$PATH:$GOPATH/bin:/usr/local/go/bin"

In your shell’s profile. You can read more on what the GOPATH is and how it’s structured in the excellent documentation.