[Go語言] 本地儲存被import的套件


Reddit看到的問題 [1] ,有人問到:

問: 如果有人刪除了他們的GitHub repository該怎麼辦?

答:利用 go mod -vendor 可以把套件存到本地 /vendor 目錄下。 然後在最後建構時, go build -vendor 利用本地 /vendor 目錄下的套件來建構, 而不是透過網路去抓取套件建構。

問: 如果有人更新了他們在GitHub上的程式碼以致無法建構該怎麼辦?

答: go mod 會固定套件版本,除非你告訴它去更改套件版本。


另外有 Go Modules 的快速上手指南,請看 [15] [21]


參考:

[1]Dependency management in Go : golang
[2]Utterly confused with Golang and its setup. : golang
[3]Is this performance normal? : golang
[4]OAuth server library with Password Credentials Support (like IdentityServer for .NET) : golang
[5]Emulating a Nintendo DS in Go (video) : golang
[6]Tool to show type hierarchy for Go pkg : golang
[7]Building Web Servers in Go : golang
[8]GOPATH will not set? : golang
[9]Reimport: a simple go files import match/replace tool using go/parser : golang
[10]Examples of well architected, large webapps : golang
[11]Is MVC a good pattern in Go? : golang
[12]Neural Net in Golang... And how : golang
[13]Is there a central and standard place where all the Go packages can be found? : golang
[14]go is pass-by-value, does that mean each function call makes a copy of all params? : golang
[15]Just tell me how to use Go Modules : golang
[16]Advent 2018: Bringing Sanity to your Dependencies with Go Modules and Athens : golang
[17]Go and vim in harmony – Joe Meli – Medium : golang
[18]My first program with Go - A program that takes snapshots of subreddits and stores them in a database. : golang
[19]A smarter way of Iterating a map? : golang
[20]Vue.js and Go example project : golang
[21]Migrating to go mod in just 3 steps : golang
[22]Go Modules in 2019 : golang
[23]Go project file structure? : golang
[24]Is there something like NPM or Cargo in Go? : golang
[25]Tutorial to create/manage properly a project in golang, basic informations ? : golang
[26]Nice to hear even GCC people are starting to use Golang instead of Python : golang
[27]GoLang Text-To-Speech and vi-versa : golang
[28]Clean Architecture Sample Code : golang
[29]Which web development platform to use in 2018? : golang
[30]GitHub - shivamMg/rd: Build recursive descent parsers : golang
[31]Session management! Take 3! : golang
[32]Advent 2018: Introducing Glot the plotting library for Go : golang
[33]What kind of projects do you implement with Go at work? : golang
[34]Confused about channels and select statement. : golang
[35]Why aren't unused func args a compiler error? : golang
[36]When is concurrency helpful to me? : golang
[37]Go web server project directory structure with clear design : golang
[38]Please share your Emacs setup ... : golang
[39]Versioning your API in Go : golang
[40]Awesome Golang Security - Security related resources for Golang : golang