lint: bunch of minor warnings

This commit is contained in:
Umputun
2018-05-22 20:56:52 -05:00
parent bb4a54ff71
commit d7d90eeb4e
8 changed files with 27 additions and 8 deletions
+4 -1
View File
@@ -39,11 +39,14 @@ func (s *Import) Run(port int) {
log.Printf("[WARN] http server terminated, %s", err)
}
// Shutdown import http server
func (s *Import) Shutdown() {
log.Print("[WARN] shutdown import server")
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
s.httpServer.Shutdown(ctx)
if err := s.httpServer.Shutdown(ctx); err != nil {
log.Printf("[DEBUG] importer shutdown error, %s", err)
}
log.Print("[DEBUG] shutdown import server completed")
}
+1
View File
@@ -30,6 +30,7 @@ func TestImport(t *testing.T) {
req, err := http.NewRequest("POST", ts.URL+"/api/v1/admin/import?site=radio-t&provider=native&secret=123456", r)
assert.Nil(t, err)
resp, err := client.Do(req)
assert.Nil(t, err)
assert.Equal(t, http.StatusCreated, resp.StatusCode)
b, err := ioutil.ReadAll(resp.Body)
+4 -1
View File
@@ -75,11 +75,14 @@ func (s *Rest) Run(port int) {
log.Printf("[WARN] http server terminated, %s", err)
}
// Shutdown rest http server
func (s *Rest) Shutdown() {
log.Print("[WARN] shutdown rest server")
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
s.httpServer.Shutdown(ctx)
if err := s.httpServer.Shutdown(ctx); err != nil {
log.Printf("[DEBUG] rest shutdown error, %s", err)
}
log.Print("[DEBUG] shutdown rest server completed")
}