sourcegraph/gopathexec

Name: gopathexec

Owner: Sourcegraph

Description: gopathexec executes program with arguments, while expanding $GOPATH with multiple workspaces into multiple arguments.

Created: 2015-06-30 02:06:08.0

Updated: 2015-07-03 23:45:18.0

Pushed: 2015-07-02 22:16:27.0

Homepage:

Size: 112

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

gopathexec Build Status GoDoc

Command gopathexec executes program with arguments, while expanding $GOPATH with multiple workspaces into multiple arguments.

Usage: gopathexec program [args]

It is helpful for writing go generate directives for programs that do not understand import paths, but you need to specify include paths that are other Go package folders.

For example, consider a go generate directive like this:

//go:generate protoc -I$GOPATH/src/github.com/gogo/protobuf/protobuf --go_out=. sample.proto

That will only work if your GOPATH env var happens to contain one workspace. By prepending the above command with gopathexec:

//go:generate gopathexec protoc -I$GOPATH/src/github.com/gogo/protobuf/protobuf --go_out=. sample.proto

It will effectively execute:

protoc -I/workspace1/src/github.com/gogo/protobuf/protobuf -I/workspace2/src/github.com/gogo/protobuf/protobuf --go_out=. sample.proto

If you have 1 or no GOPATH workspaces, gopathexec executes the given program and arguments without modification.

Installation
et -u sourcegraph.com/sourcegraph/gopathexec
License

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.