예제 #1
0
func TestInit(t *testing.T) {
	var err error
	o, err := option.New(os.Args[1:])
	if err != nil {
		t.Fatalf("fail to create options: error=%v", err)
	}
	s, err = storage.New(o)
	if err != nil {
		t.Fatalf("Can't create instance: %v", err)
	}
}
예제 #2
0
func NewHandler(o option.Options) (Handler, error) {
	s, err := storage.New(o)
	if err != nil {
		return Handler{}, err
	}
	u, err := uploader.New(o)
	if err != nil {
		return Handler{}, err
	}
	h := o.Hosts
	return Handler{s, u, h}, nil
}