Using go to develop a websocket server (Windows environment) (i): Setting up the environment

Source: Internet
Author: User
Tags install go
This is a creation in Article, where the information may have evolved or changed.

First, download and install go

The process does not repeat, the next step. The default will be installed, it is C:\GO recommended not to modify, otherwise, what will happen strange bug.
After installation, you need to configure GOPATH environment variables, the environment variable directory is the project root directory, mine isD:\code\MCChatServer

Note GOPATH to capitalize

Second, installation Vscode

Still the next step, after the installation is complete, open the software and install the Vscode go plugin.
Select the 5th option on the left side of the Vscode, enter go in the search bar above, and select the author to install the Lukehoban plugin.

After the installation is complete, restart the Vscode. Then in the project and directory to create a suffix to go file, such as main.go , open with Vscode, open will automatically eject the installation Go Extension plugin prompt, select install all Vscode will automatically install the required plug-ins (there are several plugins need to flip the wall)

Or, use the command-line installation in the project directory:

After the installation is complete, create the Settings.json file in the. Vscode folder in the project and directory, and paste the code in the file:

{    "go.buildOnSave": true,    "go.lintOnSave": true,    "go.vetOnSave": true,    "go.buildTags": "",    "go.buildFlags": [],    "go.lintFlags": [],    "go.vetFlags": [],    "go.coverOnSave": false,    "go.useCodeSnippetsOnFunctionSuggest": false,    "go.formatOnSave": true,    "go.formatTool": "goreturns",    "go.goroot": "C:\\Go",    "go.gopath": "D:\\code\\MCChatServer",    "go.gocodeAutoBuild": false}

go.gopaththe path of attention is consistent with your own.

Three, run it

Write code in Main.go:

package mainimport "fmt"func main() {    fmt.Println("Hello, GO")}

Press the F5 run code, this time will pop up no delve error, install one is, use the command line to run:

go get -u -v github.com/derekparker/delve/cmd/dlv

Press again to F5 run.

Well, the environment is here, and the next section starts building the WebSocket server.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.