Selaa lähdekoodia

Fix linter warnings

DarthSim 10 kuukautta sitten
vanhempi
commit
d931285ac2
3 muutettua tiedostoa jossa 17 lisäystä ja 17 poistoa
  1. 15 15
      processing_handler_test.go
  2. 1 1
      router/timer.go
  3. 1 1
      transport/azure/azure_test.go

+ 15 - 15
processing_handler_test.go

@@ -412,7 +412,7 @@ func (s *ProcessingHandlerTestSuite) TestETagReqNoIfNotModified() {
 	poStr, imgdata, etag := s.sampleETagData("loremipsumdolor")
 
 	ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
-		s.Require().Empty(r.Header.Get("If-None-Match"))
+		s.Empty(r.Header.Get("If-None-Match"))
 
 		rw.Header().Set("ETag", imgdata.Headers["ETag"])
 		rw.WriteHeader(200)
@@ -433,7 +433,7 @@ func (s *ProcessingHandlerTestSuite) TestETagDataNoIfNotModified() {
 	poStr, imgdata, etag := s.sampleETagData("")
 
 	ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
-		s.Require().Empty(r.Header.Get("If-None-Match"))
+		s.Empty(r.Header.Get("If-None-Match"))
 
 		rw.WriteHeader(200)
 		rw.Write(imgdata.Data)
@@ -453,7 +453,7 @@ func (s *ProcessingHandlerTestSuite) TestETagReqMatch() {
 	poStr, imgdata, etag := s.sampleETagData(`"loremipsumdolor"`)
 
 	ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
-		s.Require().Equal(imgdata.Headers["ETag"], r.Header.Get("If-None-Match"))
+		s.Equal(imgdata.Headers["ETag"], r.Header.Get("If-None-Match"))
 
 		rw.WriteHeader(304)
 	}))
@@ -475,7 +475,7 @@ func (s *ProcessingHandlerTestSuite) TestETagDataMatch() {
 	poStr, imgdata, etag := s.sampleETagData("")
 
 	ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
-		s.Require().Empty(r.Header.Get("If-None-Match"))
+		s.Empty(r.Header.Get("If-None-Match"))
 
 		rw.WriteHeader(200)
 		rw.Write(imgdata.Data)
@@ -499,7 +499,7 @@ func (s *ProcessingHandlerTestSuite) TestETagReqNotMatch() {
 	_, _, expectedETag := s.sampleETagData(`"loremipsum"`)
 
 	ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
-		s.Require().Equal(`"loremipsum"`, r.Header.Get("If-None-Match"))
+		s.Equal(`"loremipsum"`, r.Header.Get("If-None-Match"))
 
 		rw.Header().Set("ETag", imgdata.Headers["ETag"])
 		rw.WriteHeader(200)
@@ -525,7 +525,7 @@ func (s *ProcessingHandlerTestSuite) TestETagDataNotMatch() {
 	expectedETag := actualETag[:strings.IndexByte(actualETag, '/')] + "/Dasdbefj"
 
 	ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
-		s.Require().Empty(r.Header.Get("If-None-Match"))
+		s.Empty(r.Header.Get("If-None-Match"))
 
 		rw.WriteHeader(200)
 		rw.Write(imgdata.Data)
@@ -550,7 +550,7 @@ func (s *ProcessingHandlerTestSuite) TestETagProcessingOptionsNotMatch() {
 	expectedETag := "abcdefj" + actualETag[strings.IndexByte(actualETag, '/'):]
 
 	ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
-		s.Require().Empty(r.Header.Get("If-None-Match"))
+		s.Empty(r.Header.Get("If-None-Match"))
 
 		rw.Header().Set("ETag", imgdata.Headers["ETag"])
 		rw.WriteHeader(200)
@@ -604,7 +604,7 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqExactMatchLastModifiedD
 	lastModified := "Wed, 21 Oct 2015 07:28:00 GMT"
 	ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
 		modifiedSince := r.Header.Get("If-Modified-Since")
-		s.Require().Empty(modifiedSince)
+		s.Empty(modifiedSince)
 		rw.WriteHeader(200)
 		rw.Write(data)
 	}))
@@ -623,7 +623,7 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqExactMatchLastModifiedE
 	lastModified := "Wed, 21 Oct 2015 07:28:00 GMT"
 	ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
 		modifiedSince := r.Header.Get("If-Modified-Since")
-		s.Require().Equal(lastModified, modifiedSince)
+		s.Equal(lastModified, modifiedSince)
 		rw.WriteHeader(304)
 	}))
 	defer ts.Close()
@@ -641,7 +641,7 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqCompareMoreRecentLastMo
 	config.LastModifiedEnabled = false
 	ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
 		modifiedSince := r.Header.Get("If-Modified-Since")
-		s.Require().Empty(modifiedSince)
+		s.Empty(modifiedSince)
 		rw.WriteHeader(200)
 		rw.Write(data)
 	}))
@@ -663,8 +663,8 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqCompareMoreRecentLastMo
 		fileLastModified, _ := time.Parse(http.TimeFormat, "Wed, 21 Oct 2015 07:28:00 GMT")
 		modifiedSince := r.Header.Get("If-Modified-Since")
 		parsedModifiedSince, err := time.Parse(http.TimeFormat, modifiedSince)
-		s.Require().NoError(err)
-		s.Require().True(fileLastModified.Before(parsedModifiedSince))
+		s.NoError(err)
+		s.True(fileLastModified.Before(parsedModifiedSince))
 		rw.WriteHeader(304)
 	}))
 	defer ts.Close()
@@ -684,7 +684,7 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqCompareTooOldLastModifi
 	data := s.readTestFile("test1.png")
 	ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
 		modifiedSince := r.Header.Get("If-Modified-Since")
-		s.Require().Empty(modifiedSince)
+		s.Empty(modifiedSince)
 		rw.WriteHeader(200)
 		rw.Write(data)
 	}))
@@ -707,8 +707,8 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqCompareTooOldLastModifi
 		fileLastModified, _ := time.Parse(http.TimeFormat, "Wed, 21 Oct 2015 07:28:00 GMT")
 		modifiedSince := r.Header.Get("If-Modified-Since")
 		parsedModifiedSince, err := time.Parse(http.TimeFormat, modifiedSince)
-		s.Require().NoError(err)
-		s.Require().True(fileLastModified.After(parsedModifiedSince))
+		s.NoError(err)
+		s.True(fileLastModified.After(parsedModifiedSince))
 		rw.WriteHeader(200)
 		rw.Write(data)
 	}))

+ 1 - 1
router/timer.go

@@ -10,7 +10,7 @@ import (
 	"github.com/imgproxy/imgproxy/v3/ierrors"
 )
 
-type timerSinceCtxKey = struct{}
+type timerSinceCtxKey struct{}
 
 func startRequestTimer(r *http.Request) (*http.Request, context.CancelFunc) {
 	ctx := r.Context()

+ 1 - 1
transport/azure/azure_test.go

@@ -33,7 +33,7 @@ func (s *AzureTestSuite) SetupSuite() {
 	s.lastModified, _ = time.Parse(http.TimeFormat, "Wed, 21 Oct 2015 07:28:00 GMT")
 
 	s.server = httptest.NewTLSServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
-		s.Require().Equal("/test/foo/test.png", r.URL.Path)
+		s.Equal("/test/foo/test.png", r.URL.Path)
 
 		rw.Header().Set("Etag", s.etag)
 		rw.Header().Set("Last-Modified", s.lastModified.Format(http.TimeFormat))