Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Commit

Permalink
fix: loadURL should only try and load if we receive a 200
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Scherger committed Feb 18, 2018
1 parent f675c31 commit 6901735
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions main.go
Expand Up @@ -2,7 +2,6 @@ package main

import (
"bytes"
"errors"
"flag"
"fmt"
"log"
Expand Down Expand Up @@ -76,15 +75,13 @@ func loadURLs(path string) (*config.Project, error) {
return nil, fmt.Errorf("goreleaser.yml file not found")
}

var errNotFound = errors.New("404: not found")

func loadURL(file string) (*config.Project, error) {
resp, err := http.Get(file)
if err != nil {
return nil, err
}
if resp.StatusCode == 404 {
return nil, errNotFound
if resp.StatusCode != 200 {
return nil, fmt.Errorf("%d: %s", resp.StatusCode, http.StatusText(resp.StatusCode))
}
p, err := config.LoadReader(resp.Body)

Expand Down

0 comments on commit 6901735

Please sign in to comment.