Skip to content

Commit

Permalink
support any amount of digits
Browse files Browse the repository at this point in the history
  • Loading branch information
RangelReale committed Oct 22, 2023
1 parent 6fd1acd commit 588919f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fileproviderimpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,16 @@ type stringFileProvider struct {
}

func (s stringFileProvider) Load(callback FileProviderCallback) error {
digitSize := fmt.Sprintf("%d", len(s.files))
fileFmt := fmt.Sprintf("%%0%dd-file.dbf.yaml", len(digitSize)+1)

for idx, data := range s.files {
var tags []string
if idx < len(s.tags) {
tags = s.tags[idx]
}
err := callback(FileInfo{
Name: fmt.Sprintf("%04d-file.dbf.yaml", idx),
Name: fmt.Sprintf(fileFmt, idx),
File: strings.NewReader(data),
Tags: tags,
})
Expand Down

0 comments on commit 588919f

Please sign in to comment.