Browse Source

Initial commit

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main v0.0.1
jolheiser 2 weeks ago
commit
327e5a541b
Signed by: jolheiser GPG Key ID: B853ADA5DA7BBF7A
  1. 2
      .gitignore
  2. 19
      LICENSE
  3. 15
      README.md
  4. 3
      go.mod
  5. 32
      main.go

2
.gitignore

@ -0,0 +1,2 @@
.idea/
/gogo*

19
LICENSE

@ -0,0 +1,19 @@
Copyright (c) 2021 John Olheiser
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

15
README.md

@ -0,0 +1,15 @@
# GoGo
Go, but with _gadgets_!
GoGo wraps the normal Go toolchain, however it enables a few tweaks.
## Gadgets
When invoking `gogo`, first it checks for a binary in `PATH` with a special name based on the first argument.
For example, `gogo magic` will look for a binary called `go-magic` in `PATH` and execute it with any remaining arguments.
## License
[MIT](LICENSE)

3
go.mod

@ -0,0 +1,3 @@
module go.jolheiser.com/gogo
go 1.17

32
main.go

@ -0,0 +1,32 @@
package main
import (
"log"
"os"
"os/exec"
)
func main() {
binPath, err := exec.LookPath("go")
if err != nil {
log.Println("go cannot be found in PATH")
return
}
args := os.Args
if len(args) > 1 {
args = args[1:]
if extPath, err := exec.LookPath("go-" + args[0]); err == nil {
binPath = extPath
if len(args) > 1 {
args = args[1:]
}
}
}
bin := exec.Command(binPath, args...)
bin.Stdin = os.Stdin
bin.Stdout = os.Stdout
bin.Stderr = os.Stderr
_ = bin.Run()
}
Loading…
Cancel
Save