mattn/gom

gom install --save

Closed this issue · 9 comments

In node.js package manager npm, I can do

npm install --save koa
npm install --save-dev should.js

It will add dependencies to package.json automatically. It will be very cool if gom can install and then add dependencies to Gomfile.

gom install --save github.com/mattn/gom
gom install --save-dev  github.com/xxxx/testing/assert
mattn commented
$ gom gen gomfile

gom scan dependencies and generate Gomfile. Do you mean this?

@mattn I know this command, but gen gomfile can only works for existing project. When I start a new project, I am coding, and I notice I miss something, then I install it, and continue work. But I forgot to add my dependencies to gomfile.

I think install and auto save to gomfile will not break my work.

When I use node.js start a new project, I cd to the project folder, and ran npm init, it generate an basic package.json, when I need something, I just ran npm install --save xxxx.

mattn commented

So, you want following?

  • scan code
  • find extra-packages from GOPATH
  • put gom into Gomfile with commit-id that you have in GOPATH

Yes, put the gom into Gomfile with the commit-id of the package what I just installed.

+1 have same problem

mattn commented

try last commit. gom install -save may work. Note that this experimental feature overwrite your Gomfile. please try it after backup your files.

Well, I think it is not that nice to put ids of commits directly in to Gomfile. Better approach is to follow ruby bundler's way. Create a Gomfile.lock and put current system's state in to it. This file should be committed and every developer will be able to fetch exactly same version you have. lock file might even be in some suitable format like JSON or even gob :) why not? People should not be able to edit it and its' update should be done via gom commands, like gom update for example.
Just some things I really miss from ruby world.

mattn commented

@cthulhu did you try latest commit?

Yes, sorry last ones looks like exactly like I want :). I was using that tool for a while and my version don't have it. Will upgrade and test it. Thanks a lot!