Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--cache/filecache/filecache_test.go2
-rw-r--r--resources/resource_factories/create/create.go9
-rw-r--r--tpl/data/resources_test.go3
4 files changed, 12 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index d3ef01991..1b78398cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
/hugo
docs/public*
/.idea
+.vscode/*
hugo.exe
*.test
*.prof
diff --git a/cache/filecache/filecache_test.go b/cache/filecache/filecache_test.go
index 6a051a264..6ac36a5c1 100644
--- a/cache/filecache/filecache_test.go
+++ b/cache/filecache/filecache_test.go
@@ -276,7 +276,7 @@ func TestFileCacheReadOrCreateErrorInRead(t *testing.T) {
}
}
- cache := NewCache(afero.NewMemMapFs(), 100*time.Hour, "")
+ cache := NewCache(afero.NewMemMapFs(), 100*time.Hour, 0, "")
const id = "a32"
diff --git a/resources/resource_factories/create/create.go b/resources/resource_factories/create/create.go
index 8edf501f7..9b8d73ad4 100644
--- a/resources/resource_factories/create/create.go
+++ b/resources/resource_factories/create/create.go
@@ -18,6 +18,7 @@ package create
import (
"bufio"
"bytes"
+ "context"
"fmt"
"io"
"io/ioutil"
@@ -180,6 +181,14 @@ func (c *Client) FromRemote(uri string, options map[string]interface{}) (resourc
}
addUserProvidedHeaders(headers, req)
}
+
+ // Workaround for https://github.com/golang/go/issues/49366
+ // This is the entire lifetime of the request.
+ ctx, cancel := context.WithTimeout(req.Context(), 30*time.Second)
+ defer cancel()
+
+ req = req.WithContext(ctx)
+
res, err := c.httpClient.Do(req)
if err != nil {
return nil, err
diff --git a/tpl/data/resources_test.go b/tpl/data/resources_test.go
index 1bf6d769f..a1ce9ecb6 100644
--- a/tpl/data/resources_test.go
+++ b/tpl/data/resources_test.go
@@ -34,7 +34,6 @@ import (
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/langs"
"github.com/spf13/afero"
-
)
func TestScpGetLocal(t *testing.T) {
@@ -87,7 +86,7 @@ func TestScpGetRemote(t *testing.T) {
t.Parallel()
c := qt.New(t)
fs := new(afero.MemMapFs)
- cache := filecache.NewCache(fs, 100, "")
+ cache := filecache.NewCache(fs, 100, 0, "")
tests := []struct {
path string