Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are slices supported? #65

Open
pablote opened this issue Aug 22, 2020 · 1 comment
Open

Are slices supported? #65

pablote opened this issue Aug 22, 2020 · 1 comment

Comments

@pablote
Copy link

pablote commented Aug 22, 2020

This is what I'm trying to do, works fine for simple types, but fails with slices:

package providers

import (
	"github.com/cheekybits/genny/generic"
)

//go:generate genny -in=$GOFILE -out=gen_$GOFILE gen "T=[]string"

type T generic.Type

type TProvider interface {
	Get() (T, error)
}

thanks

@pablote pablote changed the title Are slices supported Are slices supported? Aug 22, 2020
@damoon
Copy link

damoon commented Oct 29, 2020

I believe the "[]" can not be used as part of the function name.

type []StringProvider interface {
	Get() ([]string, error)
}

It works to define a type alias.

type StringSlice []string

type StringSliceProvider interface {
	Get() (StringSlice, error)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants