diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-05-22 14:10:13 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-05-22 14:10:15 -0400 |
commit | d0a8bacab612ae2ecae3525fb7548f1c5e6ed35d (patch) | |
tree | f12982ff0bad14b32f12da0b1417a4111d2676ed /os.go | |
parent | 9ea397861feeefcce9f18947e10aa6cc155ec459 (diff) |
Use proto2 instead of proto3
Travis doesn't support proto3.
Diffstat (limited to 'os.go')
-rw-r--r-- | os.go | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -16,14 +16,14 @@ func InitOS() { switch msg.Payload.(type) { case *Msg_Exit: payload := msg.GetExit() - os.Exit(int(payload.Code)) + os.Exit(int(*payload.Code)) case *Msg_SourceCodeFetch: payload := msg.GetSourceCodeFetch() - return HandleSourceCodeFetch(payload.ModuleSpecifier, payload.ContainingFile) + return HandleSourceCodeFetch(*payload.ModuleSpecifier, *payload.ContainingFile) case *Msg_SourceCodeCache: payload := msg.GetSourceCodeCache() - return HandleSourceCodeCache(payload.Filename, payload.SourceCode, - payload.OutputCode) + return HandleSourceCodeCache(*payload.Filename, *payload.SourceCode, + *payload.OutputCode) default: panic("[os] Unexpected message " + string(buf)) } @@ -39,7 +39,8 @@ func HandleSourceCodeFetch(moduleSpecifier string, containingFile string) (out [ defer func() { if err != nil { - res.Error = err.Error() + var errStr = err.Error() + res.Error = &errStr } out, err = proto.Marshal(res) check(err) @@ -72,12 +73,13 @@ func HandleSourceCodeFetch(moduleSpecifier string, containingFile string) (out [ return } + var sourceCode = string(sourceCodeBuf) res.Payload = &Msg_SourceCodeFetchRes{ SourceCodeFetchRes: &SourceCodeFetchResMsg{ - ModuleName: moduleName, - Filename: filename, - SourceCode: string(sourceCodeBuf), - OutputCode: outputCode, + ModuleName: &moduleName, + Filename: &filename, + SourceCode: &sourceCode, + OutputCode: &outputCode, }, } return @@ -91,7 +93,8 @@ func HandleSourceCodeCache(filename string, sourceCode string, err := ioutil.WriteFile(fn, outputCodeBuf, 0600) res := &Msg{} if err != nil { - res.Error = err.Error() + var errStr = err.Error() + res.Error = &errStr } out, err := proto.Marshal(res) check(err) |