Skip to content

Commit

Permalink
Remove unused variables in ReadFile (#866)
Browse files Browse the repository at this point in the history
  • Loading branch information
johejo authored Feb 16, 2023
1 parent a11fc40 commit c4e548a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 33 deletions.
9 changes: 0 additions & 9 deletions jwe/io.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions jwk/io.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions jws/io.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions jwt/io.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions tools/cmd/genreadfile/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,14 @@ func generateFile(def definition) error {
o.L(`}`)

o.LL("func ReadFile(path string, options ...ReadFileOption) (%s, error) {", def.ReturnType)
o.L("var parseOptions []ParseOption")
o.L(`var readFileOptions []ReadFileOption`)
o.L(`for _, option := range options {`)
o.L(`if po, ok := option.(ParseOption); ok {`)
o.L(`parseOptions = append(parseOptions, po)`)
o.L(`} else {`)
o.L(`readFileOptions = append(readFileOptions, option)`)
o.L(`}`)
o.L(`}`)
if def.ParseOptions {
o.L("var parseOptions []ParseOption")
o.L(`for _, option := range options {`)
o.L(`if po, ok := option.(ParseOption); ok {`)
o.L(`parseOptions = append(parseOptions, po)`)
o.L(`}`)
o.L(`}`)
}
o.LL(`var srcFS fs.FS = sysFS{}`)
o.L("for _, option := range options {")
o.L(`switch option.Ident() {`)
Expand Down

0 comments on commit c4e548a

Please sign in to comment.