Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Go的版本管理之路
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
ipfans
October 27, 2018
Programming
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Go的版本管理之路
2018中国计算机大会现代编程语言专场演讲内容
ipfans
October 27, 2018
Transcript
33 slides
Go的包依赖管理理之路路 Kevin
02 05 01 04 03 演讲⼤大纲 为什什么需要包依赖管理理 Go的包依赖管理理之路路 官⽅方引⼊入vendor go
mod介绍 案例例分享
02 05 01 04 03 演讲⼤大纲 为什什么需要包依赖管理理 Go的包依赖管理理之路路 官⽅方引⼊入vendor go
mod介绍 案例例分享
包依赖 package main import "github.com/astaxie/beego" func main() { beego.Run() }
依赖
第三⽅方依赖
代码管理理 我们编写⾃自⼰己的代码 我们引⽤用别⼈人的代码 然后…
package golang.org/x/net/context: unrecognized import path "golang.org/x/net/context" (https fetch: Get https://golang.org/x/net/context?go-get=1:
dial tcp 216.58.221.241:443: i/o timeout) Go 下载依赖错误
"dependencies": { "antd": "^3.0.2", "axios": "^0.18.0", "babel-polyfill": "^6.26.0", "ckeditor": "^4.9.2",
"classnames": "^2.2.6", "color": "^3.0.0", "copy-text-to-clipboard": "^1.0.4", "dayjs": "^1.7.2", } { "require": { "monolog/monolog": "1.0.*" } } 其他语⾔言的依赖管理理 PHP Node
02 05 01 04 03 演讲⼤大纲 为什什么需要包依赖管理理 Go的包依赖管理理之路路 官⽅方引⼊入vendor go
mod介绍 案例例分享
$GOPATH
$GOPATH by Google’s way
$GOPATH $GOPATH ├── bin ├── pkg └── src ├── google.golang.org
│ └── grpc │ ├── README.md │ ├── backoff.go │ ├── balancer │ │ ├── balancer.go .....
$GOPATH go主程序提供的get命令功能 ⽀支持git/svn/mercurial/bazzar 默认下载主分⽀支
$GOPATH 我们如何保证构建⼀一定是稳定构建?
API Breaking Changes?
gopkg.in 使⽤用Github托管仓库 语义化版本管理理发布 只能根据⼤大版本选择
$GOPATH 多个项⽬目依赖不不同版本的仓库A怎么办?
02 05 01 04 03 演讲⼤大纲 为什什么需要包依赖管理理 Go的包依赖管理理之路路 官⽅方引⼊入vendor go
mod介绍 案例例分享
vendor
vendor 1.5: ⾸首次引⼊入,默认关闭(2015年年中) 1.6: 默认开启,可选关闭(2016年年中) 1.7: 永久开启,⽆无法关闭(2016年年底)
基于vendor的包管理理 https://github.com/golang/go/wiki/PackageManagementTools
vendor 新引⼊入包B⽆无法兼容已存在的包A怎么办? 同⼀一依赖的同⼀一版本冗余了了怎么办? 我们为什什么⼀一定需要$GOPATH?
02 05 01 04 03 演讲⼤大纲 为什什么需要包依赖管理理 Go的包依赖管理理之路路 官⽅方引⼊入vendor go
mod介绍 案例例分享
go mod (vgo) Go 1.11版本正式引⼊入 不不强制位于$GOPATH 相同依赖项多版本管理理 ⽀支持语义化版本管理理
go mod (vgo) V
借助go.mod⽂文件管理理版本 go mod (vgo)
借助go.mod⽂文件管理理版本 go mod (vgo)
依赖引⽤用路路径查询 go mod (vgo)
便便捷的已有项⽬目迁移 go mod (vgo)
go mod (vgo) 中⼼心化的仓库成为可能
02 05 01 04 03 演讲⼤大纲 为什什么需要包依赖管理理 Go的包依赖管理理之路路 官⽅方引⼊入vendor go
mod介绍 案例例分享
None
None
More Decks by ipfans
See All by ipfans
Event Modeling: 新项目沟通方式
ipfans
0
76
TDD, BDD and Beyond
ipfans
0
120
Go最差实践
ipfans
0
65
现代方式使用asyncio
ipfans
0
150
Other Decks in Programming
See All in Programming
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
150
LLM 101: Exploring LLMs, Starting with Tokens.
dalinaum
0
110
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
270
Beyond Chatbots: Agentic UI with Open Standards @W-JAX 2026, München
manfredsteyer
PRO
0
110
はじめてのPLATEAU
nokonoko1203
1
660
AIがコードを書いてくれる時代、我々は何を確かめるのか
yosuke_furukawa
PRO
13
6.1k
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
200
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
350
Scalaの型でマルチテナントの認可を守る
nextbeatdev
0
160
React Native에 현대적인 빌드 도구 더하기: Rollipop 구현기
leegeunhyeok
0
180
なぜ私たちは「現時点では」KMPの導入を見送ったのか
chigichan24
1
300
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
220
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7.1k
Exploring anti-patterns in Rails
aemeredith
4
570
How to make the Groovebox
asonas
2
2.6k
Automating Front-end Workflow
addyosmani
1370
210k
Balancing Empowerment & Direction
lara
6
1.4k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
580
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
810
Marketing to machines
jonoalderson
1
6k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k