Golang依赖管理工具:glide从入门到精通使用

介绍

不论是开发Java还是你正在学习的Golang,都会遇到依赖管理问题。Java有牛逼轰轰的Maven和Gradle。 Golang亦有godep、govendor、glide、gvt、gopack等等,本文主要给大家介绍gilde。 glide是Golang的包管理工具,是为了解决Golang依赖问题的。 为什么需要glide? 原因很简单,Go 语言原生包管理的缺陷。罗列一下golang的 get 子命令管理依赖有很多大缺陷:

  • 能拉取源码的平台很有限,绝大多数依赖的是 github.com
  • 不能区分版本,以至于令开发者以最后一项包名作为版本划分
  • 依赖 列表/关系 无法持久化到本地,需要找出所有依赖包然后一个个 go get
  • 只能依赖本地全局仓库(GOPATH/GOROOT),无法将库放置于局部仓库($PROJECT_HOME/vendor)

安装

Golang环境设置

采用vendor目录特性,Go 1.5 做为试验特性加入(需要指定 GO15VENDOREXPERIMENT=1 环境变量),并在 Go 1.6 正式引入的一个概念。多数 go 依赖解决方案都基于它的。GO15VENDOREXPERIMENT 是 Go 1.5 版本新增的一个环境变量,如果将值改为 1 则表示启用。它可以将项目根目录名为 vendor 的目录添加到 Go 的库搜寻路径中,实现一个局部依赖的效果。
特性在 1.5 版本作为实验特性被添加,1.6 中默认被启用,1.7 移除变量加入标准中。
Go 提供了原始的 go get ,让第三方包管理可以基于 go get 做扩展。GO15VENDOREXPERIMENT 特性让局部依赖成为现实。Go 官方在给第三方包管理营造条件以及引导开发者用户至所推荐的方向,促进社区的繁荣。证明了一个语言技术的生态不仅仅只能靠官方或者取决于官方的完善程度。

1//设置环境变量 使用vendor目录 2GO15VENDOREXPERIMENT=1

为什么要选择glide? Glide 是众多实现 GO15VENDOREXPERIMENT 特性的包管理工具之一,但它是本文最为推荐的,具体为什么推荐它,原因很简单,因为它目前最受关注。 几大主要功能:

  • 持久化依赖列表至配置文件中,包括依赖版本(支持范围限定)以及私人仓库等
  • 持久化关系树至 lock 文件中(类似于 yarn 和 cargo),以重复拉取相同版本依赖
  • 兼容 go get 所支持的版本控制系统:Git, Bzr, HG, and SVN
  • 支持 GO15VENDOREXPERIMENT 特性,使得不同项目可以依赖相同项目的不同版本
  • 可以导入其他工具配置,例如: Godep, GPM, Gom, and GB

在这里给大家介绍glide中文文档,感谢 @岁月无痕 翻译。

安装glide

1$ go get github.com/Masterminds/glide 2$ go install github.com/Masterminds/glide

验证

1$ glide 2NAME: 3 glide - Vendor Package Management for your Go projects. 4 5 Each project should have a 'glide.yaml' file in the project directory. Files 6 look something like this: 7 8 package: github.com/Masterminds/glide 9 imports: 10 - package: github.com/Masterminds/cookoo 11 version: 1.1.0 12 - package: github.com/kylelemons/go-gypsy 13 subpackages: 14 - yaml 15 16 For more details on the 'glide.yaml' files see the documentation at 17 https://glide.sh/docs/glide.yaml 18 19 20USAGE: 21 glide [global options] command [command options] [arguments...] 22 23VERSION: 24 0.13.0-dev 25 26COMMANDS: 27 create, init Initialize a new project, creating a glide.yaml file 28 config-wizard, cw Wizard that makes optional suggestions to improve config in a glide.yaml file. 29 get Install one or more packages into `vendor/` and add dependency to glide.yaml. 30 remove, rm Remove a package from the glide.yaml file, and regenerate the lock file. 31 import Import files from other dependency management systems. 32 name Print the name of this project. 33 novendor, nv List all non-vendor paths in a directory. 34 rebuild Rebuild ('go build') the dependencies 35 install, i Install a project's dependencies 36 update, up Update a project's dependencies 37 tree (Deprecated) Tree prints the dependencies of this project as a tree. 38 list List prints all dependencies that the present code references. 39 info Info prints information about this project 40 cache-clear, cc Clears the Glide cache. 41 about Learn about Glide 42 mirror Manage mirrors 43 help, h Shows a list of commands or help for one command 44 45GLOBAL OPTIONS: 46 --yaml value, -y value Set a YAML configuration file. (default: "glide.yaml") 47 --quiet, -q Quiet (no info or debug messages) 48 --debug Print debug verbose informational messages 49 --home value The location of Glide files (default: "/home/users/qiangmzsx/.glide") [$GLIDE_HOME] 50 --tmp value The temp directory to use. Defaults to systems temp [$GLIDE_TMP] 51 --no-color Turn off colored output for log messages 52 --help, -h show help 53 --version, -v print the version 54

看到这样,那就恭喜你,已经安装成功了!!!

使用

篇幅有限,我只介绍经常使用到的。 先进入在GOPATH的一个项目中。

cd $GOPATH/src/foor

初始化 (glide init)

1$ glide init 2[INFO] Generating a YAML configuration file and guessing the dependencies 3[INFO] Attempting to import from other package managers (use --skip-import to skip) 4[INFO] Scanning code to look for dependencies 5[INFO] --> Found reference to github.com/urfave/cli 6[INFO] Writing configuration file (glide.yaml) 7[INFO] Would you like Glide to help you find ways to improve your glide.yaml configuration? 8[INFO] If you want to revisit this step you can use the config-wizard command at any time. 9[INFO] Yes (Y) or No (N)? 10Y 11[INFO] Loading mirrors from mirrors.yaml file 12[INFO] Looking for dependencies to make suggestions on 13[INFO] --> Scanning for dependencies not using version ranges 14[INFO] --> Scanning for dependencies using commit ids 15[INFO] Gathering information on each dependency 16[INFO] --> This may take a moment. Especially on a codebase with many dependencies 17[INFO] --> Gathering release information for dependencies 18[INFO] --> Looking for dependency imports where versions are commit ids 19[INFO] Here are some suggestions... 20[INFO] The package github.com/urfave/cli appears to have Semantic Version releases (http://semver.org). 21[INFO] The latest release is v1.19.1. You are currently not using a release. Would you like 22[INFO] to use this release? Yes (Y) or No (N) 23Y 24[INFO] Would you like to remember the previous decision and apply it to future 25[INFO] dependencies? Yes (Y) or No (N) 26Y 27[INFO] Updating github.com/urfave/cli to use the release v1.19.1 instead of no release 28[INFO] The package github.com/urfave/cli appears to use semantic versions (http://semver.org). 29[INFO] Would you like to track the latest minor or patch releases (major.minor.patch)? 30[INFO] Tracking minor version releases would use '>= 1.19.1, < 2.0.0' ('^1.19.1'). Tracking patch version 31[INFO] releases would use '>= 1.19.1, < 1.20.0' ('~1.19.1'). For more information on Glide versions 32[INFO] and ranges see https://glide.sh/docs/versions 33[INFO] Minor (M), Patch (P), or Skip Ranges (S)? 34P 35[INFO] Would you like to remember the previous decision and apply it to future 36[INFO] dependencies? Yes (Y) or No (N) 37Y 38[INFO] Updating github.com/urfave/cli to use the range ~1.19.1 instead of commit id v1.19.1 39[INFO] Configuration changes have been made. Would you like to write these 40[INFO] changes to your configuration file? Yes (Y) or No (N) 41Y 42[INFO] Writing updates to configuration file (glide.yaml) 43[INFO] You can now edit the glide.yaml file.: 44[INFO] --> For more information on versions and ranges see https://glide.sh/docs/versions/ 45[INFO] --> For details on additional metadata see https://glide.sh/docs/glide.yaml/ 46$ ll 47glide.yaml 48$ cat glide.yaml 49package: foor 50import: [] 51

在初始化过程中, glide 会询问一些问题。 glide.yaml记载了依赖包的列表及其更新规则,每次执行 glide up 时,都会按照指定的规则(如只下载补丁(patch)不下载升级(minor))下载新版。

一个完整的gilde.yaml

1package: foor 2homepage: https://github.com/qiangmzsx 3license: MIT 4owners: 5- name: qiangmzsx 6 email: qiangmzsx@hotmail.com 7 homepage: https://github.com/qiangmzsx 8# 去除包 9ignore: 10- appengine 11- golang.org/x/net 12# 排除目录 13excludeDirs: 14- node_modules 15# 导入包 16import: 17- package: github.com/astaxie/beego 18 version: 1.8.0 19- package: github.com/coocood/freecache 20- package: github.com/garyburd/redigo/redis 21- package: github.com/go-sql-driver/mysql 22- package: github.com/bitly/go-simplejson 23- package: git.oschina.net/qiangmzsx/beegofreecache 24testImport: 25- package: github.com/smartystreets/goconvey 26 subpackages: 27 - convey

很多人看着yaml很不习惯,没事,我转一下json给大家看看。

1{ 2 "excludeDirs": [ 3 "node_modules" 4 ], 5 "owners": [ 6 { 7 "homepage": "https://github.com/qiangmzsx", 8 "name": "qiangmzsx", 9 "email": "qiangmzsx@hotmail.com" 10 } 11 ], 12 13 "license": "MIT", 14 "package": "foor", 15 "ignore": [ 16 "appengine", 17 "golang.org/x/net" 18 ], 19 "import": [ 20 { 21 "version": "1.8.0", 22 "package": "github.com/astaxie/beego" 23 }, 24 { 25 "package": "github.com/coocood/freecache" 26 }, 27 { 28 "package": "github.com/garyburd/redigo/redis" 29 }, 30 { 31 "package": "github.com/go-sql-driver/mysql" 32 }, 33 { 34 "package": "github.com/bitly/go-simplejson" 35 }, 36 { 37 "package": "git.oschina.net/qiangmzsx/beegofreecache" 38 } 39 ], 40 "testImport": [ 41 { 42 "subpackages": [ 43 "convey" 44 ], 45 "package": "github.com/smartystreets/goconvey" 46 } 47 ], 48 "homepage": "https://github.com/qiangmzsx" 49}

版本号指定规则

1=: equal (aliased to no operator) 2!=: not equal 3>: greater than 4<: less than 5>=: greater than or equal to 6<=: less than or equal to 7 81.2 - 1.4.5 which is equivalent to >= 1.2, <= 1.4.5 92.3.4 - 4.5 which is equivalent to >= 2.3.4, <= 4.5 101.2.x is equivalent to >= 1.2.0, < 1.3.0 11 12>= 1.2.x is equivalent to >= 1.2.0 13<= 2.x is equivalent to < 3 14* is equivalent to >= 0.0.0 15 16~1.2.3 is equivalent to >= 1.2.3, < 1.3.0 17~1 is equivalent to >= 1, < 2 18~2.3 is equivalent to >= 2.3, < 2.4 19~1.2.x is equivalent to >= 1.2.0, < 1.3.0 20~1.x is equivalent to >= 1, < 2 21 22^1.2.3 is equivalent to >= 1.2.3, < 2.0.0 23^1.2.x is equivalent to >= 1.2.0, < 2.0.0 24^2.3 is equivalent to >= 2.3, < 3 25^2.x is equivalent to >= 2.0.0, < 3

''指定版本报错,需要用''指定的可以不填写

安装依赖 (glide install)

glide.yaml我们已经准备好了,现在就改安装一下试试。

1$ glide install 2[ERROR] Failed to parse /home/users/xxxx/golang/src/foor/glide.yaml: yaml: invalid leading UTF-8 octet

报错了!别担心看看你的yaml文件是否为utf-8编码,不是就转换一下就好啦!

1$ glide install 2[INFO] Lock file (glide.lock) does not exist. Performing update. 3[INFO] Downloading dependencies. Please wait... 4[INFO] --> Fetching updates for github.com/go-sql-driver/mysql 5[INFO] --> Fetching updates for github.com/astaxie/beego 6[INFO] --> Fetching updates for github.com/coocood/freecache 7[INFO] --> Fetching updates for git.oschina.net/qiangmzsx/beegofreecache 8[INFO] --> Fetching updates for github.com/bitly/go-simplejson 9[INFO] --> Fetching updates for github.com/garyburd/redigo 10[INFO] --> Fetching updates for github.com/smartystreets/goconvey 11[INFO] --> Detected semantic version. Setting version for github.com/astaxie/beego to v1.8.0 12[INFO] Resolving imports 13[INFO] Downloading dependencies. Please wait... 14[INFO] Setting references for remaining imports 15[INFO] Exporting resolved dependencies... 16[INFO] --> Exporting github.com/astaxie/beego 17[INFO] --> Exporting github.com/coocood/freecache 18[INFO] --> Exporting github.com/bitly/go-simplejson 19[INFO] --> Exporting github.com/go-sql-driver/mysql 20[INFO] --> Exporting github.com/garyburd/redigo 21[INFO] --> Exporting github.com/smartystreets/goconvey 22[INFO] --> Exporting git.oschina.net/qiangmzsx/beegofreecache 23[INFO] Replacing existing vendor dependencies 24[INFO] Project relies on 6 dependencies. 25$ ll 26total 12 27glide.lock 28glide.yaml 29vendor 30$ ll vendor/ 31git.oschina.net 32github.com 33

看到glide.lock了吗,这个文件记载了依赖包确定的revision, 下次再执行 glide install 时,会直接读这个文件下载确定的版本。

升级版本 (glide up)

glide up 会按照语义化版本规则更新依赖包代码,开发过程中如果需要使用新版代码,可以执行这个命令: 修改一下glide.yaml中的一个Package.

1- package: github.com/astaxie/beego 2 version: 1.8.3

执行glide up。

1$ glide up 2[INFO] Downloading dependencies. Please wait... 3[INFO] --> Fetching updates for git.oschina.net/qiangmzsx/beegofreecache 4[INFO] --> Fetching updates for github.com/garyburd/redigo 5[INFO] --> Fetching updates for github.com/go-sql-driver/mysql 6[INFO] --> Fetching updates for github.com/astaxie/beego 7[INFO] --> Fetching updates for github.com/bitly/go-simplejson 8[INFO] --> Fetching updates for github.com/coocood/freecache 9[INFO] --> Fetching updates for github.com/smartystreets/goconvey 10[INFO] --> Detected semantic version. Setting version for github.com/astaxie/beego to v1.8.3 11[INFO] Resolving imports 12[INFO] Downloading dependencies. Please wait... 13[INFO] Setting references for remaining imports 14[INFO] Exporting resolved dependencies... 15[INFO] --> Exporting github.com/astaxie/beego 16[INFO] --> Exporting github.com/bitly/go-simplejson 17[INFO] --> Exporting github.com/garyburd/redigo 18[INFO] --> Exporting github.com/go-sql-driver/mysql 19[INFO] --> Exporting github.com/coocood/freecache 20[INFO] --> Exporting github.com/smartystreets/goconvey 21[INFO] --> Exporting git.oschina.net/qiangmzsx/beegofreecache 22[INFO] Replacing existing vendor dependencies 23[INFO] Project relies on 6 dependencies. 24

添加并下载依赖 (glide get)

除了自动从代码中解析 import 外,glide 还可以通过 glide get 直接下载代码中没有的依赖,与 go get 的用法基本一致:

1$ glide get github.com/orcaman/concurrent-map 2[INFO] Preparing to install 1 package. 3[INFO] Attempting to get package github.com/orcaman/concurrent-map 4[INFO] --> Gathering release information for github.com/orcaman/concurrent-map 5[INFO] --> Adding github.com/orcaman/concurrent-map to your configuration 6[INFO] Downloading dependencies. Please wait... 7[INFO] --> Fetching updates for github.com/garyburd/redigo 8[INFO] --> Fetching updates for github.com/astaxie/beego 9[INFO] --> Fetching updates for github.com/go-sql-driver/mysql 10[INFO] --> Fetching updates for git.oschina.net/qiangmzsx/beegofreecache 11[INFO] --> Fetching updates for github.com/bitly/go-simplejson 12[INFO] --> Fetching github.com/orcaman/concurrent-map 13[INFO] --> Fetching updates for github.com/coocood/freecache 14[INFO] --> Fetching updates for github.com/smartystreets/goconvey 15[INFO] Resolving imports 16[INFO] Downloading dependencies. Please wait... 17[INFO] --> Detected semantic version. Setting version for github.com/astaxie/beego to v1.8.3 18[INFO] Exporting resolved dependencies... 19[INFO] --> Exporting github.com/smartystreets/goconvey 20[INFO] --> Exporting github.com/garyburd/redigo 21[INFO] --> Exporting github.com/go-sql-driver/mysql 22[INFO] --> Exporting github.com/orcaman/concurrent-map 23[INFO] --> Exporting github.com/astaxie/beego 24[INFO] --> Exporting github.com/bitly/go-simplejson 25[INFO] --> Exporting github.com/coocood/freecache 26[INFO] --> Exporting git.oschina.net/qiangmzsx/beegofreecache 27[INFO] Replacing existing vendor dependencies 28

使用镜像 (glide mirror)

1[WARN] Unable to checkout golang.org/x/crypto 2[ERROR] Update failed for golang.org/x/crypto: Cannot detect VCS 3[ERROR] Failed to do initial checkout of config: Cannot detect VCS

这几行信息估计很多人都是遇到过的。在我天朝或者在公司内部都可能不能访问一些站点,导致很Golang的依赖包不能通过go get下载。此时也就是glide大发神威的时候到了,可以通过配置将墙了的版本库 URL 映射到没被墙的 URL,甚至也可以映射到本地版本库。 将golang.org映射到github: 修改glide.yaml加入

- package: golang.org/x/crypto

如果你的网络可以访问就不需要使用glide镜像功能,可以跳过。

1$ glide mirror set golang.org/x/crypto github.com/golang/crypto 2[INFO] golang.org/x/crypto being set to github.com/golang/crypto 3[INFO] mirrors.yaml written with changes 4$ glide up 5[INFO] Loading mirrors from mirrors.yaml file 6[INFO] Downloading dependencies. Please wait... 7[INFO] --> Fetching updates for github.com/orcaman/concurrent-map 8[INFO] --> Fetching golang.org/x/crypto 9[INFO] --> Fetching updates for github.com/astaxie/beego 10[INFO] --> Fetching updates for github.com/go-sql-driver/mysql 11[INFO] --> Fetching updates for github.com/garyburd/redigo 12[INFO] --> Fetching updates for github.com/coocood/freecache 13[INFO] --> Fetching updates for github.com/bitly/go-simplejson 14[INFO] --> Fetching updates for git.oschina.net/qiangmzsx/beegofreecache 15[INFO] --> Fetching updates for github.com/smartystreets/goconvey 16[INFO] --> Detected semantic version. Setting version for github.com/astaxie/beego to v1.8.3 17[INFO] Resolving imports 18[INFO] Downloading dependencies. Please wait... 19[INFO] Setting references for remaining imports 20[INFO] Exporting resolved dependencies... 21[INFO] --> Exporting github.com/astaxie/beego 22[INFO] --> Exporting github.com/coocood/freecache 23[INFO] --> Exporting github.com/smartystreets/goconvey 24[INFO] --> Exporting github.com/garyburd/redigo 25[INFO] --> Exporting github.com/go-sql-driver/mysql 26[INFO] --> Exporting github.com/bitly/go-simplejson 27[INFO] --> Exporting github.com/orcaman/concurrent-map 28[INFO] --> Exporting golang.org/x/crypto 29[INFO] --> Exporting git.oschina.net/qiangmzsx/beegofreecache 30[INFO] Replacing existing vendor dependencies 31[INFO] Project relies on 8 dependencies. 32$ ll vendor/ 33git.oschina.net 34github.com 35golang.org

终于看到golang.org啦!!! 细心的你一定已经发现了

[INFO]	mirrors.yaml written with changes

说明执行glide mirror时候镜像配置写入到的是$HOME/.glide/mirrors.yaml中,打开看看。

1repos: 2- original: golang.org/x/crypto 3 repo: github.com/golang/crypto 4

还可以映射到本地目录。 推荐大家可以去https://www.golangtc.com/download/package下载很多Golang类库。 现在我去下载了:https://www.golangtc.com/static/download/packages/golang.org.x.text.tar.gz,解压到本地目录/home/users/qiangmzsx/var/golang/golang.org/x/text

1$ glide mirror set golang.org/x/text /home/users/qiangmzsx/var/golang/golang.org/x/text 2[INFO] golang.org/x/text being set to /home/users/qiangmzsx/var/golang/golang.org/x/text 3[INFO] mirrors.yaml written with changes 4$ glide up 5[INFO] Loading mirrors from mirrors.yaml file 6[INFO] Downloading dependencies. Please wait... 7[INFO] --> Fetching golang.org/x/text 8[INFO] --> Fetching updates for github.com/garyburd/redigo 9[INFO] --> Fetching updates for git.oschina.net/qiangmzsx/beegofreecache 10[INFO] --> Fetching updates for github.com/astaxie/beego 11[INFO] --> Fetching updates for github.com/bitly/go-simplejson 12[INFO] --> Fetching updates for github.com/go-sql-driver/mysql 13[INFO] --> Fetching updates for github.com/coocood/freecache 14[INFO] --> Fetching updates for github.com/orcaman/concurrent-map 15[INFO] --> Fetching updates for golang.org/x/crypto 16[INFO] --> Fetching updates for github.com/smartystreets/goconvey 17[INFO] --> Detected semantic version. Setting version for github.com/astaxie/beego to v1.8.3 18[INFO] Resolving imports 19[INFO] Downloading dependencies. Please wait... 20[INFO] Setting references for remaining imports 21[INFO] Exporting resolved dependencies... 22[INFO] --> Exporting github.com/astaxie/beego 23[INFO] --> Exporting github.com/go-sql-driver/mysql 24[INFO] --> Exporting github.com/bitly/go-simplejson 25[INFO] --> Exporting github.com/coocood/freecache 26[INFO] --> Exporting github.com/smartystreets/goconvey 27[INFO] --> Exporting github.com/garyburd/redigo 28[INFO] --> Exporting github.com/orcaman/concurrent-map 29[INFO] --> Exporting golang.org/x/text 30[INFO] --> Exporting golang.org/x/crypto 31[INFO] --> Exporting git.oschina.net/qiangmzsx/beegofreecache 32[INFO] Replacing existing vendor dependencies 33[INFO] Project relies on 9 dependencies. 34

全局选项

运行glide,在最后就可以看到

1GLOBAL OPTIONS: 2 --yaml value, -y value Set a YAML configuration file. (default: "glide.yaml") 3 --quiet, -q Quiet (no info or debug messages) 4 --debug Print debug verbose informational messages 5 --home value The location of Glide files (default: "/home/users/qiangmzsx/.glide") [$GLIDE_HOME] 6 --tmp value The temp directory to use. Defaults to systems temp [$GLIDE_TMP] 7 --no-color Turn off colored output for log messages 8 --help, -h show help 9 --version, -v print the version

如果大家想把glide的yaml文件换别的默认名称可以执行

 $ glide -y qiangmzsx.yaml

在官网中会看到一个GLIDE_HOME变量,该变量就是/home/users/qiangmzsx/.glide。 这个目录之前有提到过,除了包含有mirrors.yaml还有一个很重要的目录cache本地 cache,每次更新代码时, glide 都会在本地保存 cache,以备下次 glide install 使用 。

GLIDE_HOME可以通过如下命令修改。

 $ glide  --home /home/glide 

总结

除了上述说到的功能,glide还有很多好的功能,后续有机会在写出来吧。
总结一下,glide是一款功能丰富,完全满足需求的依赖管理工具,强烈大家使用。

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )

Golang依赖管理工具:glide从入门到精通使用 - HelloWorld