Giter Club home page Giter Club logo

nitrogen's Introduction

nitrogen

DEPRECATION NOTICE

nitrogen has fulfilled its purpose, as a mean to provide a temporary solution to the lack of ways to manage dependencies of programs written in Go, until the release of a tool on which the community would find agreement.

With the release of Go 1.6, vendoring support is no longer considered experimental and it's the default way to handle dependencies, so the use of a dependency manager outside the Go standard tools is not necessary anymore.

nitrogen will be deprecated with the release of Go 1.6. Support for bug fixes will be provided till the release of Go 1.7, then nitrogen will be no longer maintained and this repository will be kept only for reference.

Thanks to everyone who took part, used or sent corrections to the project.


nitrogen is a simple dependency manager for Go.

It is a bash script that you should distribute with your Go package. Nitrogen leverages on the git, hg, and bzr versioning systems, so you don't need to distribute the full dependecy tree with your package, the standard gopath mechanism just works well.

Set up dependencies

Dependencies are listed in a file called 'deps' that is located in the same directory of nitrogen (i.e. your package root directory). Dependencies are formatted as "package version", where "package" is the name of the Go package that you need to install (e.g "golang.org/x/crypto/blowfish") and "version" is every suitable option for git checkout, hg update or bzr revert -r.

e.g.

code.google.com/p/go-uuid -c 35bc42037350
golang.org/x/crypto 4ed45ec682102c643324fae5dff8dab085b6c300

Hey, I just want to freeze dependecies at the current version!

That's why nitrogen has a '-f' (--freeze) option.

nitrogen -f

You should find your dependencies listed in the generated 'deps' file.

Install dependencies

To install a package with the required dependencies, download it with

go get -d PACKAGE

Then, from the package root, start nitrogen with '-i' (--install).

nitrogen -i

Nitrogen downloads the required dependencies and installs the package with dependencies at the specified versions, then it restores the dependencies back to the default (master branch or latest version) versions.

If you want to mantain the dependencies at the version required by your package, instead launch it with '-i --no-clean'

nitrogen -i --no-clean

After you have done with the work on your package, restore the depencencies at the default versions with the '-c' (--clean) option.

nitrogen -c

License

nitrogen is released under the MIT License.

nitrogen's People

Contributors

lucachr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nitrogen's Issues

Duplicate dep paths for subdirectories within same git project

I'm using the stretchr codecs and see the following duplicated lines in the deps file...

github.com/stretchr/codecs 8e29b38960a541ed1264b001dcb21701283c590d
github.com/stretchr/codecs 8e29b38960a541ed1264b001dcb21701283c590d
github.com/stretchr/codecs 8e29b38960a541ed1264b001dcb21701283c590d
github.com/stretchr/codecs 8e29b38960a541ed1264b001dcb21701283c590d
github.com/stretchr/codecs 8e29b38960a541ed1264b001dcb21701283c590d
github.com/stretchr/codecs 8e29b38960a541ed1264b001dcb21701283c590d
github.com/stretchr/codecs 8e29b38960a541ed1264b001dcb21701283c590d
github.com/stretchr/codecs 8e29b38960a541ed1264b001dcb21701283c590d
github.com/stretchr/codecs 8e29b38960a541ed1264b001dcb21701283c590d

I could probably run the deps file through a sort | uniq command to de-dupe the file before processing.

Better errors when version is not available

I updated deps manually and run nitrogen -i. However, the specified commit was not downloaded yet. I think nitrogen just quit early. It would be great to display an error or run go get -uautomatically.

Unable to go install root directory with no go files

Issues with go projects with no base *.go files, for example:

golang.org/x/crypto f7445b17d61953e333441674c2d11e91ae4559d3

package golang.org/x/crypto
    imports golang.org/x/crypto
    imports golang.org/x/crypto: no buildable Go source files in /Users/owen/projects/go/src/golang.org/x/crypto

This is because there are no *.go files in the root directory of the repos.

$ /projects/go/src/golang.org/x/crypto
$ ls
AUTHORS     README      cast5       nacl        outupt      salsa20     twofish
CONTRIBUTORS    bcrypt      curve25519  ocsp        pbkdf2      scrypt      xtea
LICENSE     blowfish    hkdf        openpgp     poly1305    sha3        xts
PATENTS     bn256       md4     otr     ripemd160   ssh

For now, I commented out the last steps of install

function install {
    # If something goes wrong, bring repositories to the
    # standard version.
    trap clean SIGHUP SIGINT SIGTERM

    fmap go_get $DEP_FILE

    fmap select_version $DEP_FILE

   # cd $PKG_DIR
   # echo "install: $(strip_gopath $PKG_DIR)"
   # go install

    if [[ "$1" == '--no-clean' ]]; then
        exit 0
    fi

    # All right, clean reposiories and return
    clean    
}

Careful with mktemp

bash version on OS X requires something more like this on line 49 to work on different platforms. This will work on Ubuntu and OS X nicely.

    new=$(mktemp -t /tmp/nitro.XXXXXX)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.