This repository has been archived by the owner on May 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,134 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bin/ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
language: go | ||
|
||
go: | ||
- "1.10.x" | ||
- master | ||
script: make ci |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Gopkg.toml example | ||
# | ||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
# | ||
# [prune] | ||
# non-go = false | ||
# go-tests = true | ||
# unused-packages = true | ||
|
||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/juju/mgosession" | ||
|
||
[[constraint]] | ||
name = "github.com/stretchr/testify" | ||
version = "1.2.1" | ||
|
||
[[constraint]] | ||
branch = "v2" | ||
name = "gopkg.in/mgo.v2" | ||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.PHONY: all | ||
all: build | ||
FORCE: ; | ||
|
||
SHELL := env BOOKMARK_ENV=$(BOOKMARK_ENV) $(SHELL) | ||
BOOKMARK_ENV ?= dev | ||
|
||
include config/$(BOOKMARK_ENV).env | ||
export $(shell sed 's/=.*//' config/$(BOOKMARK_ENV).env) | ||
BIN_DIR = $(PWD)/bin | ||
|
||
.PHONY: build | ||
|
||
clean: | ||
rm -rf bin/* | ||
|
||
dependencies: | ||
dep ensure | ||
|
||
build: dependencies build-api build-cmd | ||
|
||
build-api: | ||
go build -o ./bin/api api/main.go | ||
|
||
build-cmd: | ||
go build -o ./bin/search cmd/main.go | ||
|
||
linux-binaries: | ||
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -tags netgo -installsuffix netgo -o $(BIN_DIR)/api api/main.go | ||
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -tags netgo -installsuffix netgo -o $(BIN_DIR)/search cmd/main.go | ||
|
||
ci: dependencies test | ||
|
||
test: | ||
export BOOKMARK_ENV=$(BOOKMARK_ENV); go test ./... | ||
|
||
fmt: ## gofmt and goimports all go files | ||
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,58 @@ | ||
# clean-architecture-go | ||
# Clean Architecture in Go | ||
|
||
Clean Architecture sample | ||
|
||
## Post | ||
|
||
[https://medium.com/@eminetto/clean-architecture-using-golang-b63587aa5e3f](https://medium.com/@eminetto/clean-architecture-using-golang-b63587aa5e3f) | ||
|
||
|
||
## Build | ||
|
||
make | ||
|
||
## Run tests | ||
|
||
make test | ||
|
||
## API requests | ||
|
||
### Add a bookmark | ||
|
||
``` | ||
curl -X "POST" "http://localhost:8080/v1/bookmark" \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'Accept: application/json' \ | ||
-d $'{ | ||
"tags": [ | ||
"git", | ||
"social" | ||
], | ||
"name": "Github", | ||
"description": "Github site", | ||
"link": "http://github.com" | ||
}' | ||
``` | ||
### Search a bookmark | ||
|
||
``` | ||
curl "http://localhost:8080/v1/bookmark?name=github" \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'Accept: application/json' | ||
``` | ||
|
||
### Show all bookmarks | ||
|
||
``` | ||
curl "http://localhost:8080/v1/bookmark" \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'Accept: application/json' | ||
``` | ||
|
||
## CMD | ||
|
||
### Search for a bookmark | ||
|
||
``` | ||
./bin/search github | ||
``` |
Oops, something went wrong.