30 lines
602 B
Go
30 lines
602 B
Go
|
// Automatically generated by internal/cmd/genreadfile/main.go. DO NOT EDIT
|
||
|
|
||
|
package jwt
|
||
|
|
||
|
import "os"
|
||
|
|
||
|
// ReadFileOption describes options that can be passed to ReadFile.
|
||
|
type ReadFileOption interface {
|
||
|
Option
|
||
|
readFileOption()
|
||
|
}
|
||
|
|
||
|
func ReadFile(path string, options ...ReadFileOption) (Token, 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...)
|
||
|
}
|