comparison pkg/geoserver/boot.go @ 4163:51cfa54fc5b1

Made 'golint' and 'staticcheck' happy with geoserver package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 02 Aug 2019 18:01:32 +0200
parents 885eb90255ff
children 6b415dcdaf8a
comparison
equal deleted inserted replaced
4162:8c5df0f3562e 4163:51cfa54fc5b1
113 if resp, err = http.DefaultClient.Do(req); err != nil { 113 if resp, err = http.DefaultClient.Do(req); err != nil {
114 return err 114 return err
115 } 115 }
116 116
117 if resp.StatusCode != http.StatusCreated { 117 if resp.StatusCode != http.StatusCreated {
118 err = fmt.Errorf("Status code '%s' (%d)", 118 err = fmt.Errorf("status code '%s' (%d)",
119 http.StatusText(resp.StatusCode), 119 http.StatusText(resp.StatusCode),
120 resp.StatusCode) 120 resp.StatusCode)
121 } 121 }
122 122
123 return err 123 return err
195 if err != nil { 195 if err != nil {
196 return err 196 return err
197 } 197 }
198 198
199 if resp.StatusCode != http.StatusCreated { 199 if resp.StatusCode != http.StatusCreated {
200 err = fmt.Errorf("Status code '%s' (%d)", 200 err = fmt.Errorf("status code '%s' (%d)",
201 http.StatusText(resp.StatusCode), 201 http.StatusText(resp.StatusCode),
202 resp.StatusCode) 202 resp.StatusCode)
203 } 203 }
204 204
205 return err 205 return err
309 if err != nil { 309 if err != nil {
310 return err 310 return err
311 } 311 }
312 312
313 if resp.StatusCode != http.StatusCreated { 313 if resp.StatusCode != http.StatusCreated {
314 return fmt.Errorf("Status code '%s' (%d)", 314 return fmt.Errorf("status code '%s' (%d)",
315 http.StatusText(resp.StatusCode), 315 http.StatusText(resp.StatusCode),
316 resp.StatusCode) 316 resp.StatusCode)
317 } 317 }
318 } 318 }
319 319
395 var ( 395 var (
396 stylePreprocessorsMu sync.Mutex 396 stylePreprocessorsMu sync.Mutex
397 stylePreprocessors = map[string]func(string) (string, error){} 397 stylePreprocessors = map[string]func(string) (string, error){}
398 ) 398 )
399 399
400 // RegisterStylePreprocessor stores a textual pre-processor
401 // for a given style to be applied when the value of the
402 // style changes.
400 func RegisterStylePreprocessor(name string, processor func(string) (string, error)) { 403 func RegisterStylePreprocessor(name string, processor func(string) (string, error)) {
401 stylePreprocessorsMu.Lock() 404 stylePreprocessorsMu.Lock()
402 defer stylePreprocessorsMu.Unlock() 405 defer stylePreprocessorsMu.Unlock()
403 stylePreprocessors[name] = processor 406 stylePreprocessors[name] = processor
404 } 407 }
405 408
409 // FindStylePreprocessor searches for a registed textual pre-processor
410 // associated with a given style name.
406 func FindStylePreprocessor(name string) func(string) (string, error) { 411 func FindStylePreprocessor(name string) func(string) (string, error) {
407 stylePreprocessorsMu.Lock() 412 stylePreprocessorsMu.Lock()
408 defer stylePreprocessorsMu.Unlock() 413 defer stylePreprocessorsMu.Unlock()
409 return stylePreprocessors[name] 414 return stylePreprocessors[name]
410 } 415 }
466 if err != nil { 471 if err != nil {
467 return err 472 return err
468 } 473 }
469 474
470 if resp.StatusCode != http.StatusCreated { 475 if resp.StatusCode != http.StatusCreated {
471 return fmt.Errorf("Unable to create style %s (%s)", 476 return fmt.Errorf("unable to create style %s (%s)",
472 entry.Name, 477 entry.Name,
473 http.StatusText(resp.StatusCode)) 478 http.StatusText(resp.StatusCode))
474 } 479 }
475 } 480 }
476 481