Build and use an eclipse-based go language visualization development environment.
- 1
Download Eclipse or my packaged goclipse, unzip the package, you can see a eclipse.exe file, open it, and go into Eclipse, the IDE.
Note that if a dialog box "Workspace Launcher" (3) pops up during the entry process, the workspace is set, which is where the project code is stored.
- 2
However, this eclipse does not yet support the development of the go language, so we will install the Goclipse plugin for this eclipse:
Click "Help" in the menu, "Install New Software"
- 3
Then, click on the "add" button to pop up an "Add Repository" dialog box,
In "Name" In the box, enter
"goclipse" (not including quotation marks),
In "Location" inthe box, enter
"https://goclipse.googlecode.com/svn/trunk/goclipse-update-site/" (not including quotation marks)
Then click on the "OK" button
- 4
Then, the list below shows Pending... and then becomes goclipse,
Select it.
Then all the way "Next >", and finally wait for the installation.
Restart (Restart) Eclipse. The Goclipse is installed successfully.
- 5
After you restart Eclipse, you will see a Go tab in the upper-right corner of the window, and a menu item for go Project and go file appears in the menu bar, " File", "New" . If not, you can open the Go tab by tapping the open perspective icon in the upper-right corner.
- 6
The next step is to configure the Go language path.
Click " window", "Preferences" in the menu item, and select "Go"in the list item on the left. You can then configure the Go language path and environment on the right (configuration, where GOOS: represents your system, because it was developed under Windows, so choose windows. Goarch: indicates the CPU type of your computer. The author is i386, so choose 386).
If you have a GDB debugger, you can also set GDB's path by selecting "Debugger" under "Go" in the list item.
- 7
Let's try new and compile a project to run a go language.
Click on the menu bar "File" , " New" , " Go Project"
In project name: Enter the name of the project in the input box, for example "HelloWorld"
Click "Finish" button to complete a new project
You can see that a HelloWorld project appears in the project Explorer Bar
- 8
Next, add the go source code.
Expand HelloWorld Project
Right-click the src folder and select " New","Go File"
Fill in the source code file name in the input box in source file: (note: Must end with. Go)
Under the option box for the source file Type , select the Empty Main Function in Command source file
(means to generate a go source code that has an empty main function (start function))
- 9
Then edit the source code that you just created:
Package Main
Import (
"FMT"
)
Func Main () {
Fmt. Println ("helloworld!");
}
Save source Code (CTRL+S)
- 10
The next step is to run
Before running, make sure that the Console (console) window is open (open method Click on the menu bar, "window", "Show View", "console")
Then click on the "Run" button in the toolbar to run the program
You can then see the helloworld! text displayed in the console console.
- 11
Here, the Go Language visualization development environment under eclipse has been built, and of course eclipse is not the only Ide,go language developed by the Go language assistant IDE and Gedit,vim,notepad++,liteide and so on.