Go Manager - bundle for go

Overview

gom - Go Manager

Build Status

Why

The go get command is useful. But we want to fix the problem where package versions are different from the latest update. Are you going to do go get -tags=1.1 ..., go get -tag=0.3 for each of them? We want to freeze package version. Ruby's bundle is awesome.

Installation

go get github.com/mattn/gom

Gomfile

gom 'github.com/mattn/go-runewidth', :tag => 'go1'
gom 'github.com/mattn/go-scan', :commit => 'ecb144fb1f2848a24ebfdadf8e64380406d87206'
gom 'github.com/daviddengcn/go-colortext'
gom 'github.com/mattn/go-ole', :goos => 'windows'

# Execute only in the "test" environment.
group :test do
    gom 'github.com/mattn/go-sqlite3'
end

# Execute only for the "custom_group" group.
group :custom_group do
    gom 'github.com/golang/lint/golint'
end

By default gom install install all packages, except those in the listed groups. You can install packages from groups based on the environment using flags (development, test & production) : gom -test install

Custom groups my be specified using the -groups flag : gom -test -groups=custom_group,special install

Usage

Create _vendor directory and bundle packages into it

gom install

Build on current directory with _vendor packages

gom build

Run tests on current directory with _vendor packages

gom test

Generate .travis.yml that uses gom test

gom gen travis-yml

You can always change the name relative to the current $GOPATH directory using an environment variable: GOM_VENDOR_NAME

$ # to use a regular $GOPATH/src folder you should specify GOM_VENDOR_NAME equal '.'
$ GOM_VENDOR_NAME=. gom <command>

Tutorial

Writing Gomfile and bundle

$ ls
main.go

$ gom gen gomfile

$ cat Gomfile
gom 'github.com/daviddengcn/go-colortext'
gom 'github.com/mattn/go-runewidth'

$ gom install
installing github.com/daviddengcn/go-colortext
installing github.com/mattn/go-runewidth

$ find \_vendor/src -maxdepth 2
\_vendor/src
\_vendor/src/github.com
\_vendor/src/github.com/daviddengcn
\_vendor/src/github.com/mattn

$ gom build

If you want to bundle specified tag, branch or commit

gom 'github.com/mattn/go-runewidth', :tag => 'tag_name'
gom 'github.com/mattn/go-runewidth', :branch => 'branch_name'
gom 'github.com/mattn/go-runewidth', :commit => 'commit_name'

If you want to bundle a repository that go get can't access

gom 'github.com/username/repository', :command => 'git clone http://example.com/repository.git'

If you want to change local repository directory with command 'git clone', also skipdep and insecure, which is useful in internal network environment.

gom 'github.com/username/repository', :private => 'true', :target => 'repository', :insecure=>'true', :skipdep=>'true' 

Todo

  • Documentation

Author

Yasuhiro Matsumoto [email protected]

License

MIT: http://mattn.mit-license.org/2013

Comments
  • Why the ruby syntax?

    Why the ruby syntax?

    I know this is a design decision, but I feel that it should be more like go. It seems less intuitive to have something written in go, for go, that looks like ruby simply because it was inspired by a ruby tool.

    opened by voronoipotato 41
  • Go 1.6, gom and vendor packages

    Go 1.6, gom and vendor packages

    Hi @mattn

    I noticed that using go1.6, gom install places all vendor packages in a vendor folder (rather than _vendor), which I understand it's now the Go1.6 default location.

    Within the vendor folder, gom places my all the vendor modules outside the src directory, which is not created anymore. When I try to build my go project, an error is thrown since go expects my vendor modules to live in vendor/src/github.com/etc rather than vendor/github.com/etc

    Is this an issue with gom, go1.6 or my current set up?

    Thanks!

    opened by queeno 24
  • Can not work in Go1.7 and more?

    Can not work in Go1.7 and more?

    Hello. @mattun @h3poteto

    Vendoring could not work in my project. I got this package(gom) and built my project today.

    I think that this fix may be inappropriate. https://github.com/mattn/gom/pull/81

    When did vendoring behavior change? I could not find this release note. If you can, I would like to teach me. https://blog.golang.org/go1.7

    Sincerely,

    -- detail Using version is 1.7.3

    GOPATH setting

    GOPATH=/path/to/project:/path/to/project/lib
    

    Error sample

    app/app.go:26:2: cannot find package "github.com/labstack/echo" in any of:
        /path/to/project/src/vendor/github.com/labstack/echo (vendor tree)
        /usr/local/go/src/github.com/labstack/echo (from $GOROOT)
        /path/to/project/src/github.com/labstack/echo (from $GOPATH)
        /path/to/project/lib/src/github.com/labstack/echo
    

    --

    英語だと説明不足感があるので日本語で補足します。 下記バージョンだと、Go1.7.3の環境においてvendor/でビルドできました。 https://github.com/mattn/gom/commit/393e714d663c35e121a47fec32964c44a630219b

    プルリクエスト(#81)のエラーを見ていると、vendor treeに関するエラー表示がないため、 build/install時にvendorへの参照がおこなわれていないのではないかと思います。 (おそらくGOPATHにvendorが含まれている)

    確認いただけると、助かります。 よろしくお願いします。

    opened by shamaton 17
  • gom lock

    gom lock

    I think, there is bug in gom/gen.go

            if isDir(filepath.Join(p, ".git")) {
                vcs = git
            } 
    

    Gomfile:

    gom 'github.com/aws/aws-sdk-go/aws'
    gom 'github.com/aws/aws-sdk-go/aws/awserr'
    gom 'github.com/aws/aws-sdk-go/aws/awsutil'
    gom 'github.com/aws/aws-sdk-go/aws/client'
    gom 'github.com/aws/aws-sdk-go/aws/client/metadata'
    gom 'github.com/aws/aws-sdk-go/aws/corehandlers'
    gom 'github.com/aws/aws-sdk-go/aws/credentials'
    gom 'github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds'
    gom 'github.com/aws/aws-sdk-go/aws/defaults'
    gom 'github.com/aws/aws-sdk-go/aws/ec2metadata'
    gom 'github.com/aws/aws-sdk-go/aws/request'
    gom 'github.com/aws/aws-sdk-go/aws/session'
    gom 'github.com/aws/aws-sdk-go/private/endpoints'
    gom 'github.com/aws/aws-sdk-go/private/protocol/query'
    gom 'github.com/aws/aws-sdk-go/private/protocol/query/queryutil'
    gom 'github.com/aws/aws-sdk-go/private/protocol/rest'
    gom 'github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil'
    gom 'github.com/aws/aws-sdk-go/private/signer/v4'
    gom 'github.com/aws/aws-sdk-go/service/sns'
    

    but .git dir is only on level https://github.com/aws/aws-sdk-go/.

    opened by reinerRubin 12
  • 'gom install' failed on Go 1.6 with GO15VENDOREXPERIMENT=0

    'gom install' failed on Go 1.6 with GO15VENDOREXPERIMENT=0

    % go version
    go version go1.6.3 linux/amd64
    % echo $GO15VENDOREXPERIMENT
    0
    % gom install
    downloading github.com/mattn/gover
    downloading github.com/hashicorp/go-version
    downloading github.com/daviddengcn/go-colortext
    gom:  open /home/syohei/go/src/github.com/mattn/gom/_vendor/src: no such file or directory
    % echo $?
    1
    
    opened by syohex 11
  • Fixed failed `gom install`

    Fixed failed `gom install`

    https://github.com/mattn/gom/issues/66

    Add ignore package

    ignore ex)
    github.com/hoge/fuga/examples
    github.com/hoge/fuga/examples/hoga
    github.com/foo/bar/_test
    github.com/foo/bar/_test/baz
    
    opened by yudppp 9
  • gom install --save

    gom install --save

    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
    
    opened by guileen 9
  • Proposal: rename vendor to _vendor

    Proposal: rename vendor to _vendor

    go tools ignore filenames that start with _ (and .). With current name of vendor subdirectory command go test ./... if run in repository root would go inside vendor subdirectory, find packages there and launch tests, which is usually not desired. The same applies to gom test ./... of course, and things like go tool vet.

    If vendor is renamed to _vendor, this should make ./... work as expected again.

    I can submit pull request if it sounds ok. Probably this could be configured in Gomfile?

    opened by smira 8
  • Weird error when a package is already in $GOPATH

    Weird error when a package is already in $GOPATH

    Hi,

    I'm trying gom, but I found a weird error. If I have already installed a package with go install (for example github.com/jrallison/go-workers), and then I create a Gomfile with:

    gom 'github.com/jrallison/go-workers', :commit => 'f9540adf4c3635a54663b9c55671b54de77d19fc'
    

    If I run gom install, it fails with a weird error:

    $ gom install
    installing github.com/jrallison/go-workers
    gom:  gom currently support git/hg for specifying tag/branch/commit
    

    And vendor/ remains empty.

    opened by nono 8
  • Allow custom groups to be specified in the Gomfile.

    Allow custom groups to be specified in the Gomfile.

    Greetings! I have a use case that would require using various groups in my Gomfile. The logic for environments and groups is very similar, but I need more than three options. For example, depending on os/go versions, Travis builds seem to fail if we try to fetch tools from the new urls (golang.org/x), but we don't want to overload "test" and "development" to specify these build differences.

    This PR suggests a solution using custom group names in addition to the three environments. This would allow many new combinations of Goms by specifying one or more groups in the install command. e.g.

    $ gom install -test -groups=test_golang_org
    
    # fetches from golang.org
    group :test_golang_org do
      gom 'golang.org/x/tools/cmd/vet'
      gom 'golang.org/x/tools/cmd/cover'
    end
    
    # fetches from code.google.com
    group :test_google_com do
      gom 'code.google.com/p/go.tools/cmd/vet'
      gom 'code.google.com/p/go.tools/cmd/cover'
    end
    
    group :test do
      gom 'gopkg.in/check.v1'
      gom 'github.com/golang/lint/golint'
      gom 'github.com/onsi/ginkgo/ginkgo'
      gom 'github.com/onsi/gomega'
    end
    

    Please let me know what you think. Thanks!

    opened by kevinhankens 7
  • Adds support of Go 1.6+ and 1.7+.

    Adds support of Go 1.6+ and 1.7+.

    @mattn Go 1.6 supports vendoring by default, so GO15VENDOREXPERIMENT env should not be required to use vendor/ directory.

    Previously, gom uses _vendor/ directory even with Go version is 1.6+. See: http://akirachiku.com/2016/03/01/go16-development.html#vendoring (Japanese)

    gom should use vendor/ directory with Go 1.6+ by default. But when GO15VENDOREXPERIMENT=0 is explicitly set with Go <= 1.6 && >1.7 , gom should use _vendor/ (or GOM_VENDOR_NAME when it's set) because vendoring is not supported by Go itself.

    Quote from https://golang.org/doc/go1.6#go_command :

    Go 1.5 introduced experimental support for vendoring, enabled by setting the GO15VENDOREXPERIMENT environment variable to 1. Go 1.6 keeps the vendoring support, no longer considered experimental, and enables it by default. It can be disabled explicitly by setting the GO15VENDOREXPERIMENT environment variable to 0. Go 1.7 will remove support for the environment variable.

    opened by laysakura 6
  • `gom gen gomfile` does not generate dependencies for subdirectories

    `gom gen gomfile` does not generate dependencies for subdirectories

    When I run gom gen gomfile, it does not generate the dependencies of the subdirectories, while go get does download dependencies of them. No error was occurred.

    Is it intended or a bug?

    bug 
    opened by medicalwei 0
  • gom install with :command

    gom install with :command

    gom file:

    gom 'git.xxx.com/xx/pfsdk', :command => 'git clone [email protected]:xx/pfsdk'
    

    First time i exec gom install ,it works fine, but i exec it again ,it report an error: fatal: destination path '/path/to/_vendor/src/git.xxx.com/xx/pfsdk' already exists and is not an empty directory

    opened by jheroy 1
  • Install part of repository with custom :command

    Install part of repository with custom :command

    I use gom mostly for use our mirrored repository. for example (since Iran's firewall blocked bitbucket.org for any reason that I don't know and can't understand) we mirror the goose repository in a locally installed gitlab repository (go get can not understand gitlab :/ ). now this line :

    gom 'bitbucket.org/liamstask/goose/cmd/goose', :command => 'git clone http://example.com/mirrors/goose.git'
    

    is not working. its clone the repo inside the src/bitbucket.org/liamstask/goose/cmd/goose which is not correct. Also this :

    gom 'bitbucket.org/liamstask/goose', :command => 'git clone http://example.com/mirrors/goose.git'
    

    Is failed. since there is no go file in root of this repository. (this repository is just an example, and we have this problem with some other repository too)

    Is there anything I can do to fix this? any hack or even a feature that I can implement, please let me know.

    Thanks.

    opened by fzerorubigd 0
Owner
mattn
Long-time Golang user&contributor, Google Dev Expert for Go, and author of many Go tools, Vim plugin author. Windows hacker C#/Java/C/C++
mattn
A simple dependency manager for Go (golang), inspired by Bundler.

Goop A dependency manager for Go (golang), inspired by Bundler. It is different from other dependency managers in that it does not force you to mess w

Peter Jihoon Kim 779 Sep 27, 2022
Barebones dependency manager for Go.

Go Package Manager Go Package Manager (or gpm, for short) is a tool that helps achieve reproducible builds for Go applications by specifying the revis

pote 1.2k Nov 7, 2022
Barebones dependency manager for Go.

Johnny Deps Johnny Deps is a small tool from VividCortex that provides minimalistic dependency versioning for Go repositories using Git. Its primary p

VividCortex 214 Sep 27, 2022
Golang Version Manager

g 注意:master分支可能处于开发之中并非稳定版本,请通过tag下载稳定版本的源代码,或通过release下载已编译的二进制可执行文件。 g是一个Linux、macOS、Windows下的命令行工具,可以提供一个便捷的多版本go环境的管理和切换。 特性 支持列出可供安装的go版本号 支持列出已安

voidint 874 Nov 26, 2022
🦄 Easy, fast and open-source local package manager for Python!

Unikorn ?? Easy, fast and open-source local package manager for Python! Key Features Speed: You can add a package in one second.

Penguen 6 Dec 11, 2021
gPac - a linux package manager

gPac is a useless package manager. It is included in the gSuite, which is a suite of tools written in GO. gPac is a KISS - like package manager.

Luis 4 Mar 13, 2022
GoFish is a cross-platform systems package manager, bringing the ease of use of Homebrew to Linux and Windows.

GoFish is a cross-platform systems package manager, bringing the ease of use of Homebrew to Linux and Windows.

Fishworks 813 Nov 18, 2022
Package manager for future projects

PCKGER is a package manager for my next project but when it will be able to build binaries and move libs it will be used like a normal package manager

null 0 Dec 20, 2021
gobin is a package manager for /go/bin

gobin gobin is a package manager for /go/bin Features List installed packages. Check for updates. Install packages (like go install). Uninstall packag

Andrey Burov 18 Nov 12, 2022
📦 An independent package manager for compiled binaries.

stew An independent package manager for compiled binaries. Features Easily distribute binaries across teams and private repositories. Get the latest r

Marwan Hawari 113 Dec 4, 2022
Bundle k6 with extensions as fast and easily as possible

xk6bundler xk6bundler is a CLI tool and GitHub Action makes bundle k6 with extensions as fast and easily as possible. Features Build for multiple targ

Iván Szkiba 10 Nov 29, 2022
Flashbots utilities in Go: Blocks & Transactions API, and tools to spot bundle and block irregularities

Utilities for Flashbots Go API client for the mev-blocks API for information about Flashbots blocks and transactions Detect bundle errors: (a) out of

Chris Hager 39 Nov 26, 2022
Ruleguard ruleset bundle for testify.

Ruleguard ruleset bundle for testify.

tdakkota 3 Nov 17, 2021
Package filippo.io/intermediates embeds a bundle of known unexpired, unrevoked intermediate certificates chaining to roots in the Mozilla Root Program

filippo.io/intermediates Package intermediates embeds a list of known unexpired, unrevoked intermediate certificates chaining to roots with Websites t

Filippo Valsorda 50 Nov 7, 2022
Go Package Manager (gopm) is a package manager and build tool for Go.

?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? In favor of Go Modules Proxy since Go 1.11, this pr

Go Package Manager 2.5k Dec 1, 2022
painless task queue manager for shell commands with an intuitive cli interface (execute shell commands in distributed cloud-native queue manager).

EXEQ DOCS STILL IN PROGRESS. Execute shell commands in queues via cli or http interface. Features Simple intuitive tiny cli app. Modular queue backend

Mohammed Al Ashaal 12 Jan 29, 2022
Terraform Provider for Azure (Resource Manager)Terraform Provider for Azure (Resource Manager)

Terraform Provider for Azure (Resource Manager) Version 2.x of the AzureRM Provider requires Terraform 0.12.x and later, but 1.0 is recommended. Terra

null 0 Oct 16, 2021
Go Version Manager

gvm By Josh Bussdieker (jbuss, jaja, jbussdieker) while working at Moovweb Currently lovingly maintained by Benjamin Knigge Pull requests and other an

Moovweb 8k Dec 6, 2022
Go package that interfaces with AWS System Manager

go-aws-ssm Go package that interfaces with AWS System Manager. Why to use go-aws-ssm and not the aws-sdk-go? This package is wrapping the aws-sdk-go a

Paddle 52 Nov 12, 2022
A dead simple configuration manager for Go applications

Store Store is a dead simple configuration manager for Go applications. I didn't like existing configuration management solutions like globalconf, tac

Ian P Badtrousers 264 Nov 13, 2022