natefinch / gorram Goto Github PK
View Code? Open in Web Editor NEWIt's like go run for any go function
License: MIT License
It's like go run for any go function
License: MIT License
e.g. github.com/foo/bar/DialServer("1.2.3.4").Versions()"
e.g. gorram time RFC822
Assumes package name is always the same as the last part of the import path
generate help text from godoc, converted to make sense with the gorram CLI.
gorram foo/bar.V2.Baz is ambiguous. Is the import path foo/bar.V2 and the function Baz, or is the import path foo/bar with a global variable V2 with a method Baz?
It would be great to be able to get an instant micro-benchmark
of a function.
For example:
% gorram -bench math Sqrt 1000
2000000000 0.31 ns/op 0 B/op 0 allocs/op
Gorram should realize when a variable is a function and enable you to call that function:
var Bar = func() { fmt.Println("Hi!") }
Use a go template to format the output val
e.g. gorram encoding/json.Indent -o foo.go
I use gorram to print the current time, is it possible to format it as RFC3339?
should be able to handle variadics we otherwise handle
e.g. gorram package varname key
i.e. generate but not run
% gorram os Stdout.Write 'hello world'
os/Stdout.Write.go:48: undefined: val
Holy gtobal variables batman!
This is just a matter of remembering to use .Underlying() judiciously, but still represents work that needs to be done.
We should stamp the generated code with a version number so that we know if it should be regenerated automatically.
I get the following when trying to install:
$ go get npf.io/gorram
# npf.io/gorram/run
../go/src/npf.io/gorram/run/command.go:18: cannot use buf (type "golang.org/x/tools/go/types".Type) as type "go/types".Type in argument to "go/types".NewPointer:
"golang.org/x/tools/go/types".Type does not implement "go/types".Type (wrong type for Underlying method)
have Underlying() "golang.org/x/tools/go/types".Type
want Underlying() "go/types".Type
../go/src/npf.io/gorram/run/command.go:21: cannot use prog.Package("io").Pkg.Scope().Lookup("Reader").Type() (type "golang.org/x/tools/go/types".Type) as type "go/types".Type in assignment:
"golang.org/x/tools/go/types".Type does not implement "go/types".Type (wrong type for Underlying method)
have Underlying() "golang.org/x/tools/go/types".Type
want Underlying() "go/types".Type
../go/src/npf.io/gorram/run/command.go:22: cannot use prog.Package("io").Pkg.Scope().Lookup("Writer").Type() (type "golang.org/x/tools/go/types".Type) as type "go/types".Type in assignment:
"golang.org/x/tools/go/types".Type does not implement "go/types".Type (wrong type for Underlying method)
have Underlying() "golang.org/x/tools/go/types".Type
want Underlying() "go/types".Type
../go/src/npf.io/gorram/run/command.go:121: cannot use pkg (type *"golang.org/x/tools/go/types".Package) as type *"go/types".Package in argument to getFunc
$ go version
go version go1.7 darwin/amd64
Doesn't currently compile
$ go install npf.io/gorram
# npf.io/gorram
./main.go:21: undefined: cli.Run
$ go version
go version go1.7.1 linux/amd64
Demonstrated with
package sillytest
var Example = func() int { println("sup"); return 5 }
When upgrading to a new version, allow people to run a single command that'll upgrade all old scripts. Not strictly necessary, but might be nice if you want to avoid that first-run sluggishness.
Seriously, it is awesome. Love stuff like this. +1
It may be intractable for many cases... it's basically impossible to know if a user that types 25 as an argument means 25 the int or "25" a string.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.