I need to write a small application which will be deployed on Linux. I have following questions regarding the same:
Do I need to write the code on linux machine only, so that the compiled file is not an EXE [on windows]?
Once I have a compiled file, do I need to install ANYTHING on my production linux server to run that GO program, like JRE for JAva etc?
If I build/use Oracle driver in my dev environment, so that my program can connect to Oracle database, would I have to port something on my production server as well, so that my compiled program can use that drive on other server as well? [its kind of same as number 2 but more specific to drivers].
You can write and compile the code on any platform supported by Go (Linux BSD Mac Windows)
Eg. to compile for Linux Mac OS X and Windows GOOS=linux GOARCH=amd64 go build -o myprogram.linux GOOS=darwin GOARCH=amd64 go build -o myprogram.darwin GOOS=windows GOARCH=amd64 go build -o myprogram.exe
You won’t need to install anything else on the production server. The compiled binary will just work. You will need to copy up any files the binary depends on, like HTML templates etc.
The oracle driver will be included in the binary. You’ll need to read in the specific configuration details (address, username, password) from an environment variable or config file.