Fix call-sites after dep updates

This commit is contained in:
Tim Hockin 2016-05-27 16:04:48 -07:00
parent 372e904e51
commit 3c6ce53b7f
3 changed files with 14 additions and 11 deletions

View File

@ -152,7 +152,16 @@ for PACKAGE in $(cat Godeps/Godeps.json | \
file="${CONTENT[${PACKAGE}-COPYRIGHT]-}"
fi
if [[ -z "${file}" ]]; then
echo "Could not find a license for ${PACKAGE} - aborting" > /dev/stderr
cat > /dev/stderr << __EOF__
No license could be found for ${PACKAGE} - aborting.
Options:
1. Check if the upstream repository has a newer version with LICENSE and/or
COPYRIGHT files.
2. Contact the author of the package to ensure there is a LICENSE and/or
COPYRIGHT file present.
3. Do not use this package in Kubernetes.
__EOF__
exit 9
fi
cat "${file}"

View File

@ -108,10 +108,7 @@ func NewMetrics() Metrics {
}
func parseMetrics(data string, knownMetrics map[string][]string, output *Metrics, unknownMetrics sets.String) error {
dec, err := expfmt.NewDecoder(strings.NewReader(data), expfmt.FmtText)
if err != nil {
return err
}
dec := expfmt.NewDecoder(strings.NewReader(data), expfmt.FmtText)
decoder := expfmt.SampleDecoder{
Dec: dec,
Opts: &expfmt.DecodeOptions{},
@ -119,7 +116,7 @@ func parseMetrics(data string, knownMetrics map[string][]string, output *Metrics
for {
var v model.Vector
if err = decoder.Decode(&v); err != nil {
if err := decoder.Decode(&v); err != nil {
if err == io.EOF {
// Expected loop termination condition.
return nil

View File

@ -417,10 +417,7 @@ func PrettyPrintJSON(metrics interface{}) string {
// extractMetricSamples parses the prometheus metric samples from the input string.
func extractMetricSamples(metricsBlob string) ([]*model.Sample, error) {
dec, err := expfmt.NewDecoder(strings.NewReader(metricsBlob), expfmt.FmtText)
if err != nil {
return nil, err
}
dec := expfmt.NewDecoder(strings.NewReader(metricsBlob), expfmt.FmtText)
decoder := expfmt.SampleDecoder{
Dec: dec,
Opts: &expfmt.DecodeOptions{},
@ -429,7 +426,7 @@ func extractMetricSamples(metricsBlob string) ([]*model.Sample, error) {
var samples []*model.Sample
for {
var v model.Vector
if err = decoder.Decode(&v); err != nil {
if err := decoder.Decode(&v); err != nil {
if err == io.EOF {
// Expected loop termination condition.
return samples, nil