Re: [go-nuts] Lazy Bash redirection

2017-08-26 Thread juicemia
Thanks! I'll have a look at those.

On Saturday, August 26, 2017 at 3:33:31 AM UTC-4, 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 <hugo.to...@gmail.com > 
> 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...@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] Lazy Bash redirection

2017-08-25 Thread juicemia
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.


[go-nuts] Re: Domain-driven design and go

2017-08-22 Thread juicemia
Yeah that repo is really informative. I think it's a great source of info 
on the topic.

On Tuesday, August 22, 2017 at 1:24:35 AM UTC-4, helloPiers wrote:
>
> This topic reminded me of this other thing I remember seeing: 
> https://github.com/marcusolsson/goddd - there are some further links to 
> blog posts and stuff on the README on that project, and there's a related 
> talk on YouTube from one of the Go conferences. 
>
>
> On Friday, August 18, 2017 at 11:29:01 AM UTC+1, juicemia wrote:
>>
>> 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 
>> <https://juicemia.com/post/go-ddd/>.
>>
>> 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.


Re: [go-nuts] Domain-driven design and go

2017-08-18 Thread juicemia
You're right. A lot of it is stuff you pick up as you grow your skills. I 
wrote the article to show how the Go community has standardized on patterns 
that were talked about in the book. I guess I could have done a better job 
of accentuating that.

I think a great example of that is the repository pattern. When I read the 
section on repositories I had already seen it in other Go applications I've 
worked on.

I'll be writing a follow up soon, i'll make sure to make that point more 
clear.

The thing about aggregates is that it isn't just about structuring data. 
It's about how you interact with the data.

A car "containing" its wheels falls short of explaining what an aggregate 
is.

The important thing about the aggregate is how its members are accessed, 
which is through the root object.

Also, there's a lot more to the book than just those three patterns. The 
first section of the book is entirely non-technical, and I think it's where 
most of the value in that book lies.

Thanks for the feedback.

On Friday, August 18, 2017 at 6:47:22 AM UTC-4, Konstantin Khomoutov wrote:
>
> On Fri, Aug 18, 2017 at 03:29:01AM -0700, Hugo Torres wrote: 
>
> > 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. 
>
> I'm not sure I got the point from reading. 
>
> What you have labelled as "Aggregates" is just a conventional 
> common-sense approach to structuring data: of course, a car "contains" 
> (hence "aggregates") its wheels. 
>
> What was labelled "Factories" are the standard ways to produce values of 
> types which do not have useful zero-values or just are convenient for 
> one reason or another.  Examples of what you call "factories" are right 
> there in the go-to documents for Go beginners [1, 2]. 
>
> What was labelled "Repositories" is a pretty standard way of decoupling 
> disparate parts of code by using an interface.  Interfaces naturally 
> decouple the code which only relies on some behaviour from the code 
> which defines types implementing that behaviour. 
>
> I'm afraid you might be too dragged away by that shallow-water 
> theoretisation which appear to be done by this book. 
> As someone commented on Amazon, «Another meta-methodology book filled 
> with self-evident observations normally learned on the job. A lot of it 
> is just common sense.» — based on your blog post, it sounds just about 
> correct, sorry. 
>
> 1. https://blog.golang.org/package-names 
> 2. https://golang.org/doc/effective_go.html 
>

-- 
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.