mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
Merge pull request #3692 from weaveworks/go-1-13
Bump Go version to 1.13.0
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.10.2
|
||||
FROM golang:1.13.0
|
||||
ENV SCOPE_SKIP_UI_ASSETS true
|
||||
RUN set -eux; \
|
||||
export arch_val="$(dpkg --print-architecture)"; \
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/camlistore/camlistore/pkg/lru"
|
||||
"camlistore.org/pkg/lru"
|
||||
|
||||
"github.com/weaveworks/scope/report"
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ import (
|
||||
|
||||
// Cache is an LRU cache, safe for concurrent access.
|
||||
type Cache struct {
|
||||
maxEntries int
|
||||
maxEntries int // zero means no limit
|
||||
|
||||
mu sync.Mutex
|
||||
ll *list.List
|
||||
@@ -38,6 +38,7 @@ type entry struct {
|
||||
}
|
||||
|
||||
// New returns a new cache with the provided maximum items.
|
||||
// A maxEntries of 0 means no limit.
|
||||
func New(maxEntries int) *Cache {
|
||||
return &Cache{
|
||||
maxEntries: maxEntries,
|
||||
@@ -63,7 +64,7 @@ func (c *Cache) Add(key string, value interface{}) {
|
||||
ele := c.ll.PushFront(&entry{key, value})
|
||||
c.cache[key] = ele
|
||||
|
||||
if c.ll.Len() > c.maxEntries {
|
||||
if c.maxEntries > 0 && c.ll.Len() > c.maxEntries {
|
||||
c.removeOldest()
|
||||
}
|
||||
}
|
||||
18
vendor/manifest
vendored
18
vendor/manifest
vendored
@@ -8,6 +8,15 @@
|
||||
"revision": "75cd24fc2f2c",
|
||||
"branch": "default"
|
||||
},
|
||||
{
|
||||
"importpath": "camlistore.org/pkg/lru",
|
||||
"repository": "https://github.com/camlistore/old-cam-snapshot",
|
||||
"vcs": "git",
|
||||
"revision": "a5a65f0d8b2281c4cc8c259ba882dd0ec851427f",
|
||||
"branch": "master",
|
||||
"path": "/pkg/lru",
|
||||
"notests": true
|
||||
},
|
||||
{
|
||||
"importpath": "github.com/Azure/go-ansiterm",
|
||||
"repository": "https://github.com/Azure/go-ansiterm",
|
||||
@@ -238,15 +247,6 @@
|
||||
"path": "/statsd",
|
||||
"notests": true
|
||||
},
|
||||
{
|
||||
"importpath": "github.com/camlistore/camlistore/pkg/lru",
|
||||
"repository": "https://github.com/camlistore/camlistore",
|
||||
"vcs": "git",
|
||||
"revision": "f9dcdfb07a66d3cc07176b50e1a6cbee879e1b90",
|
||||
"branch": "master",
|
||||
"path": "/pkg/lru",
|
||||
"notests": true
|
||||
},
|
||||
{
|
||||
"importpath": "github.com/certifi/gocertifi",
|
||||
"repository": "https://github.com/certifi/gocertifi",
|
||||
|
||||
Reference in New Issue
Block a user