@@ -24,10 +24,10 @@ import (
2424 "crypto/md5"
2525 "encoding/hex"
2626 "encoding/json"
27+ "fmt"
2728 "log"
2829
2930 "github.com/facebook/openbmc/tools/flashy/lib/utils"
30- "github.com/pkg/errors"
3131)
3232
3333func init () {
@@ -143,13 +143,13 @@ func (p *FBMetaImagePartition) getMetaInfo() (FBMetaInfo, error) {
143143 var metaInfo FBMetaInfo
144144 offsetEnd := uint32 (fbmetaImageMetaPartitionSize + fbmetaImageMetaPartitionOffset )
145145 if offsetEnd > p .GetSize () {
146- return metaInfo , errors .Errorf ("Image/device size too small (%v B) to contain meta partition region" ,
146+ return metaInfo , fmt .Errorf ("Image/device size too small (%v B) to contain meta partition region" ,
147147 p .GetSize ())
148148 }
149149
150150 metaPartitionData , err := utils .BytesSliceRange (p .Data , fbmetaImageMetaPartitionOffset , offsetEnd )
151151 if err != nil {
152- return metaInfo , errors .Errorf ("Unable to get meta partition data: %v" , err )
152+ return metaInfo , fmt .Errorf ("Unable to get meta partition data: %v" , err )
153153 }
154154
155155 return parseAndValidateFBImageMetaJSON (metaPartitionData )
@@ -167,7 +167,7 @@ var parseAndValidateFBImageMetaJSON = func(data []byte) (FBMetaInfo, error) {
167167 splitData := bytes .Split (data , []byte {'\n' })
168168 // must have at least 3 elements
169169 if len (splitData ) < 3 {
170- return metaInfo , errors .Errorf ("Meta partition incomplete: cannot find two lines of " +
170+ return metaInfo , fmt .Errorf ("Meta partition incomplete: cannot find two lines of " +
171171 "JSON" )
172172 }
173173
@@ -177,7 +177,7 @@ var parseAndValidateFBImageMetaJSON = func(data []byte) (FBMetaInfo, error) {
177177 // get the checksums first
178178 err := json .Unmarshal (imageMetaChecksumJSONData , & metaChecksum )
179179 if err != nil {
180- return metaInfo , errors .Errorf ("Unable to unmarshal image-meta checksum JSON: %v" ,
180+ return metaInfo , fmt .Errorf ("Unable to unmarshal image-meta checksum JSON: %v" ,
181181 err )
182182 }
183183 checksum := metaChecksum .Checksum
@@ -187,14 +187,14 @@ var parseAndValidateFBImageMetaJSON = func(data []byte) (FBMetaInfo, error) {
187187 calcChecksum := hex .EncodeToString (hash [:])
188188
189189 if calcChecksum != checksum {
190- return metaInfo , errors .Errorf ("'image-meta' checksum (%v) does not match checksums supplied (%v)" ,
190+ return metaInfo , fmt .Errorf ("'image-meta' checksum (%v) does not match checksums supplied (%v)" ,
191191 calcChecksum , checksum )
192192 }
193193
194194 // get metaInfo
195195 err = json .Unmarshal (imageMetaJSONData , & metaInfo )
196196 if err != nil {
197- return metaInfo , errors .Errorf ("Unable to unmarshal image-meta JSON: %v" ,
197+ return metaInfo , fmt .Errorf ("Unable to unmarshal image-meta JSON: %v" ,
198198 err )
199199 }
200200
@@ -253,6 +253,6 @@ var getPartitionConfigTypeFromFBMetaPartInfoType = func(t FBMetaPartInfoType, vb
253253 FBMETA_DATA :
254254 return IGNORE , nil
255255 default :
256- return IGNORE , errors .Errorf ("Unknown partition type in image-meta: '%v'" , t )
256+ return IGNORE , fmt .Errorf ("Unknown partition type in image-meta: '%v'" , t )
257257 }
258258}
0 commit comments