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

cmd/gb: gb info report pkg path and bin suffix #369

Merged
merged 1 commit into from
Sep 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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