dingoblog / dingo

Blog engine written in Go
MIT License
284 stars 34 forks source link

Simplify start command #84

Open Shivakishore14 opened 6 years ago

Shivakishore14 commented 6 years ago

Current way of starting dingo server.

$ cd $GOPATH/src/github.com/dingoblog/dingo
$ go run main.go --port 8000

This can be changed to something like

$ dingo serve --port 8000

If you feel this is good, Just let me know, I can crush a weekend or two and give a PR.

bentranter commented 6 years ago

Hey @Shivakishore14, thanks for the suggestion. I could see this being a nice feature to have for users who aren't as familiar with the Go toolchain. There're a few considerations though.

Right now, you can run go get -u github.com/dingoblog/dingo, which will download and install the package as well as the binary. Once you've got the binary, and assuming your $GOBIN folder is in your $GOPATH, you can start the site using dingo --port 8000, it just won't work anywhere that isn't $GOPATH/src/github.com/dingoblog/dingo as Dingo won't be able to find the views folder.

That being said, it would be possible to use something like packr to load the views into the binary itself, so when users go get the repo they could start the server from anywhere with the dingo command. If we're going to put in that much effort though, it might be worth using goreleaser to ship binaries on every release, and remove the dependency on Go altogether for anyone wanting to install the binary.

Also, if you've got a different idea for how to achieve the dingo serve --port 8000 command, let me know and I'd I will happily consider it 😄