comparison pkg/wfs/download.go @ 4166:04876d865528

Made 'golint' and 'staticcheck' happy with wfs package.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 05 Aug 2019 14:35:54 +0200
parents 2b6f73c30016
children ed0de319d09a
comparison
equal deleted inserted replaced
4165:8dd59e2c9d3d 4166:04876d865528
29 "golang.org/x/net/html/charset" 29 "golang.org/x/net/html/charset"
30 ) 30 )
31 31
32 var ( 32 var (
33 // ErrNoSuchFeatureType is returned when a feature is not supported. 33 // ErrNoSuchFeatureType is returned when a feature is not supported.
34 ErrNoSuchFeatureType = errors.New("No such feature type") 34 ErrNoSuchFeatureType = errors.New("no such feature type")
35 // ErrGetFeatureNotSupported is returned when GetFeature is not supported. 35 // ErrGetFeatureNotSupported is returned when GetFeature is not supported.
36 ErrGetFeatureNotSupported = errors.New("GetFeature not supported") 36 ErrGetFeatureNotSupported = errors.New("method GetFeature not supported")
37 // ErrMethodGetNotSupported is returned when the GET is not supported. 37 // ErrMethodGetNotSupported is returned when the GET is not supported.
38 ErrMethodGetNotSupported = errors.New("GET not supported") 38 ErrMethodGetNotSupported = errors.New("method GET not supported")
39 // ErrNoNumberMatchedFound is returned if feature count cannot be extracted. 39 // ErrNoNumberMatchedFound is returned if feature count cannot be extracted.
40 ErrNoNumberMatchedFound = errors.New("No numberMatched attribute found") 40 ErrNoNumberMatchedFound = errors.New("no numberMatched attribute found")
41 // ErrOutputFormatNotSupported is returned if a output format is 41 // ErrOutputFormatNotSupported is returned if a output format is
42 // not supported. 42 // not supported.
43 ErrOutputFormatNotSupported = errors.New("Output format not supported") 43 ErrOutputFormatNotSupported = errors.New("output format not supported")
44 ) 44 )
45 45
46 // GetCapabilities downloads a capabilities document for a given URL. 46 // GetCapabilities downloads a capabilities document for a given URL.
47 func GetCapabilities(capURL string) (*Capabilities, error) { 47 func GetCapabilities(capURL string) (*Capabilities, error) {
48 48
266 266
267 if err != nil { 267 if err != nil {
268 return err 268 return err
269 } 269 }
270 if resp.StatusCode < 200 || resp.StatusCode > 299 { 270 if resp.StatusCode < 200 || resp.StatusCode > 299 {
271 return fmt.Errorf("Invalid HTTP status code: %d (%s)", 271 return fmt.Errorf("invalid HTTP status code: %d (%s)",
272 resp.StatusCode, resp.Status) 272 resp.StatusCode, resp.Status)
273 } 273 }
274 defer resp.Body.Close() 274 defer resp.Body.Close()
275 275
276 var already bytes.Buffer 276 var already bytes.Buffer
285 285
286 multi := io.MultiReader(bytes.NewReader(already.Bytes()), resp.Body) 286 multi := io.MultiReader(bytes.NewReader(already.Bytes()), resp.Body)
287 return handler(url, multi) 287 return handler(url, multi)
288 } 288 }
289 289
290 // ExceptionReport is an error with the extract code and
291 // text from an OWS exception document.
290 type ExceptionReport struct { 292 type ExceptionReport struct {
291 Code string 293 Code string
292 Text string 294 Text string
293 } 295 }
294 296