In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces how to build the GO language windows system development environment and how to create the project. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
Go (also known as Golang) is a static strongly typed, compiled, parallel programming language developed by Google with garbage collection function.
1. Download GO from the official website first.
Https://golang.org/
two。 Choose a suitable OS coefficient to download.
Https://golang.org/dl/
3. After downloading, double-click the installation, install it on disk C all the way down, and finally complete the installation.
4. Don't rush to find the installed GO, let's configure the environment variables first
If you have completed the installation steps above, then the following PATH automatically adds the variable name and the following is the environment setting we want to do. Remember that there is nothing wrong with (1) create a new variable name: GOROOT variable value: C:\ Go variable value is what I said at the beginning of the installation directory (2) New variable name: GOPATH premise: prepare in advance a directory to create such a folder under disk D:\ go_workspace\ go Create a file directory according to my location: in the following figure, the folder src is the location where our .go source files (go code) will be stored in the future, and other folders are also useful. Since this is a built running environment, the other two files are skipped. The purpose here is to make it easy for us to manage files and projects, because it is too troublesome to open C disk every time, and we need such a folder when we learn other knowledge in the future.
Variable value: d:\ go_workspace\ go\ src variable value for the newly created folder under the above directory and add the above variable name to the path and add the following configuration at the end of the path variable value;% GOROOT%\ BIN;%GOPATH%
5. Test whether the installation is successful
Open the command prompt (cmd.exe) (shortcut key: win+r) in Windows and execute the command: go version (check the version number) or go help, which normally displays: the configuration has been successfully configured. You can type cmd under the computer terminal and use the command go env to check whether the comparison configuration is consistent: it can be found to be the same
6. Create the first GO program (hello.go) and run it
Now that we have successfully configured the environment variables, we can create the hello.go source file under the scr folder we just mentioned (note: when creating with notepad, the suffix of the file is ".go", and choose the format of UTF-8 when saving) (I opened the above go file with the sublime text 3 code editor installed by myself, of course, you can also choose other ways to open it. There is no uniform requirement here, as long as you can open it and look at the code) the source code
Package main
Import "fmt"
Func main () {
Fmt.Println ("Hello, World!")
}
Then open the cmd computer terminal and enter the command go run.\ hello.go (Note: be sure to go to the specified directory, please see the following picture, run successfully)
However, if you do this every time, the project is too troublesome, so for convenience, we need to install the GO interpreter for rapid development.
7. Install the GO interpreter IDE:LiteIDE
(recommended, because this compiler is installed in Chinese by default) download address: the file after https://sourceforge.net/projects/liteide/files/ download is in the form of installation package, then extract the file to disk C, decompress it, and open disk C. as shown in the picture, enter the file directory C:\ liteide\ bin to find the liteide.exe application file and double-click the mouse to open it. At this time, the installation is successful. You can send liteide.exe applications to desktop shortcuts to make them available at any time. It is worth noting that this interpreter also needs to configure the current environment. In general, if you have completed the above installation and configuration ahead of time, then you will default to the configuration parameters after decompression, and we can check some of them first. If it is different, reconfigure the environment variables.
Click "tools"-> "Edit current environment"
Comparing the previous parameters as shown in the figure below, it is obvious that the result is the same configuration environment. Open the hello.go file we created earlier and run the program with the shortcut key Ctrl+R, and get the same result.
Supplementary explanation
In fact, there are some environment variables can be set, which varies from person to person: GOROOT:Go installation directory GOPATH: used to store the Go language Package directory, this directory can not be in the Go installation directory to store GOBIN:Go binaries directory, write as% GOROOT%\ bin GOOS: operating system GOARCH: specify the system environment, i386 for x86 for x64 (or 32-bit, x86) PATH: need to add% GOBIN% to the last of the PATH variable It is convenient to run Go from the command line.
On the GO language windows system development environment building and how the project is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.