[go-nuts] Re: strings and when to use them

2017-05-10 Thread Zachary Kaplan
Thanks On Wednesday, May 10, 2017 at 2:21:54 PM UTC-7, Val wrote: > > Hello Zachary > Stdin and os.Args are quite different. > If your wrote a go program named "kaplan", then when running the following > command on a unix-like system (linux, or OSX) : > > cat bigphoto.jpg | kaplan sepia downsca

[go-nuts] Re: Runtime code generation?

2017-05-10 Thread Erwin Driessens
You could let your application generate valid Go source, call the compiler to build a plugin, and load that plugin. I haven't tried that yet, but i think it should work. Downside is that you need to Go tools on the target machine for it to work. I don't know how many times you have to generate

Re: [go-nuts] Re: adding context.Context to new code

2017-05-10 Thread Sameer Ajmani
Our approach was to identify function calls that consume a Context (indicated by a call to context.TODO in the function body) and function calls that provide a Context (such as RPC and HTTP handlers). Then we use the guru callgraph tool to find all call paths from context providers to context consu

[go-nuts] Re: [ANN] gocog - generate code in any language, for any language

2017-05-10 Thread jarble
This project looks very similar to GSL , which generates source code in multiple programming languages. On Wednesday, January 16, 2013 at 2:23:37 PM UTC-5, Nate Finch wrote: > > https://github.com/natefinch/gocog > > of course, right now it only supports Go as a

[go-nuts] Re: [ANN] gocog - generate code in any language, for any language

2017-05-10 Thread jarble
This project looks very similar to [GSL](https://github.com/imatix/gsl), which generates source code in multiple programming languages. On Wednesday, January 16, 2013 at 2:23:37 PM UTC-5, Nate Finch wrote: > > https://github.com/natefinch/gocog > > of course, right now it only supports Go as

[go-nuts] Re: strings and when to use them

2017-05-10 Thread Val
Hello Zachary Stdin and os.Args are quite different. If your wrote a go program named "kaplan", then when running the following command on a unix-like system (linux, or OSX) : cat bigphoto.jpg | kaplan sepia downscale > result.jpg you have os.Args[0]=="kaplan", os.Args[1]=="sepia", os.Args[

[go-nuts] Re: Creating shared-libraries which override existing system functions?

2017-05-10 Thread tonywalker . uk
Excellent - thanks Donovan. Alas I've since discovered that since the program I want to preload is compiled using Go - it doesn't use libc and LD_PRELOAD won't work with it. But - a useful lesson either way. Cheers. -- You received this message because you are subscribed to the Google Groups "

[go-nuts] Re: Is it ok to separate Open and Close logic?

2017-05-10 Thread yuechuan . chen
I would say don't do it unless there's something that you need to do and has no other way of doing so. Separating into functions require all calls to DoStuff() follows a call of CleanUp() somewhere down the path. it's difficult to maintainable and can cause subtle bugs (if not careful) when th

[go-nuts] strings and when to use them

2017-05-10 Thread Zachary Kaplan
in golang, strings are immutable. thus, if i want to modify a string in place, i'll need to cast or copy each element from the string to a similar but mutable data structure. this seems inefficient for simple command line programs that take input from stdin and access it through os.Args. can so

Re: [go-nuts] Load dylib without using cgo on macOS?

2017-05-10 Thread Ian Lance Taylor
On Wed, May 10, 2017 at 7:53 AM, wrote: > > Is it possible to load a dylib without using cgo on macOS? Not to my knowledge. > On Windows it looks like I can do this using this package: > > https://godoc.org/golang.org/x/sys/windows#LoadDLL Yes, it is true that Windows works differently. Ian

[go-nuts] Load dylib without using cgo on macOS?

2017-05-10 Thread bogdan . diverse
Is it possible to load a dylib without using cgo on macOS? On Windows it looks like I can do this using this package: https://godoc.org/golang.org/x/sys/windows#LoadDLL I am trying to avoid using cgo and also be able to load DLLs written in other languages into my Go app. Any pointers would be

[go-nuts] [ANN] scaffolder - web application servers to order

2017-05-10 Thread Simon Ritchie
Given a JSON description of some database tables, the scaffolder tool creates the database and generates a web application server to manage it. The resulting app server implements the Create, Read, Update and Delete (CRUD) operations on the tables. The idea for the scaffolder comes from the Ru

Re: [go-nuts] Re: Runtime code generation?

2017-05-10 Thread YD Jiang
Thanks for the clarification. On Wed, May 10, 2017 at 10:34 PM Ian Lance Taylor wrote: > On Wed, May 10, 2017 at 12:19 AM, wrote: > > > > Why we can't generate executable memory segments? JIT runtimes just doing > > this I think. > > Generating executable memory segments in a language that sup

[go-nuts] Is it ok to separate Open and Close logic?

2017-05-10 Thread st ov
Most examples of opening and closing a file have both calls in the same function func DoFileStuff() { file, _ := os.Open("file") defer file.Close() // do stuff with file } This makes sure any open file is closed. But how common is it to separate that logic into functions? Should this be

Re: [go-nuts] accidental 'testing' import

2017-05-10 Thread Brian Fallik
Hi, On Wed, May 10, 2017 at 11:10 AM, Jan Mercl <0xj...@gmail.com> wrote: > On Wed, May 10, 2017 at 5:01 PM Brian Fallik wrote: > >> Or would this make sense as >> an external tool, and does one already exist? > > Maybe grep of the output of 'go list' may be helpful: > https://golang.org/cmd/go/#

Re: [go-nuts] accidental 'testing' import

2017-05-10 Thread Jan Mercl
On Wed, May 10, 2017 at 5:01 PM Brian Fallik wrote: > Or would this make sense as > an external tool, and does one already exist? Maybe grep of the output of 'go list' may be helpful: https://golang.org/cmd/go/#hdr-List_packages -- -j -- You received this message because you are subscribed

[go-nuts] accidental 'testing' import

2017-05-10 Thread Brian Fallik
Hi, Every 6 months or so a developer on our team will inadvertently import a package that establishes an import chain from a production binary to the 'testing' package. This is a potential problem for a few reasons. It makes the binaries larger, it pollutes the cli flags with testing flags, it inc

[go-nuts] Re: [ANN] Gobot v1.5.0 released

2017-05-10 Thread howardcshaw
Might want to mention what that IS so people know whether they care to click link. Gobot is 'Next generation robotics/IoT framework with support for 29 different platforms' according to their website. (IoT is Internet of Things, meaning internet-connected appliances/tools/non-traditional compu

Re: [go-nuts] Re: Runtime code generation?

2017-05-10 Thread Ian Lance Taylor
On Wed, May 10, 2017 at 12:19 AM, wrote: > > Why we can't generate executable memory segments? JIT runtimes just doing > this I think. Generating executable memory segments in a language that supports converting integers to pointers opens up a wide attack surface in a buggy program. An attacker

[go-nuts] Re: Runtime code generation?

2017-05-10 Thread jan4984
Why we can't generate executable memory segments? JIT runtimes just doing this I think. On Sunday, September 1, 2013 at 9:23:11 AM UTC+8, Alan Donovan wrote: > > On Friday, 30 August 2013 16:21:18 UTC-4, jzs wrote: > >> Hi gophers, >> >> I was studying runtime code generation and was wondering if

[go-nuts] AWS CodeBuild with govendor

2017-05-10 Thread Kareem Hepburn
Anyone here have a buildspec they can share for CodeBuild with govendor? I'm currently in a loss and can't seem to get my buildspec to work. Here's my build spec: version: 0.1 environment_variables: plaintext: APP_NAME: "boomboom" PACKAGE: "github.com/BoomBoom/boomboom" GO_VERSION:

[go-nuts] [ANN] Gobot v1.5.0 released

2017-05-10 Thread Ron Evans
Hello, fellow gophers We've just released Gobot v1.5.0 please check out the blog post here: https://gobot.io/blog/2017/05/10/gobot-1.5-on-pins-and-boards/ Thank you to everyone who helped on this release, and to the Golang community for your continued support! -- You received this message bec