[go] how I can run program in another program?

(ext) #1

Can I run the program in the program?
But, as a second program to have an array of bytes?
In other words, how can I run an array of bytes (go lang program) from memory?

(Sibert) #2


(ext) #3

i need something like that
An array of bytes is loaded into memory and executed as a normal program

(Norbert Melzer) #4

I don’t think this is possible. Have you considered writing that program out to disk and running it from there?

(ext) #5

yes, how I can do this?

(Norbert Melzer) #6

Use os.File and its methods to write the file to disk, then use os.exit.Cmd and its methods to run the program.

(Sibert) #7

You can create and call a small gRPC server and execute whatever you want. AFAIK.

(ext) #8

can u pls write example?

(George Calianu) #9

This is what a kernel does :wink:

(ext) #10

)))George that is kernel does?) I hear it for the first time

(Sibert) #11

No. I am struggling with this as well. Read all about gRPC-servers. I have managed to do a http server, But gRPC-server seems to be better for microservices. Small applications that works together.

Something like this: https://github.com/grpc/grpc-go/blob/master/examples/helloworld/greeter_server/main.go