constabulary / gb

gb, the project based build tool for Go
https://getgb.io/
MIT License
2.15k stars 150 forks source link

Vendor command only works if gb is in PATH #685

Open chris-martin opened 7 years ago

chris-martin commented 7 years ago

I don't normally keep my Go bin directory in my PATH, so I tried to run gb vendor restore as ~/go/bin/gb vendor restore, and it fails in a rather confusing way:

$ ~/go/bin/gb vendor restore
FATAL: unknown command "vendor"
gb, a project based build tool for the Go programming language.

Usage:

        gb command [arguments]

The commands are:

        build       build a package
        doc         show documentation for a package or symbol
        env         print project environment variables
        generate    generate Go files by processing source
        info        info returns information about this project
        list        list the packages named by the importpaths
        test        test packages

Use "gb help [command]" for more information about a command.

Additional help topics:

        plugin      plugin information
        project     gb project layout

Use "gb help [topic]" for more information about that topic.
davecheney commented 7 years ago

gb-vendor is a separate command, it's a git style plugin. The expectation is people will use the installation instructions on the website to build both programs into the GOPATH at once.

I'm not sure what to do to resolve this issue.

On Wed, 4 Jan 2017, 09:04 Chris Martin notifications@github.com wrote:

I don't normally keep my Go bin directory in my PATH, so I tried to run gb vendor restore as ~/go/bin/gb vendor restore, and it fails in a rather confusing way:

$ ~/go/bin/gb vendor restore FATAL: unknown command "vendor" gb, a project based build tool for the Go programming language.

Usage:

    gb command [arguments]

The commands are:

    build       build a package
    doc         show documentation for a package or symbol
    env         print project environment variables
    generate    generate Go files by processing source
    info        info returns information about this project
    list        list the packages named by the importpaths
    test        test packages

Use "gb help [command]" for more information about a command.

Additional help topics:

    plugin      plugin information
    project     gb project layout

Use "gb help [topic]" for more information about that topic.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/constabulary/gb/issues/685, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAcA3BB_ZPR61M-BfQ-MJuP_LjrO8L9ks5rOsW0gaJpZM4LaE_r .

chris-martin commented 7 years ago

Oh, I see. Is there a reason gb-vendor can't work on its own instead of failing like this?

$ ~/go/bin/gb-vendor restore
FATAL: don't run this binary directly, it is meant to be run as 'gb vendor ...'
davecheney commented 7 years ago

It expects an environment variable set by gb to know the base of the project. I guess it could be changed to detect the project itself, or at least tell you the env var that it is missing.

On Wed, Jan 4, 2017 at 10:41 AM, Chris Martin notifications@github.com wrote:

Oh, I see. Is there a reason gb-vendor can't work on its own instead of failing like this?

$ ~/go/bin/gb-vendor restore FATAL: don't run this binary directly, it is meant to be run as 'gb vendor ...'

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/constabulary/gb/issues/685#issuecomment-270257204, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAcA9Tb8x-N4QfJ_7qO5IPMMdJRAiE3ks5rOtyngaJpZM4LaE_r .

chris-martin commented 7 years ago

Alright, thanks for clarifying. Fine by me if you want to close the issue.

coolaj86 commented 5 years ago

I have $HOME/go/bin in my $PATH.

I also have $GOPATH set to $HOME/go.

Yet I'm getting the same error. Any thoughts?

davecheney commented 5 years ago

Is there a $HOME/go/bin/gb ?

On 1 September 2018 at 08:38, AJ ONeal notifications@github.com wrote:

I have $HOME/go/bin in my $PATH.

I also have $GOPATH set to $HOME/go.

Yet I'm getting the same error. Any thoughts?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/constabulary/gb/issues/685#issuecomment-417806437, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAcA4sp9kTEf8pwpc5NzTLJ0Wa4TYOyks5uWbrKgaJpZM4LaE_r .