func (lc *LaunchConfig) load(s3c *s3.Client, bucket, prefix, key string) error { resp, err := s3c.Get(bucket, prefix+"/"+key) if err != nil { return err } defer resp.Body.Close() buf := &bytes.Buffer{} _, err = buf.ReadFrom(resp.Body) if err != nil { return err } switch resp.StatusCode { case 200: // ignore case 404: return ErrorLaunchConfigNotFound default: return fmt.Errorf("failed to request container config with key %q from s3: [%d] %s", key, resp.StatusCode, buf.String()) } rawHash := md5.Sum(buf.Bytes()) lc.hash = hex.EncodeToString(rawHash[:]) return json.Unmarshal(buf.Bytes(), lc) }