清风细雨楼 Design By www.eepep.com
安装前准备:
设置GOPROXY代理
参考:https://goproxy.cn/
我使用的是下面的两条命令:
$ go env -w GO111MODULE=on $ go env -w GOPROXY=https://goproxy.cn,direct
我的go env信息:
% go env GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/Users/mac/Library/Caches/go-build" GOENV="/Users/mac/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/mac/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/mac/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/mac/www/iris/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/d5/13f52jg52n500y4w_8bxcx680000gn/T/go-build475857461=/tmp/go-build -gno-record-gcc-switches -fno-common" mac@MacdeMacBook-Pro iris % go env -w GO111MODULE=on mac@MacdeMacBook-Pro iris % go env -w GOPROXY=https://goproxy.cn,direct mac@MacdeMacBook-Pro iris % go env GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/Users/mac/Library/Caches/go-build" GOENV="/Users/mac/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/mac/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/mac/go" GOPRIVATE="" GOPROXY="https://goproxy.cn,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/mac/www/iris/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/d5/13f52jg52n500y4w_8bxcx680000gn/T/go-build212739672=/tmp/go-build -gno-record-gcc-switches -fno-common"
安装过程参考:https://www.iris-go.com/docs/#/
创建一个新项目:
% cd ~/www % mkdir iris % cd iris % go mod init iris go: creating new go.mod: module iris % ls go.mod %vim main.go package main import ( "github.com/kataras/iris/v12" ) func main() { app := iris.New() app.Get("/", func(ctx iris.Context) { ctx.HTML("<h1>Hello World!</h1>") app.Logger().Info("我在学习Iris噢") }) app.Run(iris.Addr(":8009")) }
实际安装过程:
go get -u github.com/kataras/iris/v12@master go: downloading github.com/kataras/iris/v12 v12.2.0-alpha.0.20201126085352-5b6802d00eaf go: downloading github.com/kataras/iris v0.0.0-20191006184023-c8e73f4f4df2 go: github.com/kataras/iris/v12 master => v12.2.0-alpha.0.20201126085352-5b6802d00eaf go: downloading github.com/tdewolff/minify/v2 v2.9.10 go: downloading github.com/BurntSushi/toml v0.3.1 go: downloading github.com/kataras/tunnel v0.0.2 go: downloading github.com/mailru/easyjson v0.7.6 go: downloading gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 go: downloading github.com/json-iterator/go v1.1.10 go: downloading github.com/schollz/closestmatch v2.1.0+incompatible go: downloading github.com/fatih/structs v1.1.0 go: downloading github.com/CloudyKit/jet/v5 v5.1.1 go: downloading github.com/flosch/pongo2/v4 v4.0.0 go: downloading github.com/kataras/golog v0.1.5 go: downloading gopkg.in/ini.v1 v1.62.0 go: downloading golang.org/x/text v0.3.4 go: downloading github.com/kataras/blocks v0.0.4 go: downloading github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 go: downloading github.com/tdewolff/parse/v2 v2.5.5 go: downloading github.com/kataras/pio v0.0.10 go: downloading github.com/iris-contrib/jade v1.1.4 go: downloading google.golang.org/protobuf v1.25.0 go: downloading github.com/yosssi/ace v0.0.5 go: downloading github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 go: downloading golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 go: downloading github.com/google/uuid v1.1.2 go: downloading github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible go: downloading golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e go: downloading github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 go: downloading golang.org/x/net v0.0.0-20201110031124-69a78807bb2b go: downloading github.com/russross/blackfriday v1.5.2 go: downloading github.com/klauspost/compress v1.11.3 go: downloading github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 go: downloading github.com/andybalholm/brotli v1.0.1 go: downloading github.com/vmihailenco/msgpack/v5 v5.0.0 go: downloading github.com/russross/blackfriday/v2 v2.1.0 go: downloading github.com/iris-contrib/schema v0.0.6 go: downloading github.com/vmihailenco/tagparser v0.1.2 go: downloading github.com/kataras/sitemap v0.0.5 go: downloading github.com/valyala/bytebufferpool v1.0.0 go: downloading golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 go: downloading github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398 go: downloading github.com/microcosm-cc/bluemonday v1.0.4 go: downloading github.com/chris-ramon/douceur v0.2.0 go: downloading github.com/aymerick/douceur v0.2.0 go: downloading github.com/gorilla/css v1.0.0
以上安装在了~/go/pkg/mod目录下了:
创建一个main.go文件:
%vim main.go package main import ( "github.com/kataras/iris/v12" ) func main() { app := iris.New() app.Get("/", func(ctx iris.Context) { ctx.HTML("<h1>Hello World!</h1>") app.Logger().Info("我在学习Iris噢") }) app.Run(iris.Addr(":8009")) } 以上保存后运行: % go run main.go Now listening on: http://localhost:8009 Application started. Press CMD+C to shut down.
用goland打开刚才的iris项目发现不能识别iris,引入的iris部分提示红色,解决办法为:Preferences->Go Modules
保存即可
外部库下载到项目根目录下:
% go mod vendor
执行之后,项目的根目录下增加了一个vendor
的文件夹,文件夹的名字和PHP的composer生成的文件夹相同,作用也是一样的。
然后在这基础上可以进行功能的开发了。
清风细雨楼 Design By www.eepep.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
清风细雨楼 Design By www.eepep.com
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年12月28日
2024年12月28日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]