package imageproxy

import (
	"bytes"
	"encoding/gob"
)

type Image struct {
	Type string
	Data []byte
}

func (image *Image) Serialize() (serialized []byte, err error) {
	buffer := bytes.NewBuffer([]byte{})
	encoder := gob.NewEncoder(buffer)
	err = encoder.Encode(image)
	if err != nil {
		return
	}
	serialized = buffer.Bytes()
	return
}

func (image *Image) Unserialize(data []byte) error {
	buffer := bytes.NewBuffer(data)
	decoder := gob.NewDecoder(buffer)
	err := decoder.Decode(image)
	return err
}

package imageproxy

import (
	"bytes"
	"encoding/gob"
)

type Image struct {
	Type string
	Data []byte
}

func (image *Image) serialize() (serialized []byte, err error) {
	buffer := bytes.NewBuffer([]byte{})
	encoder := gob.NewEncoder(buffer)
	err = encoder.Encode(image)
	if err != nil {
		return
	}
	serialized = buffer.Bytes()
	return
}

func (image *Image) unserialize(data []byte) error {
	buffer := bytes.NewBuffer(data)
	decoder := gob.NewDecoder(buffer)
	err := decoder.Decode(image)
	return err
}

--- 
+++ 
@@ -10,7 +10,7 @@
 	Data []byte
 }
 
-func (image *Image) serialize() (serialized []byte, err error) {
+func (image *Image) Serialize() (serialized []byte, err error) {
 	buffer := bytes.NewBuffer([]byte{})
 	encoder := gob.NewEncoder(buffer)
 	err = encoder.Encode(image)
@@ -21,7 +21,7 @@
 	return
 }
 
-func (image *Image) unserialize(data []byte) error {
+func (image *Image) Unserialize(data []byte) error {
 	buffer := bytes.NewBuffer(data)
 	decoder := gob.NewDecoder(buffer)
 	err := decoder.Decode(image)
Make public methods in Image
