filmov
tv
How to Build, install and run Go Programs in Windows - GoLang 1.20
![preview_player](https://i.ytimg.com/vi/EDEvW-_efBw/maxresdefault.jpg)
Показать описание
In this video we are going to show how to build, install and run golang programs in Windows Environment.
Below are steps involved.
I will be creating one new directory called "GoExamples2" where I am going to place .go files.
Now I am copying one go program which has main() function i.e. i am going to copy one standalone go program.
This program contains the logic to connect to oracle database 12c and fetch the records of person table.
Now I am going to download and install the third party modules using "go get" command.
we can see the downloaded modules here C:\Users\RAMANATHAN\go
Now I am going to execute the "go build" command which will compile packages and dependencies.
Which means it will create one .exe file (in windows) same as module name.
Now I am going to customize the .exe file name i.e. give my own name for .exe instead of module name using the command "go build -o".
Now I am going to show you some basic environment variables GOPATH and GOROOT
GOPATH is ---- C:\Users\USERNAME\go here it is C:\Users\RAMANATHAN\go which contains all the downloaded modules and packages.
GOROOT is ---- C:\Go-1.20 which is GoLang Binary (Go Software) installation directory.
Now I am going to execute "go install" command which will compiles and installs the packages named by the import paths.
Once you executed this command .exe file will be generated and copied to C:\Users\RAMANATHAN\go\bin directory.
That .exe file name will be same like module name.
We can execute that exe anywhere now.
If you want to uninstall the .exe simply delete the file in bin directory. Here i am deleting entire bin directory as i am having only one file.
These are the basic steps to Build, install and run Go Programs in Windows.
#go #goprogramming #golang #golangtutorial #golanguage #golangwindows #gowindows
Below are steps involved.
I will be creating one new directory called "GoExamples2" where I am going to place .go files.
Now I am copying one go program which has main() function i.e. i am going to copy one standalone go program.
This program contains the logic to connect to oracle database 12c and fetch the records of person table.
Now I am going to download and install the third party modules using "go get" command.
we can see the downloaded modules here C:\Users\RAMANATHAN\go
Now I am going to execute the "go build" command which will compile packages and dependencies.
Which means it will create one .exe file (in windows) same as module name.
Now I am going to customize the .exe file name i.e. give my own name for .exe instead of module name using the command "go build -o".
Now I am going to show you some basic environment variables GOPATH and GOROOT
GOPATH is ---- C:\Users\USERNAME\go here it is C:\Users\RAMANATHAN\go which contains all the downloaded modules and packages.
GOROOT is ---- C:\Go-1.20 which is GoLang Binary (Go Software) installation directory.
Now I am going to execute "go install" command which will compiles and installs the packages named by the import paths.
Once you executed this command .exe file will be generated and copied to C:\Users\RAMANATHAN\go\bin directory.
That .exe file name will be same like module name.
We can execute that exe anywhere now.
If you want to uninstall the .exe simply delete the file in bin directory. Here i am deleting entire bin directory as i am having only one file.
These are the basic steps to Build, install and run Go Programs in Windows.
#go #goprogramming #golang #golangtutorial #golanguage #golangwindows #gowindows