Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
coverage.html
5 changes: 5 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM golang:1.13
WORKDIR /opt/app
RUN go get github.com/cespare/reflex \
&& curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin
ENTRYPOINT ["reflex", "--decoration=none", "--regex=\\.go$", "-s", "--", "go", "run", "/opt/app/main.go"]
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,15 @@ migrate-up:

migrate-down:
docker run -v "${CURDIR}/migrations:/migrations" --network host migrate/migrate -path=/migrations/ -database "mysql://root:test100500@tcp(localhost:3306)/flat-search" down -all

lint:
docker-compose run --rm --entrypoint golangci-lint flat-search run ./...

tests:
docker-compose run --rm --entrypoint go flat-search test ./...

code-coverage:
@docker-compose run --rm --no-deps --entrypoint bash flat-search -xeuo pipefail -c "go test -coverprofile=/tmp/c.out ./...; \
go tool cover -html=/tmp/c.out -o coverage.html; \
"
open coverage.html
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
flat-search:
build:
context: .
dockerfile: Dockerfile
dockerfile: Dockerfile.dev
container_name: flatsearch
depends_on:
- storage
Expand All @@ -15,6 +15,7 @@ services:
DB_USER: flat-agent
DB_PASSWORD: test-flat-agent
volumes:
- .:/opt/app
- go-pkg:/go/pkg
- go-cache:/.cache

Expand Down