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

Remove unused variables in ReadFile #866

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions jwe/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ func (sysFS) Open(path string) (fs.File, error) {
}

func ReadFile(path string, options ...ReadFileOption) (*Message, error) {
var parseOptions []ParseOption
var readFileOptions []ReadFileOption
for _, option := range options {
if po, ok := option.(ParseOption); ok {
parseOptions = append(parseOptions, po)
} else {
readFileOptions = append(readFileOptions, option)
}
}

var srcFS fs.FS = sysFS{}
for _, option := range options {
Expand Down
3 changes: 0 additions & 3 deletions jwk/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ func (sysFS) Open(path string) (fs.File, error) {

func ReadFile(path string, options ...ReadFileOption) (Set, error) {
var parseOptions []ParseOption
var readFileOptions []ReadFileOption
for _, option := range options {
if po, ok := option.(ParseOption); ok {
parseOptions = append(parseOptions, po)
} else {
readFileOptions = append(readFileOptions, option)
}
}

Expand Down
9 changes: 0 additions & 9 deletions jws/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ func (sysFS) Open(path string) (fs.File, error) {
}

func ReadFile(path string, options ...ReadFileOption) (*Message, error) {
var parseOptions []ParseOption
var readFileOptions []ReadFileOption
for _, option := range options {
if po, ok := option.(ParseOption); ok {
parseOptions = append(parseOptions, po)
} else {
readFileOptions = append(readFileOptions, option)
}
}

var srcFS fs.FS = sysFS{}
for _, option := range options {
Expand Down
3 changes: 0 additions & 3 deletions jwt/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ func (sysFS) Open(path string) (fs.File, error) {

func ReadFile(path string, options ...ReadFileOption) (Token, error) {
var parseOptions []ParseOption
var readFileOptions []ReadFileOption
for _, option := range options {
if po, ok := option.(ParseOption); ok {
parseOptions = append(parseOptions, po)
} else {
readFileOptions = append(readFileOptions, option)
}
}

Expand Down
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