On Tuesday, October 11, 2016 at 5:55:23 AM UTC-7, Peter Vypov wrote: > > This question has been asked here a number of times, but the last time a > few months ago: are there any plans to add support for package versioning > (understanding VCS tags in the import paths), that is to teach `go get` to > pull specified version (tag) of the package rather than the most recent > version? As an alternative to storing packages in /vendor. > > My suggestion would be similar to Mr. McVetta's in > https://groups.google.com/forum/#!searchin/golang-nuts/package$20versioning%7Csort:relevance/golang-nuts/-65WPrNcT3U/5w1mkmE-4BsJ, > > but specifying the version as a comment tag rather than in the import path. > This should be sufficient to prevent importing two different versions of > the same package. > > import ( > ... > "github.com/spf13/cobra" // v0.8.0 > "github.com/spf13/viper" // v1.10.0 > ) >
My view is that the general case requires putting such metadata in a separate file for a package. For example, an obvious problem case - what if you have multiple source files in the package? I suspect that's where the Go Package Management team ends up. So my guess is that any convention / language standard around putting such versioning comments in to the source files would only be considered / settled after the current package management efforts nail down that metadata file. Two possible use cases come to mind: 1) Convenience over using a separate file for stating dependencies. 2) Support for "go run" type usage that automatically fetches dependencies.... The first case seems to be antithetical to the Go design principles of keeping language features orthogonal, and avoiding having multiple ways of doing the same thing. The second case seems possibly interesting, but implies a lot of mechanism for a rare case. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.