Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit dac5cbc

Browse files
committed
more staticcheck fixes
1 parent 0a92fd0 commit dac5cbc

File tree

2 files changed

+2
-32
lines changed

2 files changed

+2
-32
lines changed

backend/handlers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ func makeGatewayCARHandler(bsrv blockservice.BlockService, port int) (*http.Serv
130130
const immutableCacheControl = "public, max-age=29030400, immutable"
131131
// immutable! CACHE ALL THE THINGS, FOREVER! wolololol
132132
w.Header().Set("Cache-Control", immutableCacheControl)
133+
w.Header().Set("Server", userAgent)
133134

134135
// Set modtime to 'zero time' to disable Last-Modified header (superseded by Cache-Control)
135136

136137
io.Copy(w, carStream)
137-
return
138138
})
139139

140140
// Creates metrics handler for total response size. Matches the same metrics
@@ -591,11 +591,11 @@ func makeGatewayBlockHandler(bsrv blockservice.BlockService, port int) (*http.Se
591591
const immutableCacheControl = "public, max-age=29030400, immutable"
592592
// immutable! CACHE ALL THE THINGS, FOREVER! wolololol
593593
w.Header().Set("Cache-Control", immutableCacheControl)
594+
w.Header().Set("Server", userAgent)
594595

595596
// Set modtime to 'zero time' to disable Last-Modified header (superseded by Cache-Control)
596597

597598
http.ServeContent(w, r, c.String()+".bin", noModtime, bytes.NewReader(blk.RawData()))
598-
return
599599
})
600600

601601
// Creates metrics handler for total response size. Matches the same metrics

backend/main.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import (
1919
"net/http"
2020
"os"
2121
"os/signal"
22-
"strconv"
23-
"strings"
2422
"sync"
2523
)
2624

@@ -146,31 +144,3 @@ var rootCmd = &cobra.Command{
146144
return nil
147145
},
148146
}
149-
150-
func getEnv(key, defaultValue string) string {
151-
value := os.Getenv(key)
152-
if value == "" {
153-
return defaultValue
154-
}
155-
return value
156-
}
157-
158-
func getEnvs(key, defaultValue string) []string {
159-
value := os.Getenv(key)
160-
if value == "" {
161-
if defaultValue == "" {
162-
return []string{}
163-
}
164-
value = defaultValue
165-
}
166-
value = strings.TrimSpace(value)
167-
return strings.Split(value, ",")
168-
}
169-
170-
func getEnvInt(key string, defaultValue int) (int, error) {
171-
value := os.Getenv(key)
172-
if value == "" {
173-
return defaultValue, nil
174-
}
175-
return strconv.Atoi(value)
176-
}

0 commit comments

Comments
 (0)