Skip to content

Commit

Permalink
refactor: add interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudingcity committed Nov 10, 2020
1 parent a207fec commit 1e2009b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Generator struct {
chars bytes.Buffer
}

func New(opts ...Option) *Generator {
func New(opts ...Option) Gopass {
g := &Generator{}
g.With(opts...)
return g
Expand Down
10 changes: 8 additions & 2 deletions gopass.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package gopass

var g *Generator

func init() {
g = New()
}

type Gopass interface {
Generate(length int) []byte
GenerateString(length int) string
With(opts ...Option)
}

var g Gopass

func Generate(length int) []byte {
return g.Generate(length)
}
Expand Down

0 comments on commit 1e2009b

Please sign in to comment.