diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2020-08-20 17:21:12 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2020-08-20 18:45:07 +0300 |
commit | ec8f8b27bca9471f67a64fec23eb1eb3b08ccde0 (patch) | |
tree | 3e843175e1ceab4c3813dacb63482f2e0f113eb9 /internal/serving | |
parent | f56500fa8d30838e25383910cf0b120ce2be65da (diff) |
Rename `serving/disk/New()` to `serving/disk/Instance()`rename-disk-new-to-instance
The `Instance()` is a correct name for this,
as we do not allocate a `Disk` each time,
rather return a singleton object.
Diffstat (limited to 'internal/serving')
-rw-r--r-- | internal/serving/disk/serving.go | 4 | ||||
-rw-r--r-- | internal/serving/disk/serving_test.go | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/internal/serving/disk/serving.go b/internal/serving/disk/serving.go index b7501b80..a38124ef 100644 --- a/internal/serving/disk/serving.go +++ b/internal/serving/disk/serving.go @@ -36,8 +36,8 @@ func (s *Disk) ServeNotFoundHTTP(h serving.Handler) { httperrors.Serve404(h.Writer) } -// New returns a serving instance that is capable of reading files +// Instance returns a serving instance that is capable of reading files // from the disk -func New() serving.Serving { +func Instance() serving.Serving { return disk } diff --git a/internal/serving/disk/serving_test.go b/internal/serving/disk/serving_test.go index 02b7fac7..60fb4180 100644 --- a/internal/serving/disk/serving_test.go +++ b/internal/serving/disk/serving_test.go @@ -15,7 +15,7 @@ import ( func TestDisk_ServeFileHTTP(t *testing.T) { defer setUpTests(t)() - s := New() + s := Instance() w := httptest.NewRecorder() r := httptest.NewRequest("GET", "http://group.gitlab-example.com/serving/index.html", nil) handler := serving.Handler{ |