Go搭建后台服务学习记录

时间:2022-11-23 06:43:33

资料:

1. go基础

https://juejin.im/entry/58329f84da2f600063074382

https://www.w3cschool.cn/go/

2.go的一个orm框架,但是我觉得不是非常好用,跟hibernate这些差距非常大

http://xorm.io/docs

https://www.cnblogs.com/guhao123/p/4159688.html

3.微服务

https://segmentfault.com/a/1190000015135650?utm_campaign=studygolang.com&utm_medium=studygolang.com&utm_source=studygolang.com

4.Docker入门教程

http://www.docker.org.cn/book/docker/prepare-docker-5.html

5.目前为止找到最易用的Go web框架,beego

https://beego.me/

beego的开源之路

https://blog.csdn.net/RA681t58CJxsgCkJ31/article/details/79276433

PS:框架作者像阮一峰一样开源了自己写的书,在他的Github上

问题:

1.环境变量:

https://www.cnblogs.com/guhao123/p/4159688.html

https://blog.csdn.net/handsomefuhs/article/details/79687381

mac添加环境变量,基本上都是动 bash_profile,添加完环境变量后,重启终端才生效

2.报错

main.go::: cannot find package "github.com/micro/examples/booking/api/hotel/proto" in any of:

        /usr/local/go/src/github.com/micro/examples/booking/api/hotel/proto (from $GOROOT)

        /Users/linge/go/src/github.com/micro/examples/booking/api/hotel/proto (from $GOPATH)

main.go::: cannot find package "github.com/micro/examples/booking/srv/auth/proto" in any of:

        /usr/local/go/src/github.com/micro/examples/booking/srv/auth/proto (from $GOROOT)

        /Users/linge/go/src/github.com/micro/examples/booking/srv/auth/proto (from $GOPATH)

main.go::: cannot find package "github.com/micro/examples/booking/srv/geo/proto" in any of:

        /usr/local/go/src/github.com/micro/examples/booking/srv/geo/proto (from $GOROOT)

        /Users/linge/go/src/github.com/micro/examples/booking/srv/geo/proto (from $GOPATH)

main.go::: cannot find package "github.com/micro/examples/booking/srv/profile/proto" in any of:

        /usr/local/go/src/github.com/micro/examples/booking/srv/profile/proto (from $GOROOT)

        /Users/linge/go/src/github.com/micro/examples/booking/srv/profile/proto (from $GOPATH)

main.go::: cannot find package "github.com/micro/examples/booking/srv/rate/proto" in any of:

        /usr/local/go/src/github.com/micro/examples/booking/srv/rate/proto (from $GOROOT)

        /Users/linge/go/src/github.com/micro/examples/booking/srv/rate/proto (from $GOPATH)

main.go::: cannot find package "github.com/nu7hatch/gouuid" in any of:

        /usr/local/go/src/github.com/nu7hatch/gouuid (from $GOROOT)

        /Users/linge/go/src/github.com/nu7hatch/gouuid (from $GOPATH)

../../../../go/src/github.com/micro/go-micro/broker/http_broker.go::: cannot find pac
go get -u github.com/micro/go-micro
package golang.org/x/text/secure/bidirule: unrecognized import path "golang.org/x/text/secure/bidirule" (https fetch: Get https://golang.org/x/text/secure/bidirule?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
package golang.org/x/text/unicode/bidi: unrecognized import path "golang.org/x/text/unicode/bidi" (https fetch: Get https://golang.org/x/text/unicode/bidi?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
package golang.org/x/text/unicode/norm: unrecognized import path "golang.org/x/text/unicode/norm" (https fetch: Get https://golang.org/x/text/unicode/norm?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)

第一个是少了包,编译不过,按照下面安装包时,会遇到国内大多数人遇到的包安装问题,即使挂vpn也无济于事,解决方法是

gopm

gopm get -g -v  github.com/go-sql-driver/mysql