• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Dependency Management in Go
 

Dependency Management in Go

on

  • 2,140 views

Golang Taipei Gathering #2

Golang Taipei Gathering #2

Statistics

Views

Total Views
2,140
Views on SlideShare
1,470
Embed Views
670

Actions

Likes
2
Downloads
12
Comments
0

9 Embeds 670

http://devpoga.wordpress.com 506
http://devpoga.wordpress.com. 79
http://news.google.com 69
http://cloud.feedly.com 4
http://summary 4
https://twitter.com 4
http://translate.googleusercontent.com 2
http://www.linkedin.com 1
http://prlog.ru 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Dependency Management in Go Dependency Management in Go Presentation Transcript

    • Dependency Management in Go Poga
    • A KickStarter
    • Haunts • Open Source • https://github.com/runningwild/haunts • Written in Go • https://github.com/go-gl/gl • Screwed by dependency hell
    • import "github.com/go-gl/gl" go get "github.com/go-gl/gl"
    • • $GOPATH/ • src/ • github.com/ • go-gl/ • gl/ • ... • pkg/ • bin/ import "github.com/go-gl/gl"
    • import path • 3 in 1 • remote repo url • local package install path • package name
    • go get go get "github.com/go-gl/gl"
    • go get git clone go install += go get "github.com/go-gl/gl"
    • go get (the git clone part) • can’t specify version • looks for tag/branch name matching your go version • if no such exist, it goes for the most recent version/master branch • won’t update cloned repo by default • use -u
    • go get (the go install part) • build/install to $GOPATH • first path in $GOPATH if it contains multiple paths • weird behavior when package names conflict
    • go 對你的 package 有所期待
    • expectation of go • green master policy • always backward compatible • remote repo url = local install path = package name
    • BUT • People make mistakes • repos may change their name/location, or removed • same package, different import paths • Dependency Hell • what if your project depends on version A and a dependency needs version B? • different versions, same import paths
    • Haunts • dependency renamed • dependency becomes backward incompatible • developer lost local installed version • developer make local changes and didn’t push upstream
    • Solutions • Manage Dependencies by yourself • ... or with some tools • centralized package management
    • DIY • $GOPATH/ • src/ • github.com/ • USER/ • PROJECT/ • ... • vender/ • github.com/ • go-gl/ • gl • $GOPATH/ • src/ • github.com/ • USER/ • PROJECT/ • ... • go-gl/ • gl/ • ...
    • import "github.com/USER/PROJECT/vendor/github.com/go-gl/gl" http://camlistore.org/ use this solution rewrite import path with a python script
    • DIY Update • git submodule • http://git-scm.com/book/en/Git-Tools-Submodules • git subtree merge • http://git-scm.com/book/en/Git-Tools-Subtree-Merging
    • Tools • Goven • https://github.com/kr/goven • copy local packages into project path • and remove .git/ • rewrite import paths
    • Tools • Gopin • https://github.com/laher/gopin • download specified version
    • Tools • Rx • https://github.com/kylelemons/rx • track repos and their tags • update to a specified tag • automatically run tests for dependents • rollback if something is broken • save current versioning setup as a config • share this config with your team
    • Centralized Package Management • Go Nuts • gonuts.io • import “gonuts.io/vendor/nut” • import “gonuts.io/vendor/nut/version” • currently host 11 package only
    • My Conclusion • No perfect way (now) • use Camlistore way • vender 3rd-party dependencies • rewrite import path with makefile/scripts/goven • go/parser will be helpful
    • Thank you Q&A?