From d4b2e6eac8535325fc269b8da2ecf154fe9aab7c Mon Sep 17 00:00:00 2001 From: James Mills Date: Thu, 6 Jul 2017 22:51:08 -0700 Subject: [PATCH] Removed unused config --- .gitignore | 1 + Makefile | 9 ++++++--- config.go | 5 ----- config_test.go | 13 ------------- main.go | 5 ++--- server.go | 4 +--- 6 files changed, 10 insertions(+), 27 deletions(-) delete mode 100644 config.go delete mode 100644 config_test.go diff --git a/.gitignore b/.gitignore index c654875..e8137e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +*.db shorturl diff --git a/Makefile b/Makefile index 0f06925..979abcf 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,14 @@ all: dev dev: build - ./shorturl -bind 127.0.0.1:8000 + ./shorturl build: clean go get ./... - go build -o ./shorturl . + go build . + +test: + go test ./... clean: - rm -rf bin shorturl + rm -rf shorturl diff --git a/config.go b/config.go deleted file mode 100644 index 7222dd8..0000000 --- a/config.go +++ /dev/null @@ -1,5 +0,0 @@ -package main - -// Config ... -type Config struct { -} diff --git a/config_test.go b/config_test.go deleted file mode 100644 index 933ffff..0000000 --- a/config_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package main - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestZeroConfig(t *testing.T) { - assert := assert.New(t) - - cfg := Config{} -} diff --git a/main.go b/main.go index 54bb1f7..08c6590 100644 --- a/main.go +++ b/main.go @@ -8,8 +8,7 @@ import ( ) var ( - db *bolt.DB - cfg Config + db *bolt.DB ) func main() { @@ -31,5 +30,5 @@ func main() { } defer db.Close() - NewServer(bind, cfg).ListenAndServe() + NewServer(bind).ListenAndServe() } diff --git a/server.go b/server.go index 1839ddd..4ebcb2b 100644 --- a/server.go +++ b/server.go @@ -12,7 +12,6 @@ import ( // Server ... type Server struct { bind string - config Config templates *templice.Template router *httprouter.Router } @@ -82,10 +81,9 @@ func (s *Server) initRoutes() { } // NewServer ... -func NewServer(bind string, config Config) *Server { +func NewServer(bind string) *Server { server := &Server{ bind: bind, - config: config, router: httprouter.New(), templates: templice.New(rice.MustFindBox("templates")), }