From c0dc1b3a5358ed04c928aba0ffe9fb638267f19b Mon Sep 17 00:00:00 2001 From: Leonid Bugaev Date: Thu, 4 Sep 2014 23:35:56 +0400 Subject: [PATCH] Rollback elastic search, use godep for dependencies --- .gitignore | 2 +- Dockerfile | 6 ++++-- Makefile | 8 ++++---- README.md | 6 ++++-- elasticsearch/elasticsearch.go => elasticsearch.go | 2 +- output_http.go | 7 +++---- 6 files changed, 17 insertions(+), 14 deletions(-) rename elasticsearch/elasticsearch.go => elasticsearch.go (99%) diff --git a/.gitignore b/.gitignore index bbd2e5d..0018fa2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ *.swp - +Godeps *.gor diff --git a/Dockerfile b/Dockerfile index 4c52fbf..234e18a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM google/golang +RUN go get github.com/tools/godep + WORKDIR /gopath/src/gor -ADD . /gopath/src/gor -RUN go get gor \ No newline at end of file + +ADD . /gopath/src/gor \ No newline at end of file diff --git a/Makefile b/Makefile index 6d34e18..154094c 100644 --- a/Makefile +++ b/Makefile @@ -16,10 +16,10 @@ dbuild: docker build -t gor . dtest: - docker run -t -i gor go test -v + docker run -v `pwd`:/gopath/src/gor -t -i gor godep go test -v -run: - docker run -t -i gor go run $(SOURCE) --input-dummy=0 --output-dummy=0 --verbose +drun: + docker run -v `pwd`:/gopath/src/gor -t -i gor godep go run $(SOURCE) --input-dummy=0 --output-dummy=0 --verbose dbash: - docker run -t -i gor /bin/bash \ No newline at end of file + docker run -v `pwd`:/gopath/src/gor -t -i gor /bin/bash \ No newline at end of file diff --git a/README.md b/README.md index 60965aa..8dc43b9 100644 --- a/README.md +++ b/README.md @@ -197,13 +197,15 @@ https://github.com/buger/gor/releases ``` ## Building from source +We use `godep` for managing dependencies, you can find instructions here: https://github.com/tools/godep. Basically it means that all `go` calls should be prefixed by `godep` command. + 1. Setup standard Go environment http://golang.org/doc/code.html and ensure that $GOPATH environment variable properly set. 2. `go get github.com/buger/gor`. 3. `cd $GOPATH/src/github.com/buger/gor` -4. `go build` to get binary, or `go test` to run tests +4. `godep go build` to get binary, or `go test` to run tests ## Development -Project contains Docker environment +Project contains Docker environment. 1. Build container: `make dbuild` 2. Run tests: `make dtest` diff --git a/elasticsearch/elasticsearch.go b/elasticsearch.go similarity index 99% rename from elasticsearch/elasticsearch.go rename to elasticsearch.go index 8e60c99..0e8fe29 100644 --- a/elasticsearch/elasticsearch.go +++ b/elasticsearch.go @@ -1,4 +1,4 @@ -package elasticsearch +package main import ( "encoding/json" diff --git a/output_http.go b/output_http.go index 38e4fc8..590d618 100644 --- a/output_http.go +++ b/output_http.go @@ -2,8 +2,7 @@ package main import ( "bufio" - "bytes" - es "github.com/buger/gor/elasticsearch" + "bytes" "io" "log" "net/http" @@ -50,7 +49,7 @@ type HTTPOutput struct { headers HTTPHeaders methods HTTPMethods - elasticSearch *es.ESPlugin + elasticSearch *ESPlugin bufStats *GorStat } @@ -77,7 +76,7 @@ func NewHTTPOutput(options string, headers HTTPHeaders, methods HTTPMethods, url o.bufStats = NewGorStat("output_http") if elasticSearchAddr != "" { - o.elasticSearch = new(es.ESPlugin) + o.elasticSearch = new(ESPlugin) o.elasticSearch.Init(elasticSearchAddr) }