Skip to content

Commit

Permalink
Switch from Taskfile.yml to Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Vic Shóstak committed Feb 26, 2021
1 parent 0e58b67 commit 7ce0ba6
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 49 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
Dockerfile
Makefile
LICENSE
Taskfile.yml
*.md

# Folders
Expand Down
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.PHONY: clean test security build run

BUILD_DIR = $(PWD)/build
APP_NAME = apiserver

clean:
rm -rf ./build

test:
go test -cover ./...

security:
gosec -quiet ./...

build: security test
CGO_ENABLED=0 go build -ldflags="-w -s" -o $(BUILD_DIR)/$(APP_NAME) main.go

run: clean build
$(BUILD_DIR)/$(APP_NAME)
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ cgapp create
2. Run project by this command:

```bash
task -s
make run
```

> ☝️ We're using `Taskfile` as task manager for running project on a local machine by default. If you've never heard of `Taskfile`, we recommend to read the [Docs](https://taskfile.dev/#/usage?id=getting-started) and use it, instead of `Makefile`.
## ✅ Used packages

- [gorilla/mux](https://github.com/gorilla/mux) `v1.7.4`
Expand All @@ -35,7 +33,7 @@ task -s
├── .editorconfig
├── .gitignore
├── Dockerfile
├── Taskfile.yml
├── Makefile
├── go.mod
├── go.sum
├── main.go
Expand Down
39 changes: 0 additions & 39 deletions Taskfile.yml

This file was deleted.

5 changes: 1 addition & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=
github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
4 changes: 3 additions & 1 deletion pkg/apiserver/new_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ func (s *APIServer) Start() {

// Doesn't block if no connections, but will otherwise wait
// until the timeout deadline.
server.Shutdown(ctx)
if err := server.Shutdown(ctx); err != nil {
log.Println(err)
}

// Optionally, you could run srv.Shutdown in a goroutine and block on
// <-ctx.Done() if your application should wait for other services
Expand Down

0 comments on commit 7ce0ba6

Please sign in to comment.