Proposal for a repo with a sub package (the version is always specific
to the repo not the sub-package):
import "github.com/ungerik/go-start/views@06c43ac7fe"
The string after @ could be anything that identifies a version or a
date.
It should also be possible to specify a branch. Here a format proposal
for a branch at a given date and time:
import "github.com/ungerik/go-start@mybranch:2012-04-01T23:00"
go get github.com/ungerik/go-start@mybranch:2012-04-01T23:00
I really don't think that having those import statments in the code
would be usefull.
I think that the master should always be green and compatible with
previous versions, if you need to break that it's better to have a
separated repo for the incompatible changes.
That way old code will always run and new code can use the new
features of the given library.
What we have in Go is better than what we could have with something
similar to maven.
--
André Moraes
http://andredevchannel.blogspot.com/
The 1% is the hardest one and changing so many things to reach the
100% is a difficult decision to make.
Sure, but compare these:
Use a version number inside every single import on every single file
Use a version number inside a file where you really need the specific
version and leave the rest to the default master
Use a different import path
Using a different import path looks easier than the others two,
off-course it has drawbacks:
The maintainer need to be carefull with the master branch.
API changes must be backward compatible
If a new API is required, then the user MUST start a new project under
a different path.
Sure, but compare these:
Use a version number inside every single import on every single file
Use a version number inside a file where you really need the specific
version and leave the rest to the default master
Use a different import path
That's why i suggest using different import paths, they solve the
problem by simply giving different names to different things.
Also, imports are local to the file, so, A.go import (pkg/ver1) and
B.go import (pkg/ver2) they have access to different things
That's why i suggest using different import paths, they solve the> Another problem:
> what if pkgA/fileA.go import version1 of pkgB, and pkgA/fileB.go doesn't say
> which version it
> imports? What if pkgA/fileB.go imports a different version2 of pkgB?
problem by simply giving different names to different things.
Also, imports are local to the file, so, A.go import (pkg/ver1) and
B.go import (pkg/ver2) they have access to different things
Yes, and this is valid, since if they came from different places they
should be different things.
For example, if both versions tries to register a database driver in
database/sql, then if they had the same name they would conflict and
panic.
>
> The problem become harder when you import pkgA and pkgB without knowing
> that pkgA also imports a different version of pkgB and your import of pkgB
> and
> pkgA's can't interoperate (because they are different instance).
This is true, but if the user MUST use different versions of the same
package, then he should be aware of those problems.
I don't advocate for using multiple versions of one package, but if
this is required than the current behavior of go is explicty and safe
(as much as possible).
+1
> The problem become harder when you import pkgA and pkgB without knowingThis is true, but if the user MUST use different versions of the same
> that pkgA also imports a different version of pkgB and your import of pkgB
> and
> pkgA's can't interoperate (because they are different instance).
package, then he should be aware of those problems.
I don't understand what the problem is.2012/4/4 minux <minu...@gmail.com>2012/4/3 André Moraes <and...@gmail.com>> The problem become harder when you import pkgA and pkgB without knowingThis is true, but if the user MUST use different versions of the same
> that pkgA also imports a different version of pkgB and your import of pkgB
> and
> pkgA's can't interoperate (because they are different instance).
package, then he should be aware of those problems.The user might not be aware of it. He might simply want to import "pkgA" and "pkgB",and is totally unaware the fact that pkgA uses a specific version of pkgB, and so pkgAcan't interoperate with user's import of pkgB (and what's worse, it might even result inruntime panic as you've said), that would be quite a surprise to the user (who presumablydon't know pkgA's internals).If you really want a specific version of some package, just control it yourself, I don'tthink 'go get' could manage all these complexities.Let's say you are importing "repo.com/usera/pkgA@2.0" and "repo.com/userb/pkgB", which imports "repo.com/usera/pkgA@1.0". Then, the go tool would build pkg/.../repo.com/usera/pk...@2.0.a and pkg/.../repo.com/usera/pk...@1.0.a checking different versions of the repository, but they would be different packages.
Mee to, that's why I am against that change.
Most people misunderstand the idea behind the "go" tool, especially "go get",
Like you said "go get" couldn't handle all those variations and the
best way to do that is simply to force the person to know about what
is installed.
Probably, the best way to see "go get" is: A tool to checkout
repositories under GOPATH and nothing more.
Making "go get" aware of versions would make monster.
2012/4/4 André Moraes <and...@gmail.com>:
Have read the dozen or so previous threads about this topic?
-j
Of course it would be wonderful if all dependency developers everywhere were good, perfect citizens, and never made breaking changes or had a bug in the repo tip.It would be wonderful for this to be impossible: http://forums.thedailywtf.com/forums/t/27755.aspxBut we all know this isn't the world we live in. Dependency versions have to be able to be handled, or using this just won't work. At all.
I get that we can't and shouldn't try to solve the transitive dependency problem but one thing strikes me as odd in the discussion about backwards incompatible changes. Why should we need to create a new directory or even a new repository for this? This is precisely what _version_ control systems was made for. You tag a certain version of the software and you know that you or anyone else can use that tag if they need it. It seems really counter intuitive to be forced (ok not really forced) to duplicate the vcs's function especially when it does it so well.
And also having an @ syntax or something else simple (?tag=v1.2 to keep url syntax) and default to todays behaviour makes for a quite nice way to at least be able to control this if needed. I am fine with build fail if a transitive clash is detected because then we have bigger problems that have to be handled manually which is much more preferable to today when me, my colleauge and our CI server all can have different "versions" of a dependency.
--
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...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/0avuiWURSQk/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
Is the script used standalone or as part of a fabric invocation? Fabric noob here. Looks straight forward but i lack fabric knowledge.
We use Fabric(a Python library and command-line tool) to handle that;code is the best comment :)DEPENDENCIES=( 'github.com/kr/pretty@195524255c32890818bd298d996e3dbe353fcb57', 'github.com/bmizerany/assert@e17e99893cb6509f428e1728281c2ad60a6b31e3', 'github.com/axw/gocov@bcb74f1fa6b05c843cb7888551bc3ca4096ec473', 'github.com/alecthomas/gozmq@9e15b37d7d6fe08a1a31b678d4e7eaa488986a2e', ) def init(): '''Updateing dependencies''' for dep in DEPENDENCIES: _go_get(dep) def _go_get(pkg): if '@' in pkg: git_repo, git_hash = pkg.split('@') pkgpath = os.path.join(GOPATH, 'src', git_repo) _git_pull(git_repo, pkgpath) _git_update(pkgpath, git_hash) def _git_pull(pkg, pkgpath): if os.path.isdir(os.path.join(pkgpath, '.git')): title('pulling %s from origin master' % pkg) with lcd(pkgpath): local('git pull origin master') else: title('cloning %s to %s' % (pkg, pkgpath)) scheme = 'http' if pkg.startswith('code.google.com') or pkg.startswith('github.com'): scheme = 'https' local('git clone %s://%s.git %s' %(scheme, pkg, pkgpath)) def _git_update(pkgpath, revision): with lcd(pkgpath): local('pwd') local('git checkout -q %s' %revision)