Skip to content

Commit

Permalink
Merge pull request #4 from krish8664/remove-subpackages
Browse files Browse the repository at this point in the history
Moves config and ratelimit to parent package
  • Loading branch information
rShetty authored May 26, 2017
2 parents 15f4841 + fd0901f commit 920d7e8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config/config.go → config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package ratelimit

// RateLimitConfig type for setting rate limiting params
type RateLimitConfig struct {
Expand Down
6 changes: 3 additions & 3 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package: go-ratelimit
package: github.com/gojek-engineering/go-ratelimit
import:
- package: github.com/garyburd/redigo
version: ^1.0.0
Expand Down
5 changes: 2 additions & 3 deletions ratelimit/ratelimit.go → ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ratelimit

import (
"errors"
"go-ratelimit/config"
"strconv"

"github.com/garyburd/redigo/redis"
Expand All @@ -21,11 +20,11 @@ type RateLimiter interface {
// RateLimit type for ratelimiting
type RateLimit struct {
redisPool *redis.Pool
config *config.RateLimitConfig
config *RateLimitConfig
}

// NewRateLimit func to create a new rate limiting type
func NewRateLimit(redisPool *redis.Pool, config *config.RateLimitConfig) *RateLimit {
func NewRateLimit(redisPool *redis.Pool, config *RateLimitConfig) *RateLimit {
return &RateLimit{
redisPool: redisPool,
config: config,
Expand Down
5 changes: 2 additions & 3 deletions ratelimit/ratelimit_test.go → ratelimit_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ratelimit

import (
"go-ratelimit/config"
"testing"

"github.com/garyburd/redigo/redis"
Expand All @@ -13,7 +12,7 @@ import (
type RateLimitSuite struct {
suite.Suite
redisPool *redis.Pool
redisConfig *config.RateLimitConfig
redisConfig *RateLimitConfig
}

func testRedisPool() *redis.Pool {
Expand All @@ -30,7 +29,7 @@ func testRedisPool() *redis.Pool {
}

func (suite *RateLimitSuite) SetupSuite() {
suite.redisConfig = config.NewRateLimitConfig(3, 15, 60)
suite.redisConfig = NewRateLimitConfig(3, 15, 60)
suite.redisPool = testRedisPool()
}

Expand Down

0 comments on commit 920d7e8

Please sign in to comment.