Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/session-uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
brendensoares committed Mar 1, 2022
2 parents 5e99db8 + 413dda3 commit 624f341
Show file tree
Hide file tree
Showing 83 changed files with 1,102 additions and 1,092 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,9 +1,9 @@
language: go

go:
- "1.12.x"
- "1.13.x"
- "1.14.x"
- "1.15.x"
- "tip"

os:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -6,7 +6,7 @@

A high productivity, full-stack web framework for the [Go language](http://www.golang.org).

Current Version: 1.0.0 (2020-07-11)
Current Version: 1.1.0-dev (2020-07-11)

**Supports go.mod package management**

Expand Down
3 changes: 1 addition & 2 deletions before_after_filter.go
Expand Up @@ -5,7 +5,7 @@ import (
)

// Autocalls any defined before and after methods on the target controller
// If either calls returns a value then the result is returned
// If either calls returns a value then the result is returned.
func BeforeAfterFilter(c *Controller, fc []Filter) {
defer func() {
if resultValue := beforeAfterFilterInvoke(FINALLY, c); resultValue != nil && !resultValue.IsNil() {
Expand All @@ -31,7 +31,6 @@ func BeforeAfterFilter(c *Controller, fc []Filter) {
}

func beforeAfterFilterInvoke(method When, c *Controller) (r *reflect.Value) {

if c.Type == nil {
return
}
Expand Down
8 changes: 4 additions & 4 deletions binder.go
Expand Up @@ -57,16 +57,16 @@ func ValueBinder(f func(value string, typ reflect.Type) reflect.Value) func(*Par
}
}

// Revel's default date and time constants
// Revel's default date and time constants.
const (
DefaultDateFormat = "2006-01-02"
DefaultDateTimeFormat = "2006-01-02 15:04"
)

// Binders type and kind definition
// Binders type and kind definition.
var (
// These are the lookups to find a Binder for any type of data.
// The most specific binder found will be used (Type before Kind)
// The most specific binder found will be used (Type before Kind).
TypeBinders = make(map[reflect.Type]Binder)
KindBinders = make(map[reflect.Kind]Binder)

Expand Down Expand Up @@ -284,7 +284,7 @@ func bindSlice(params *Params, name string, typ reflect.Type) reflect.Value {
}

// Break on dots and brackets.
// e.g. bar => "bar", bar.baz => "bar", bar[0] => "bar"
// e.g. bar => "bar", bar.baz => "bar", bar[0] => "bar".
func nextKey(key string) string {
fieldLen := strings.IndexAny(key, ".[")
if fieldLen == -1 {
Expand Down
13 changes: 6 additions & 7 deletions binder_test.go
Expand Up @@ -7,7 +7,6 @@ package revel
import (
"encoding/json"
"fmt"
"github.com/revel/config"
"io"
"io/ioutil"
"os"
Expand All @@ -16,12 +15,15 @@ import (
"strings"
"testing"
"time"

"github.com/revel/config"
)

type A struct {
ID int
Name string
B B
ID int
Name string
B B
//nolint:unused
private int
}

Expand Down Expand Up @@ -209,7 +211,6 @@ func TestJsonBinder(t *testing.T) {
if actualb["a"]["b"] != 45 {
t.Errorf("Failed to fetch map value %#v", actual["a"])
}

}
}

Expand Down Expand Up @@ -250,7 +251,6 @@ func TestBinder(t *testing.T) {
}

for k, fhs := range expectedBoundFiles {

if len(fhs) == 1 {
// Test binding single files to: *os.File, []byte, io.Reader, io.ReadSeeker
for _, binding := range fileBindings {
Expand All @@ -263,7 +263,6 @@ func TestBinder(t *testing.T) {
returns := reflect.ValueOf(binding.f).Call([]reflect.Value{actual})
valEq(t, k, returns[0], reflect.ValueOf(fhs[0].content))
}

} else {
// Test binding multi to:
// []*os.File, [][]byte, []io.Reader, []io.ReadSeeker
Expand Down
2 changes: 2 additions & 0 deletions cache/cache.go
Expand Up @@ -137,9 +137,11 @@ func Flush() error { return Insta
func Set(key string, value interface{}, expires time.Duration) error {
return Instance.Set(key, value, expires)
}

func Add(key string, value interface{}, expires time.Duration) error {
return Instance.Add(key, value, expires)
}

func Replace(key string, value interface{}, expires time.Duration) error {
return Instance.Replace(key, value, expires)
}
4 changes: 2 additions & 2 deletions cache/cache_test.go
Expand Up @@ -14,7 +14,7 @@ import (
// They should pass for all implementations.
type cacheFactory func(*testing.T, time.Duration) Cache

// Test typical cache interactions
// Test typical cache interactions.
func typicalGetSet(t *testing.T, newCache cacheFactory) {
var err error
cache := newCache(t, time.Hour)
Expand All @@ -34,7 +34,7 @@ func typicalGetSet(t *testing.T, newCache cacheFactory) {
}
}

// Test the increment-decrement cases
// Test the increment-decrement cases.
func incrDecr(t *testing.T, newCache cacheFactory) {
var err error
cache := newCache(t, time.Hour)
Expand Down
6 changes: 3 additions & 3 deletions cache/inmemory.go
Expand Up @@ -7,10 +7,10 @@ package cache
import (
"fmt"
"reflect"
"sync"
"time"

"github.com/patrickmn/go-cache"
"sync"
)

type InMemoryCache struct {
Expand Down Expand Up @@ -122,7 +122,7 @@ func (c InMemoryCache) Flush() error {
return nil
}

// Fetches and returns the converted type to a uint64
// Fetches and returns the converted type to a uint64.
func (c InMemoryCache) convertTypeToUint64(key string) (newValue uint64, err error) {
v, found := c.cache.Get(key)
if !found {
Expand Down Expand Up @@ -151,7 +151,7 @@ func (c InMemoryCache) convertTypeToUint64(key string) (newValue uint64, err err
case uint32:
newValue = uint64(v.(uint32))
case uint64:
newValue = uint64(v.(uint64))
newValue = v.(uint64)
case float32:
newValue = uint64(v.(float32))
case float64:
Expand Down
4 changes: 2 additions & 2 deletions cache/inmemory_test.go
Expand Up @@ -13,12 +13,12 @@ var newInMemoryCache = func(_ *testing.T, defaultExpiration time.Duration) Cache
return NewInMemoryCache(defaultExpiration)
}

// Test typical cache interactions
// Test typical cache interactions.
func TestInMemoryCache_TypicalGetSet(t *testing.T) {
typicalGetSet(t, newInMemoryCache)
}

// Test the increment-decrement cases
// Test the increment-decrement cases.
func TestInMemoryCache_IncrDecr(t *testing.T) {
incrDecr(t, newInMemoryCache)
}
Expand Down
1 change: 0 additions & 1 deletion cache/memcached.go
Expand Up @@ -72,7 +72,6 @@ func (c MemcachedCache) Flush() error {

func (c MemcachedCache) invoke(f func(*memcache.Client, *memcache.Item) error,
key string, value interface{}, expires time.Duration) error {

switch expires {
case DefaultExpiryTime:
expires = c.defaultExpiration
Expand Down
2 changes: 1 addition & 1 deletion cache/memcached_test.go
Expand Up @@ -10,7 +10,7 @@ import (
"time"
)

// These tests require memcached running on localhost:11211 (the default)
// These tests require memcached running on localhost:11211 (the default).
const testServer = "localhost:11211"

var newMemcachedCache = func(t *testing.T, defaultExpiration time.Duration) Cache {
Expand Down
5 changes: 2 additions & 3 deletions cache/redis.go
Expand Up @@ -18,9 +18,9 @@ type RedisCache struct {
}

// NewRedisCache returns a new RedisCache with given parameters
// until redigo supports sharding/clustering, only one host will be in hostList
// until redigo supports sharding/clustering, only one host will be in hostList.
func NewRedisCache(host string, password string, defaultExpiration time.Duration) RedisCache {
var pool = &redis.Pool{
pool := &redis.Pool{
MaxIdle: revel.Config.IntDefault("cache.redis.maxidle", 5),
MaxActive: revel.Config.IntDefault("cache.redis.maxactive", 0),
IdleTimeout: time.Duration(revel.Config.IntDefault("cache.redis.idletimeout", 240)) * time.Second,
Expand Down Expand Up @@ -237,7 +237,6 @@ func (c RedisCache) Flush() error {

func (c RedisCache) invoke(f func(string, ...interface{}) (interface{}, error),
key string, value interface{}, expires time.Duration) error {

switch expires {
case DefaultExpiryTime:
expires = c.defaultExpiration
Expand Down
2 changes: 1 addition & 1 deletion cache/redis_test.go
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/revel/revel"
)

// These tests require redis server running on localhost:6379 (the default)
// These tests require redis server running on localhost:6379 (the default).
const redisTestServer = "localhost:6379"

var newRedisCache = func(t *testing.T, defaultExpiration time.Duration) Cache {
Expand Down
8 changes: 0 additions & 8 deletions cache/serialization_test.go
Expand Up @@ -77,11 +77,3 @@ func TestRoundTrip(t *testing.T) {
}
}
}

func zeroMap(arg map[string]interface{}) map[string]interface{} {
result := map[string]interface{}{}
for key, value := range arg {
result[key] = reflect.Zero(reflect.TypeOf(value)).Interface()
}
return result
}

0 comments on commit 624f341

Please sign in to comment.