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

Commit

Permalink
cmd/gb: gb info report pkg path and bin suffix
Browse files Browse the repository at this point in the history
Fixes #366

```
% gb info
GB_PROJECT_DIR="/Users/dfc"
GB_SRC_PATH="/Users/dfc/src:/Users/dfc/vendor/src"
GB_PKG_DIR="/Users/dfc/pkg/darwin-amd64"
GB_BIN_SUFFIX="-darwin-amd64"
```
  • Loading branch information
davecheney committed Sep 16, 2015
1 parent edba66a commit 0075444
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/gb/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ info returns 0 if the project is well formed, and non zero otherwise.
func info(ctx *gb.Context, args []string) error {
fmt.Printf("GB_PROJECT_DIR=%q\n", ctx.Projectdir())
fmt.Printf("GB_SRC_PATH=%q\n", joinlist(ctx.Srcdirs()...))
fmt.Printf("GB_PKG_DIR=%q\n", ctx.Pkgdir())
fmt.Printf("GB_BIN_SUFFIX=%q\n", ctx.Suffix())
return nil
}

Expand Down
10 changes: 10 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ func (c *Context) Pkgdir() string {
return filepath.Join(c.Project.Pkgdir(), c.ctxString())
}

// Suffix returns the suffix (if any) for binaries produced
// by this context.
func (c *Context) Suffix() string {
suffix := c.ctxString()
if suffix != "" {
suffix = "-"+suffix
}
return suffix
}

// Workdir returns the path to this Context's working directory.
func (c *Context) Workdir() string { return c.workdir }

Expand Down

0 comments on commit 0075444

Please sign in to comment.