当前位置: 首页 > news >正文

网站建设选择北京华网天下网站建设是虚拟行业吗

网站建设选择北京华网天下,网站建设是虚拟行业吗,中国建设银行移动门户,旅游网站 静态模板目录 一、Go Module 1、开启Go Module 2、Go Module基本操作 3、使用GoLand创建Go Module项目 4、GoLand配置File Watchers 一、Go Module Go Module包管理工具----相当于Maven 1.11版本引入 1.12版本正式支持 告别GOPATH#xff0c;使用Go Module管理项目#xff0c…目录 一、Go Module 1、开启Go Module 2、Go Module基本操作 3、使用GoLand创建Go Module项目 4、GoLand配置File Watchers 一、Go Module Go Module包管理工具----相当于Maven 1.11版本引入 1.12版本正式支持 告别GOPATH使用Go Module管理项目就不需要非得把项目放到GOPATH SRC目录下你可以在你磁盘的任何位置新建一个项目 C:\Users\Administratorgo env set GO111MODULE set GOARCHamd64 set GOBIN set GOCACHEC:\Users\Administrator\AppData\Local\go-build set GOENVC:\Users\Administrator\AppData\Roaming\go\env set GOEXE.exe set GOEXPERIMENT set GOFLAGS set GOHOSTARCHamd64 set GOHOSTOSwindows set GOINSECURE set GOMODCACHEC:\Users\Administrator\go\pkg\mod set GONOPROXY set GONOSUMDB set GOOSwindows set GOPATHC:\Users\Administrator\go set GOPRIVATE set GOPROXYhttps://proxy.golang.org,direct set GOROOTC:\Program Files\Go set GOSUMDBsum.golang.org set GOTMPDIR set GOTOOLDIRC:\Program Files\Go\pkg\tool\windows_amd64 set GOVCS set GOVERSIONgo1.20.6 set GCCGOgccgo set GOAMD64v1 set ARar set CCgcc set CXXg set CGO_ENABLED0 set GOMODNUL set GOWORK set CGO_CFLAGS-O2 -g set CGO_CPPFLAGS set CGO_CXXFLAGS-O2 -g set CGO_FFLAGS-O2 -g set CGO_LDFLAGS-O2 -g set PKG_CONFIGpkg-config set GOGCCFLAGS-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length0 -fdebug-prefix-mapC:\Users\ADMINI~1\AppData\Local\Temp\go-build3162599993/tmp/go-build -gno-record-gcc-switches 1、开启Go Module 1、修改环境变量 C:\Users\Administratorgo env -w GO111MODULEonC:\Users\Administratorgo env -w GOPROXYhttps://goproxy.cn,direct#GO111MODULE 三种值 GO111MODULEoff go命令行将不会支持module功能寻找依赖包的方式将会沿用旧版本那种 通过vendor目录或GOPATH模式来查找 GO111MODULEon go命令将会使用module也不会取GOPATH目录下查找 GO111MODULEauto 默认值go命令将会根据当前目录来决定是否启用module功能2、命令行方式创建Go Module项目 mkdir projectname cd projectname go mod init projectname #使用GoLand打开工程 #S 演示 D:\GO_workspace_webmkdir test_modelD:\GO_workspace_webcd test_modelD:\GO_workspace_web\test_modelgo mod init test_model go: creating new go.mod: module test_model#此时test_model下会创建go.mod文件 #使用GoLand打开工程 #E 演示 go.mod内容 module test_modelgo 1.20在GoLand软件的Terminal中输入 go get -u github.com/gin-gonic/gin#执行信息如下 PS D:\GO_workspace_web\test_model go get -u github.com/gin-gonic/gin go: downloading github.com/gin-gonic/gin v1.9.1 go: downloading github.com/gin-contrib/sse v0.1.0 go: downloading golang.org/x/net v0.10.0 go: downloading github.com/mattn/go-isatty v0.0.19 go: downloading github.com/pelletier/go-toml/v2 v2.0.8 go: downloading github.com/go-playground/validator/v10 v10.14.0 go: downloading github.com/ugorji/go/codec v1.2.11 go: downloading google.golang.org/protobuf v1.30.0 go: downloading gopkg.in/yaml.v3 v3.0.1 go: downloading github.com/bytedance/sonic v1.9.1 go: downloading github.com/pelletier/go-toml v1.9.5 go: downloading github.com/goccy/go-json v0.10.2 go: downloading github.com/pelletier/go-toml/v2 v2.0.9 go: downloading github.com/go-playground/validator/v10 v10.15.0 go: downloading github.com/ugorji/go v1.2.11 go: downloading github.com/json-iterator/go v1.1.12 go: downloading github.com/go-playground/validator v9.31.0incompatible go: downloading golang.org/x/sys v0.8.0 go: downloading google.golang.org/protobuf v1.31.0 go: downloading golang.org/x/net v0.14.0 go: downloading github.com/bytedance/sonic v1.10.0 go: downloading github.com/gabriel-vasile/mimetype v1.4.2 go: downloading github.com/go-playground/universal-translator v0.18.1 go: downloading github.com/leodido/go-urn v1.2.4 go: downloading golang.org/x/crypto v0.9.0 go: downloading golang.org/x/text v0.9.0 go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd go: downloading github.com/modern-go/reflect2 v1.0.2 go: downloading golang.org/x/sys v0.11.0 go: downloading github.com/go-playground/locales v0.14.1 go: downloading golang.org/x/crypto v0.12.0 go: downloading github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 go: downloading golang.org/x/text v0.12.0 go: downloading golang.org/x/arch v0.3.0 go: downloading github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d go: downloading github.com/twitchyliquid64/golang-asm v0.15.1 go: downloading golang.org/x/arch v0.4.0 go: downloading github.com/klauspost/cpuid/v2 v2.2.4 go: downloading github.com/klauspost/cpuid/v2 v2.2.5 go: downloading github.com/klauspost/cpuid v1.3.1 go: downloading github.com/chenzhuoyu/iasm v0.9.0 go: added github.com/bytedance/sonic v1.10.0 go: added github.com/twitchyliquid64/golang-asm v0.15.1 go: added github.com/ugorji/go/codec v1.2.11 go: added golang.org/x/arch v0.4.0 go: added golang.org/x/crypto v0.12.0 go: added golang.org/x/net v0.14.0 go: added golang.org/x/sys v0.11.0 go: added golang.org/x/text v0.12.0 go: added google.golang.org/protobuf v1.31.0 go: added gopkg.in/yaml.v3 v3.0.1 PS D:\GO_workspace_web\test_model此时的go.mod内容 module test_modelgo 1.20require (github.com/bytedance/sonic v1.10.0 // indirectgithub.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirectgithub.com/chenzhuoyu/iasm v0.9.0 // indirectgithub.com/gabriel-vasile/mimetype v1.4.2 // indirectgithub.com/gin-contrib/sse v0.1.0 // indirectgithub.com/gin-gonic/gin v1.9.1 // indirectgithub.com/go-playground/locales v0.14.1 // indirectgithub.com/go-playground/universal-translator v0.18.1 // indirectgithub.com/go-playground/validator/v10 v10.15.0 // indirectgithub.com/goccy/go-json v0.10.2 // indirectgithub.com/json-iterator/go v1.1.12 // indirectgithub.com/klauspost/cpuid/v2 v2.2.5 // indirectgithub.com/leodido/go-urn v1.2.4 // indirectgithub.com/mattn/go-isatty v0.0.19 // indirectgithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirectgithub.com/modern-go/reflect2 v1.0.2 // indirectgithub.com/pelletier/go-toml/v2 v2.0.9 // indirectgithub.com/twitchyliquid64/golang-asm v0.15.1 // indirectgithub.com/ugorji/go/codec v1.2.11 // indirectgolang.org/x/arch v0.4.0 // indirectgolang.org/x/crypto v0.12.0 // indirectgolang.org/x/net v0.14.0 // indirectgolang.org/x/sys v0.11.0 // indirectgolang.org/x/text v0.12.0 // indirectgoogle.golang.org/protobuf v1.31.0 // indirectgopkg.in/yaml.v3 v3.0.1 // indirect )编写main.go package mainimport (github.com/gin-gonic/gin )func main() {r : gin.Default()r.GET(/test, func(c *gin.Context) {c.JSON(200, gin.H{msg: test success,})})r.Run() } 运行 访问测试http://localhost:8080/test 2、Go Module基本操作 D:\GO_workspace_web\test_modelgo mod help #查看帮助 Go mod provides access to operations on modules.Note that support for modules is built into all the go commands, not just go mod. For example, day-to-day adding, removing, upgrading, and downgrading of dependencies should be done using go get. See go help modules for an overview of module functionality.Usage:go mod command [arguments]The commands are:download download modules to local cacheedit edit go.mod from tools or scriptsgraph print module requirement graphinit initialize new module in current directorytidy add missing and remove unused modulesvendor make vendored copy of dependenciesverify verify dependencies have expected contentwhy explain why packages or modules are neededUse go help mod command for more information about a command. 初始化一个module模块名为项目名 go mod init projectname 下载module到本地cache路径为go env中的GOMODCACHE go mod download 通过工具或脚本剪辑go.mod文件选项有-json、-require和-exclude可以使用帮助go help mod edit D:\GO_workspace_web\test_modelgo help mod edit usage: go mod edit [editing flags] [-fmt|-print|-json] [go.mod]Edit provides a command-line interface for editing go.mod, for use primarily by tools or scripts. It reads only go.mod; it does not look up information about the modules involved. By default, edit reads and writes the go.mod file of the main module, but a different target file can be specified after the editing flags.The editing flags specify a sequence of editing operations.The -fmt flag reformats the go.mod file without making other changes. This reformatting is also implied by any other modifications that use or rewrite the go.mod file. The only time this flag is needed is if no other flags are specified, as in go mod edit -fmt.The -module flag changes the modules path (the go.mod files module line).The -requirepathversion and -droprequirepath flags add and drop a requirement on the given module path and version. Note that -require overrides any existing requirements on path. These flags are mainly for tools that understand the module graph. Users should prefer go get pathversion or go get pathnone, which make other go.mod adjustments as needed to satisfy constraints imposed by other modules.The -excludepathversion and -dropexcludepathversion flags add and drop an exclusion for the given module path and version. Note that -excludepathversion is a no-op if that exclusion already exists.The -replaceold[v]new[v] flag adds a replacement of the given module path and version pair. If the v in oldv is omitted, a replacement without a version on the left side is added, which applies to all versions of the old module path. If the v in newv is omitted, the new path should be a local module root directory, not a module path. Note that -replace overrides any redundant replacements for old[v], so omitting v will drop existing replacements for specific versions. ...... 以文本模式打印模块需求图 go mod graphD:\GO_workspace_web\test_modelgo mod graph #在项目文件夹下执行 test_model github.com/bytedance/sonicv1.10.0 test_model github.com/chenzhuoyu/base64xv0.0.0-20230717121745-296ad89f973d test_model github.com/chenzhuoyu/iasmv0.9.0 test_model github.com/gabriel-vasile/mimetypev1.4.2 test_model github.com/gin-contrib/ssev0.1.0 test_model github.com/gin-gonic/ginv1.9.1 test_model github.com/go-playground/localesv0.14.1 test_model github.com/go-playground/universal-translatorv0.18.1 test_model github.com/go-playground/validator/v10v10.15.0 .... 添加缺失或者删除没有使用的modules go mod tidy 在本地生成vendor目录(旧方式) go mod vendor 验证依赖是否正确 go mod verifyD:\GO_workspace_web\test_modelgo mod verify all modules verified 查找依赖 go mod whyD:\GO_workspace_web\test_modelgo mod why go: downloading github.com/stretchr/testify v1.8.4 go: downloading github.com/google/go-cmp v0.5.5 go: downloading github.com/davecgh/go-spew v1.1.1 go: downloading github.com/go-playground/assert/v2 v2.2.0 go: downloading gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 go: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 go: downloading github.com/pmezard/go-difflib v1.0.0 # test_model test_model 3、使用GoLand创建Go Module项目 1、File---New---Project.... 有Go modules就选择没有就选择Go 点击Create创建会自动创建go.mod文件如下图 其他操作和上面命令行那种方式一样的操作即可。 4、GoLand配置File Watchers File---Settings--Tools---File Watchers,选择按照如下配置go fmt和goimports Golang学习深入(一) 干我们这行啥时候懈怠就意味着长进的停止长进的停止就意味着被淘汰只能往前冲直到凤凰涅槃的一天
http://www.w-s-a.com/news/118747/

相关文章:

  • 排名好的手机网站建设番禺网站建设专家
  • 番禺怎么读百度有专做优化的没
  • 网站开发中应注意哪些问题网络营销的主要特点
  • 网站定制案例北京网站制作招聘网
  • 网站建设与推广实训小结网站建设专业英文
  • 郑州网站建设动态凡科网站建设是免费的吗
  • 湖北手机网站建设wordpress转emlog博客
  • 北京东站设计网名的花样符号
  • 安徽建设厅网站首页网站开发aichengkeji
  • 自贡网站制作荣茂网站建设
  • 什么做的网站吗正规的机械外包加工订单网
  • 网络工程公司的业务邵阳seo快速排名
  • 博主怎么赚钱网站seo找准隐迅推
  • 营销号经典废话北京网站建设公司网站优化资讯
  • 一六八互联网站建设怎么做套版网站
  • wordpress 书站建筑公司简介范文大全
  • 建设官方网站多少鲜花网站建设的主要工作流程
  • 卖主机网站轻量wordpress主题
  • 网站建设规划书结构制作一个自己的网站
  • 外贸网站商城建设做网站和推广
  • 网站建设微信群免费简约ppt模板
  • 哈尔滨网站设计公司哪家更好shopify和wordpress
  • 岚县网站建设网站建设中效果
  • 网站建设软文推广网站建设分金手指排名十四
  • 网站建设要什么知识广州注册公司地址怎么解决
  • 自己可以做开奖网站吗wordpress和hexo
  • 成都网站关键词优化wordpress价格
  • 网站开发后端站建设 app开发网站
  • 毕业设计做网站好的想法开发网站代码量
  • 西宁网站建设排名wordpress的站点地址如何配置