-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
1 parent
e922ce6
commit f315191
Showing
10 changed files
with
200 additions
and
0 deletions.
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 |
---|---|---|
|
@@ -2,8 +2,12 @@ | |
*.test | ||
*.xml | ||
*.swp | ||
fmt.log | ||
lint.log | ||
cover.html | ||
.idea/ | ||
.tmp/ | ||
_site/ | ||
env/ | ||
Gemfile.lock | ||
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,17 @@ | ||
sudo: required | ||
|
||
language: go | ||
|
||
go: | ||
- 1.7 | ||
|
||
services: | ||
- docker | ||
|
||
install: | ||
- make install_ci | ||
|
||
script: | ||
- make test_ci | ||
- travis_retry goveralls -coverprofile=cover.out -service=travis-ci || 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,68 @@ | ||
PROJECT_ROOT=github.com/uber/jaeger | ||
PACKAGES := $(shell glide novendor | grep -v ./thrift-gen/...) | ||
|
||
# all .go files that don't exist in hidden directories | ||
ALL_SRC := $(shell find . -name "*.go" | grep -v -e vendor -e thrift-gen \ | ||
-e ".*/\..*" \ | ||
-e ".*/_.*" \ | ||
-e ".*/mocks.*") | ||
|
||
export GO15VENDOREXPERIMENT=1 | ||
|
||
RACE=-race | ||
GOTEST=go test -v $(RACE) | ||
GOLINT=golint | ||
GOVET=go vet | ||
GOFMT=gofmt | ||
FMT_LOG=fmt.log | ||
LINT_LOG=lint.log | ||
|
||
PASS=$(shell printf "\033[32mPASS\033[0m") | ||
FAIL=$(shell printf "\033[31mFAIL\033[0m") | ||
COLORIZE=sed ''/PASS/s//$(PASS)/'' | sed ''/FAIL/s//$(FAIL)/'' | ||
|
||
.DEFAULT_GOAL := test-and-lint | ||
|
||
.PHONY: test-and-lint | ||
test-and-lint: test fmt lint | ||
|
||
.PHONY: test | ||
test: | ||
$(GOTEST) $(PACKAGES) | $(COLORIZE) | ||
|
||
.PHONY: fmt | ||
fmt: | ||
$(GOFMT) -e -s -l -w $(ALL_SRC) | ||
|
||
.PHONY: lint | ||
lint: | ||
$(GOVET) $(PACKAGES) | ||
@cat /dev/null > $(LINT_LOG) | ||
@$(foreach pkg, $(PACKAGES), $(GOLINT) $(pkg) | grep -v crossdock/thrift >> $(LINT_LOG) || true;) | ||
@[ ! -s "$(LINT_LOG)" ] || (echo "Lint Failures" | cat - $(LINT_LOG) && false) | ||
@$(GOFMT) -e -s -l $(ALL_SRC) > $(FMT_LOG) | ||
@[ ! -s "$(FMT_LOG)" ] || (echo "Go Fmt Failures, run 'make fmt'" | cat - $(FMT_LOG) && false) | ||
|
||
.PHONY: install | ||
install: | ||
glide --version || go get github.com/Masterminds/glide | ||
glide install | ||
|
||
.PHONY: cover | ||
cover: | ||
./scripts/cover.sh $(shell go list $(PACKAGES)) | ||
go tool cover -html=cover.out -o cover.html | ||
|
||
.PHONY: install_ci | ||
install_ci: install | ||
go get github.com/wadey/gocovmerge | ||
go get github.com/mattn/goveralls | ||
go get golang.org/x/tools/cmd/cover | ||
go get github.com/golang/lint/golint | ||
|
||
|
||
.PHONY: test_ci | ||
test_ci: | ||
@./scripts/cover.sh $(shell go list $(PACKAGES)) | ||
make lint | ||
|
Empty file.
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,5 @@ | ||
package main | ||
|
||
func main() { | ||
println("jaeger-agent") | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
package: github.com/uber/jaeger | ||
import: | ||
- package: github.com/uber/jaeger-lib | ||
- package: github.com/uber-go/zap |
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,60 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
COVER=.cover | ||
ROOT_PKG=github.com/uber/jaeger/ | ||
|
||
if [[ -d "$COVER" ]]; then | ||
rm -rf "$COVER" | ||
fi | ||
mkdir -p "$COVER" | ||
|
||
# If a package directory has a .nocover file, don't count it when calculating | ||
# coverage. | ||
filter="" | ||
for pkg in "$@"; do | ||
if [[ -f "$GOPATH/src/$pkg/.nocover" ]]; then | ||
if [[ -n "$filter" ]]; then | ||
filter="$filter, " | ||
fi | ||
filter="\"$pkg\": true" | ||
fi | ||
done | ||
|
||
i=0 | ||
for pkg in "$@"; do | ||
i=$((i + 1)) | ||
|
||
extracoverpkg="" | ||
if [[ -f "$GOPATH/src/$pkg/.extra-coverpkg" ]]; then | ||
extracoverpkg=$( \ | ||
sed -e "s|^|$pkg/|g" < "$GOPATH/src/$pkg/.extra-coverpkg" \ | ||
| tr '\n' ',') | ||
fi | ||
|
||
coverpkg=$(go list -json "$pkg" | jq -r ' | ||
.Deps | ||
| . + ["'"$pkg"'"] | ||
| map | ||
( select(startswith("'"$ROOT_PKG"'")) | ||
| select(contains("/vendor/") | not) | ||
| select(in({'"$filter"'}) | not) | ||
) | ||
| join(",") | ||
') | ||
if [[ -n "$extracoverpkg" ]]; then | ||
coverpkg="$extracoverpkg$coverpkg" | ||
fi | ||
|
||
if [[ -z "$coverpkg" ]]; then | ||
continue | ||
fi | ||
|
||
args="-coverprofile $COVER/cover.${i}.out" # -coverpkg $coverpkg | ||
|
||
echo go test -race "$pkg" | ||
go test $args -race "$pkg" | ||
done | ||
|
||
gocovmerge "$COVER"/*.out > cover.out |
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,24 @@ | ||
package agent | ||
|
||
import ( | ||
"github.com/uber-go/zap" | ||
) | ||
|
||
// Agent is a composition of all services / components | ||
type Agent interface { | ||
// Run starts all services of the Agent | ||
// Run() | ||
} | ||
|
||
type agent struct { | ||
logger zap.Logger | ||
} | ||
|
||
// New creates a new Jaeger Agent | ||
func New( | ||
logger zap.Logger, | ||
) Agent { | ||
return &agent{ | ||
logger: logger, | ||
} | ||
} |
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,11 @@ | ||
package agent_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/uber/jaeger/services/agent" | ||
) | ||
|
||
func TestNewAgent(t *testing.T) { | ||
agent.New(nil) | ||
} |