From dac5cbc339cc207a4d07b0c8527c25fac1bfa76f Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Wed, 29 Mar 2023 13:08:43 -0400 Subject: [PATCH] more staticcheck fixes --- backend/handlers.go | 4 ++-- backend/main.go | 30 ------------------------------ 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/backend/handlers.go b/backend/handlers.go index ae1180c..23c5d85 100644 --- a/backend/handlers.go +++ b/backend/handlers.go @@ -130,11 +130,11 @@ func makeGatewayCARHandler(bsrv blockservice.BlockService, port int) (*http.Serv const immutableCacheControl = "public, max-age=29030400, immutable" // immutable! CACHE ALL THE THINGS, FOREVER! wolololol w.Header().Set("Cache-Control", immutableCacheControl) + w.Header().Set("Server", userAgent) // Set modtime to 'zero time' to disable Last-Modified header (superseded by Cache-Control) io.Copy(w, carStream) - return }) // Creates metrics handler for total response size. Matches the same metrics @@ -591,11 +591,11 @@ func makeGatewayBlockHandler(bsrv blockservice.BlockService, port int) (*http.Se const immutableCacheControl = "public, max-age=29030400, immutable" // immutable! CACHE ALL THE THINGS, FOREVER! wolololol w.Header().Set("Cache-Control", immutableCacheControl) + w.Header().Set("Server", userAgent) // Set modtime to 'zero time' to disable Last-Modified header (superseded by Cache-Control) http.ServeContent(w, r, c.String()+".bin", noModtime, bytes.NewReader(blk.RawData())) - return }) // Creates metrics handler for total response size. Matches the same metrics diff --git a/backend/main.go b/backend/main.go index 4ed3662..0cf7eec 100644 --- a/backend/main.go +++ b/backend/main.go @@ -19,8 +19,6 @@ import ( "net/http" "os" "os/signal" - "strconv" - "strings" "sync" ) @@ -146,31 +144,3 @@ var rootCmd = &cobra.Command{ return nil }, } - -func getEnv(key, defaultValue string) string { - value := os.Getenv(key) - if value == "" { - return defaultValue - } - return value -} - -func getEnvs(key, defaultValue string) []string { - value := os.Getenv(key) - if value == "" { - if defaultValue == "" { - return []string{} - } - value = defaultValue - } - value = strings.TrimSpace(value) - return strings.Split(value, ",") -} - -func getEnvInt(key string, defaultValue int) (int, error) { - value := os.Getenv(key) - if value == "" { - return defaultValue, nil - } - return strconv.Atoi(value) -}