# go-demo **Repository Path**: Except-one/go-demo ## Basic Information - **Project Name**: go-demo - **Description**: 学习 Go 语言的第一个项目:go-demo - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-01-07 - **Last Updated**: 2022-01-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: Go语言, API ## README ### 1.创建项目`go-demo` mkdir go-demo ### 2.`vs code`打开`go-demo`, 创建`main.go` ```go package main import "fmt" func main() { fmt.Println("hello world.") } ``` ### 3.终端执行 `go run main.go` `go run main.go router.go` -- hello world. ### 4.安装初始化模块 go mod init 公司名称[[.][后缀名]]/项目名称 `go mod init sweeter.star/go-demo` ### 5.下载`gin`的依赖 ```go go get -u github.com/gin-gonic/gin ``` ### 安装数据库扩展包并创建名为`go.demo`的数据库 ```go go get -u gorm.io/gorm ``` ### 项目使用的扩展包 ![bcrypt -- 用户密码验证]() ![gorm -- 数据模型操作]() ![jwt -- Auth 认证]() ![viper -- 读取config配置项]() ### 相关站点 GO知识体系 -- https://haicoder.net/golang/golang-string-concat.html GORM -- https://gorm.io/zh_CN/docs/connecting_to_the_database.html#MySQL