Panic Occurred while using goexif package

Detailed panic trace -

	goroutine 5 [running]:
runtime/debug.Stack(0xc42004f208, 0xb71060, 0x1222960)
	/usr/local/go/src/runtime/debug/stack.go:24 +0xa7
Upload-Image-API/services/controllers/uploadimage.UploadImages.func1()
	/home3/indiamart/public_html/go/src/Upload-Image-API/services/controllers/uploadimage/uploadimage.go:28 +0x48
panic(0xb71060, 0x1222960)
	/usr/local/go/src/runtime/panic.go:491 +0x283
github.com/rwcarlsen/goexif/mknote.(*nikonV3).Parse(0x1289980, 0xc4201adb90, 0x0, 0x0)
	/home3/indiamart/public_html/go/src/github.com/rwcarlsen/goexif/mknote/mknote.go:58 +0x2f4
github.com/rwcarlsen/goexif/exif.Decode(0x1232ae0, 0xc42000e1a0, 0x2, 0x0, 0x0)
	/home3/indiamart/public_html/go/src/github.com/rwcarlsen/goexif/exif/exif.go:301 +0x666
Upload-Image-API/services/utils.GetMetaDataOfImage(0xc420076600, 0x77, 0xb26720, 0xc420019310, 0xc420151888)
	/home3/indiamart/public_html/go/src/Upload-Image-API/services/utils/utils.go:204 +0x1ed
Upload-Image-API/services/controllers/uploadimage.UploadImages(0x12397e0, 0xc42015c000, 0xc4200fc500)
	/home3/indiamart/public_html/go/src/Upload-Image-API/services/controllers/uploadimage/uploadimage.go:170 +0x1c33
net/http.HandlerFunc.ServeHTTP(0xc518b8, 0x12397e0, 0xc42015c000, 0xc4200fc500)
	/usr/local/go/src/net/http/server.go:1918 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201c1f80, 0x12397e0, 0xc42015c000, 0xc4200fc500)
	/home3/indiamart/public_html/go/src/github.com/gorilla/mux/mux.go:162 +0xed
github.com/gorilla/handlers.(*cors).ServeHTTP(0xc4201a9830, 0x12397e0, 0xc42015c000, 0xc4200fc300)
	/home3/indiamart/public_html/go/src/github.com/gorilla/handlers/cors.go:52 +0xa77
net/http.serverHandler.ServeHTTP(0xc4201ae4e0, 0x12397e0, 0xc42015c000, 0xc4200fc300)
	/usr/local/go/src/net/http/server.go:2619 +0xb4
net/http.(*conn).serve(0xc420158000, 0x1239e20, 0xc42005aac0)
	/usr/local/go/src/net/http/server.go:1801 +0x71d
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2720 +0x288

My Code-
func GetMetaDataOfImage(filepath string) (map[string]interface{}, error) {
var metaInformationOfImage = make(map[string]interface{})
metaInformationOfImage[“Timestamp”] = “”
metaInformationOfImage[“Latitude”] = “”
metaInformationOfImage[“Longitude”] = “”
f, err := os.Open(filepath)
if err != nil {
return metaInformationOfImage, err
}
exif.RegisterParsers(mknote.All…)
x, err := exif.Decode(f)
if err != nil {
return metaInformationOfImage, err
}
timestamp, err := x.DateTime()
if err != nil {
return metaInformationOfImage, err
}
metaInformationOfImage[“Timestamp”] = timestamp.Format(“02-01-06”)
lat, long, err := x.LatLong()
if err != nil {
return metaInformationOfImage, err
}
metaInformationOfImage[“Latitude”] = fmt.Sprintf("%g", lat)
metaInformationOfImage[“Longitude”] = fmt.Sprintf("%g", long)
return metaInformationOfImage, err
}

Hey Nimish,

Can you post the line numbers in your code?
And you haven’t displayed the actual error message of the panic. Only the stack trace. Can you show that as well?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.