ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
要安装Gin包,首先需要安装Go并设置Go工作区 1、下载并安装 > $ go get -u github.com/gin-gonic/gin 2、在代码中导入它 > import "github.com/gin-gonic/gin" **使用包管理工具Govendor安装** 1、`go get` govendor(安装) > $ go get github.com/kardianos/govendor 2、创建项目文件夹并进入文件夹 > $ mkdir -p $GOPATH/src/github.com/myusername/project && cd "$_" 3、初始化项目并添加 gin > $ govendor init > > $ govendor fetch github.com/gin-gonic/gin@v1.3 4、复制一个模板到你的项目 > $ curl https://raw.githubusercontent.com/gin-gonic/gin/master/examples/basic/main.go > main.go 5、运行项目 > $ go run main.go **注意** 使用gin需要Go的版本号为1.6或更高