30 lines
600 B
Go
30 lines
600 B
Go
|
// Automatically generated by internal/cmd/genreadfile/main.go. DO NOT EDIT
|
||
|
|
||
|
package jwk
|
||
|
|
||
|
import "os"
|
||
|
|
||
|
// ReadFileOption describes options that can be passed to ReadFile.
|
||
|
type ReadFileOption interface {
|
||
|
Option
|
||
|
readFileOption()
|
||
|
}
|
||
|
|
||
|
func ReadFile(path string, options ...ReadFileOption) (Set, error) {
|
||
|
var parseOptions []ParseOption
|
||
|
for _, option := range options {
|
||
|
switch option := option.(type) {
|
||
|
case ParseOption:
|
||
|
parseOptions = append(parseOptions, option)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
f, err := os.Open(path)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
defer f.Close()
|
||
|
return ParseReader(f, parseOptions...)
|
||
|
}
|