Mac with Go

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

Http://github.com/hoisie/web


git clone http://github.com/hoisie/web


Then perform a compilation installation


CD Web && Go Build

Server.go:7:2:cannot Find Package "Golang.org/x/net/websocket" in any of:

/usr/local/go/src/golang.org/x/net/websocket (from $GOROOT)

($GOPATH not set)

bash-3.2# Echo $GOPATH



bash-3.2# Go get Golang.org/x/net/websocket

If you do not encounter a similar error message, you can skip

(

Cannot find package "Golang.org/x/net/websocket" in any of:

)

bash-3.2# Go Build

bash-3.2# ls

According to the current understanding, it should be Gopath is to store non-core go lib, and Goroot is about go and runtime directory

= = = First run a demo look

Package Main


Import (

"Github.com/hoisie/web"

)


Func Hello (val String) string {return "Hello" + val}


Func Main () {

Web. Get ("/(. *)", hello)

Web. Run ("0.0.0.0:9999")

}

I feel like this. Two presentations in the development architecture, operation and maintenance architecture, technical framework, Team competency model, business transformation and other aspects of a very good overall re-planning and definition, customer-oriented, end-to-end micro-digital management, iterative evolution and other concepts are very advanced and correct.


Go Run hello.go

"

Hello.go:4:5:cannot Find Package "Github.com/hoisie/web" in any of:
/usr/local/go/src/github.com/hoisie/web (from $GOROOT)
"

Go get Github.com/hoisie/web

Files will be added to the Gopath directory

Get the library from Go get Lib



Func Main () {
Web. Get ("/(. *)", hello)
Web. Run ("0.0.0.0:9999")
}
Http://localhost:9999/third

This third will be used as the parameter Hello function, and the web. Get ("/(. *)", hello), which indicates that any format URL is handled by hello


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.