Created
September 29, 2017 02:09
-
-
Save buchanae/b64877eb09877c3e340731850ff4ee20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type FileTaskReader struct { | |
Path string | |
task *tes.Task | |
} | |
func (f *FileTaskReader) Task() (*tes.Task, error) { | |
if f.task != nil { | |
return f.task, nil | |
} | |
fh, err := os.Open(f.Path) | |
if err != nil { | |
return nil, err | |
} | |
f.task = &tes.Task{} | |
err = jsonpb.Unmarshal(fh, f.task) | |
return f.task, err | |
} | |
func (f *FileTaskReader) State() (tes.State, error) { | |
return tes.State_UNKNOWN, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment