Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
Moved golang code into golang/
Browse files Browse the repository at this point in the history
  • Loading branch information
thrawn01 committed Feb 14, 2019
1 parent 891ceea commit 2d39ecb
Show file tree
Hide file tree
Showing 30 changed files with 41 additions and 50 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# TODO: https://stackoverflow.com/questions/1722807/how-to-convert-git-urls-to-http-urls
# TODO: https://medium.com/@tonistiigi/build-secrets-and-ssh-forwarding-in-docker-18-09-ae8161d066

# Build image
FROM golang:1.11.2 as build

# Copy the local package files to the container
ADD . /src
ADD golang /src
WORKDIR /src
ENV VERSION=dev-build

Expand Down
4 changes: 2 additions & 2 deletions algorithms.go → golang/algorithms.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package gubernator

import (
"github.com/mailgun/gubernator/cache"
"github.com/mailgun/gubernator/pb"
"github.com/mailgun/gubernator/golang/cache"
"github.com/mailgun/gubernator/golang/pb"
)

// Implements token bucket algorithm for rate limiting. https://en.wikipedia.org/wiki/Token_bucket
Expand Down
4 changes: 2 additions & 2 deletions benchmark_test.go → golang/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package gubernator_test

import (
"context"
"github.com/mailgun/gubernator"
"github.com/mailgun/gubernator/pb"
"github.com/mailgun/gubernator/golang"
"github.com/mailgun/gubernator/golang/pb"
"net/http"
"testing"
"time"
Expand Down
2 changes: 1 addition & 1 deletion cache/lru.go → golang/cache/lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"sync"
"time"

"github.com/mailgun/gubernator/pb"
"github.com/mailgun/gubernator/golang/pb"
"github.com/mailgun/holster"
"github.com/mailgun/holster/clock"
"github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion cache/types.go → golang/cache/types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cache

import "github.com/mailgun/gubernator/pb"
import "github.com/mailgun/gubernator/golang/pb"

// Interface accepts any cache which returns cache stats
type CacheStats interface {
Expand Down
2 changes: 1 addition & 1 deletion client.go → golang/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"math/rand"
"time"

"github.com/mailgun/gubernator/pb"
"github.com/mailgun/gubernator/golang/pb"
"github.com/pkg/errors"
"google.golang.org/grpc"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (

etcd "github.com/coreos/etcd/clientv3"
"github.com/ghodss/yaml"
"github.com/mailgun/gubernator"
"github.com/mailgun/gubernator/cache"
"github.com/mailgun/gubernator/logging"
"github.com/mailgun/gubernator/metrics"
"github.com/mailgun/gubernator/sync"
"github.com/mailgun/gubernator/golang"
"github.com/mailgun/gubernator/golang/cache"
"github.com/mailgun/gubernator/golang/logging"
"github.com/mailgun/gubernator/golang/metrics"
"github.com/mailgun/gubernator/golang/sync"
"github.com/mailgun/holster"
"github.com/mailgun/holster/etcdutil"
"github.com/sirupsen/logrus"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"os"

"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/mailgun/gubernator"
"github.com/mailgun/gubernator/cache"
"github.com/mailgun/gubernator/metrics"
"github.com/mailgun/gubernator/pb"
"github.com/mailgun/gubernator/sync"
"github.com/mailgun/gubernator/golang"
"github.com/mailgun/gubernator/golang/cache"
"github.com/mailgun/gubernator/golang/metrics"
"github.com/mailgun/gubernator/golang/pb"
"github.com/mailgun/gubernator/golang/sync"
"github.com/mailgun/service"
"github.com/pkg/errors"
"google.golang.org/grpc"
Expand Down
2 changes: 1 addition & 1 deletion cmd/gubernator/main.go → golang/cmd/gubernator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"time"

"github.com/mailgun/gubernator"
"github.com/mailgun/gubernator/golang"
"github.com/mailgun/holster"
)

Expand Down
4 changes: 2 additions & 2 deletions config.go → golang/config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package gubernator

import (
"github.com/mailgun/gubernator/cache"
"github.com/mailgun/gubernator/metrics"
"github.com/mailgun/gubernator/golang/cache"
"github.com/mailgun/gubernator/golang/metrics"
)

type UpdateFunc func(*PeerConfig)
Expand Down
8 changes: 4 additions & 4 deletions functional_test.go → golang/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"testing"
"time"

"github.com/mailgun/gubernator"
"github.com/mailgun/gubernator/cache"
"github.com/mailgun/gubernator/metrics"
"github.com/mailgun/gubernator/golang"
"github.com/mailgun/gubernator/golang/cache"
"github.com/mailgun/gubernator/golang/metrics"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -40,7 +40,7 @@ func startCluster() error {
grpcServers = append(grpcServers, srv)
}

httpServer, err = gubernator.NewHTTPServer(grpcServers[0], gubernator.ServerConfig{})
httpServer, err = gubernator.NewHTTPServer(gubernator.ServerConfig{})
if err != nil {
return errors.Wrap(err, "NewHTTPServer()")
}
Expand Down
17 changes: 2 additions & 15 deletions go.mod → golang/go.mod
Original file line number Diff line number Diff line change
@@ -1,46 +1,33 @@
module github.com/mailgun/gubernator
module github.com/mailgun/gubernator/golang

require (
github.com/DataDog/zstd v1.3.5 // indirect
github.com/Shopify/sarama v1.20.1 // indirect
github.com/Unix4ever/statsd v0.0.0-20160120230120-a8219f1fb9d8 // indirect
github.com/cactus/go-statsd-client/statsd v0.0.0-20190125104250-82b7a1700102 // indirect
github.com/coreos/etcd v3.3.11+incompatible
github.com/davecgh/go-spew v1.1.1
github.com/eapache/go-resiliency v1.1.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/ghodss/yaml v1.0.0
github.com/gogo/protobuf v1.2.0 // indirect
github.com/golang/protobuf v1.2.0
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/gorilla/mux v1.7.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.7.0
github.com/kr/pretty v0.1.0 // indirect
github.com/mailgun/holster v2.3.5+incompatible
github.com/mailgun/iptools v0.0.0-20170310010557-ba8d5743f678 // indirect
github.com/mailgun/logrus-hooks v1.2.1
github.com/mailgun/service v1.3.2-0.20190214034514-38a9fb32dabc
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 // indirect
github.com/mattn/go-colorable v0.1.0 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea // indirect
github.com/pierrec/lz4 v2.0.5+incompatible // indirect
github.com/pkg/errors v0.8.1
github.com/quipo/statsd v0.0.0-20180118161217-3d6a5565f314 // indirect
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect
github.com/sirupsen/logrus v1.3.0
github.com/smira/go-statsd v1.2.1
github.com/stretchr/testify v1.3.0
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect
golang.org/x/net v0.0.0-20190119204137-ed066c81e75e
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
google.golang.org/grpc v1.18.0
gopkg.in/ahmetb/go-linq.v3 v3.0.0 // indirect
gopkg.in/alexcesaro/statsd.v2 v2.0.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v2 v2.2.2 // indirect
)
File renamed without changes.
2 changes: 1 addition & 1 deletion grpc.go → golang/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"sync"
"time"

"github.com/mailgun/gubernator/pb"
"github.com/mailgun/gubernator/golang/pb"
"github.com/mailgun/holster"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion http.go → golang/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/mailgun/gubernator/pb"
"github.com/mailgun/gubernator/golang/pb"
"github.com/mailgun/holster"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion metrics/statsd.go → golang/metrics/statsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"time"

"github.com/mailgun/gubernator/cache"
"github.com/mailgun/gubernator/golang/cache"
"github.com/mailgun/holster"
"github.com/sirupsen/logrus"
"github.com/smira/go-statsd"
Expand Down
2 changes: 1 addition & 1 deletion metrics/types.go → golang/metrics/types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package metrics

import (
"github.com/mailgun/gubernator/cache"
"github.com/mailgun/gubernator/golang/cache"
"github.com/mailgun/holster/clock"
"google.golang.org/grpc/stats"
"time"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion peers.go → golang/peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package gubernator

import (
"context"
"github.com/mailgun/gubernator/pb"
"github.com/mailgun/gubernator/golang/pb"
"github.com/pkg/errors"
"google.golang.org/grpc"
"sync"
Expand Down
2 changes: 1 addition & 1 deletion sync/etcd.go → golang/sync/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

etcd "github.com/coreos/etcd/clientv3"
"github.com/mailgun/gubernator"
"github.com/mailgun/gubernator/golang"
"github.com/mailgun/holster"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 5 additions & 4 deletions scripts/proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ set -e
set -u
set -x

PROTO_DIR=./pb
PROTO_DIR=./proto
GO_DIR=./golang/pb

# Cleanup outdated autogenerated files.
rm -f $PROTO_DIR/*.go
rm -f $GO_DIR/*.go

protoc -I=$PROTO_DIR \
-I=$GOPATH/pkg/mod/github.com/grpc-ecosystem/grpc-gateway\@v1.7.0/third_party/googleapis \
--go_out=plugins=grpc:$PROTO_DIR \
--go_out=plugins=grpc:$GO_DIR \
$PROTO_DIR/*.proto

protoc -I=$PROTO_DIR \
-I=$GOPATH/pkg/mod/github.com/grpc-ecosystem/grpc-gateway\@v1.7.0/third_party/googleapis \
--grpc-gateway_out=logtostderr=true:$PROTO_DIR \
--grpc-gateway_out=logtostderr=true:$GO_DIR \
$PROTO_DIR/*.proto

0 comments on commit 2d39ecb

Please sign in to comment.