Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

How to distinguish between a go and gb project? #93

Closed
fatih opened this issue May 14, 2015 · 5 comments
Closed

How to distinguish between a go and gb project? #93

fatih opened this issue May 14, 2015 · 5 comments

Comments

@fatih
Copy link

fatih commented May 14, 2015

Say we have our code inside a src folder:

~/foo/src/github.com/fatih/color

Our root folder is:

~/foo

Can we say that this is a gb project if all or some of followings are true:

  1. $GB_PROJECT_DIR is equal to ~/foo
  2. $GOPATH is not equal to ~/foo
  3. There is a vendor folder in the form of: ~/foo/src/vendor (I'm not sure about this though,there might be a source code that doesn't have any kind of vendorized code, thus not vendor folder at all)

I have a function to find out the root project folder of a given go file, however I need to be sure I'm dealing with a gb project. Because it might be also a file inside a $GOPATH.

This clarifications are needed so I can make godef and many other tools automatically play nice with gb project. For example godef should jump to the vendored file inside the $PROJECT instead of to a file inside $GOPATH

In the docs it says: A gb project is a folder on disk that contains a sub directory named src/. This explanation is also true for any $GOPATH go project.

@davecheney
Copy link
Contributor

Sorry for the brief reply, mobile.

The project directory is ~/foo/, not ~/foo/src/. The project detection rule
says the project root is the parent of a directory called src/

On Fri, 15 May 2015 08:12 Fatih Arslan notifications@github.com wrote:

Say we have our code inside a src folder:

~/foo/src/github.com/fatih/color

Our root folder is:

~/foo/src

Can we say that this is a gb project if all or some of followings are true:

  1. $GB_PROJECT_DIR is equal to ~/foo/src
  2. $GOPATH is not equal to ~/foo/src
  3. There is a vendor folder in the form of: ~/foo/src/vendor

I have a function to find out the root project folder of a given go file,
however I need to be sure I'm dealing with a gb project. Because it might
be also a file inside a $GOPATH.

This clarifications are needed so I can make godef and many other tools
automatically play nice with gb file. For example godef should jump to
the vendored file inside the $PROJECT instead of to a file inside $GOPATH


Reply to this email directly or view it on GitHub
#93.

@fatih
Copy link
Author

fatih commented May 14, 2015

Totally right, I've fixed the paths. The questions are still valid.

@davecheney
Copy link
Contributor

I'll take a look when I get home.

On Fri, 15 May 2015 09:04 Fatih Arslan notifications@github.com wrote:

Totally right, I've fixed the paths. The questions are still valid.


Reply to this email directly or view it on GitHub
#93 (comment).

@fatih
Copy link
Author

fatih commented May 15, 2015

Relates issue #53.

@davecheney
Copy link
Contributor

I believe that gb info contains all the information needed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants