Re: [go-nuts] Lazy Bash redirection

2017-08-26 Thread Hugo Torres
Thanks. I'll check out those tools now.

On Sat, Aug 26, 2017 at 3:33 AM Jakob Borg  wrote:

> I think your best bet is to open a TTY manually when you detect that
> stdout is not a tty. You can use for example
> https://github.com/mattn/go-isatty to determine this. An
> `os.Open("/dev/tty")` might be enough, otherwise a package like
> https://github.com/mattn/go-tty shows some of the setup you might need to
> do. You then give this file as the stdout file descriptor to vim.
>
> Clearly this only works on systems that have a /dev/tty, but you're
> already limited to system that have a vim so this might be fine.
>
> //jb
>
>
> > On 26 Aug 2017, at 07:58, juicemia  wrote:
> >
> > Hi everybody.
> >
> > I don't know if this question has been asked before, partially because I
> don't really even know what to call what I'm trying to do.
> >
> > The best I can come up with is that I'm trying to do lazy redirection in
> bash but I'm having some trouble.
> >
> > A concrete example should help explain:
> >
> > I have a Go program. Part of this program's execution is to open up Vim
> for some editing. The user can then save and close, and the program will
> continue working using the user's input into Vim.
> >
> > That works well. However, it breaks down when I do something like the
> following:
> >
> > program | grep 'foo'
> >
> > When I do this, Vim complains about stdout not being a terminal. I
> realize this is because the pipe redirects the stdout of program to the
> stdin of grep _before_ the execution of program, not after.
> >
> > Is there any way I can get the redirection to happen _after_ program has
> executed?
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to golang-nuts+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Domain-driven design and go

2017-08-18 Thread Hugo Torres
Hi everybody,

Recently I've been reading "Domain Driven Design" and I think it has some 
useful stuff about organizing Go programs.

I wrote some of my thoughts up on my blog here 
.

Would love to know what everybody thinks.

Thanks,

Hugo

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: studying golang code

2017-08-16 Thread Hugo Torres
One of the things I love about Go is that the standard library is very 
readable, even for beginners (relative to the standard libraries of other 
languages).

I think the database/sql package is great. The way it uses interfaces to 
handle testing is a good example of good quality code IMO.

On Tuesday, August 15, 2017 at 5:42:45 PM UTC-4, Keith Brown wrote:
>
> Coming from Python, I was told to use study Twisted Matrix code 7 years. I 
> haven't regretted it.  Take a look at it yourself, 
> http://twistedmatrix.com/documents/16.1.0/core/howto/trial.html . 
>
> Now, as I learn golang, are there any worth while projects I can use as 
> reference for writing high quality go code? I am not necessary looking for 
> code standards but more of code setup and quality so I can practice those 
> principles.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.