Re: [go-nuts] New fully featured bash completion for go - written in go

2017-05-13 Thread Eyal Posener
Frank, sweet!

Notice that you can build custom completions, such as completing agent 
names in consul exec -node  and service names after -service and 
so on.
Also, you may suggest to add this code to the main consul repo.

On Sunday, May 14, 2017 at 3:58:37 AM UTC+3, Frank Schröder wrote:
>
> This is awesome. I've immediately started working on 
> https://github.com/magiconair/consulcomplete :)
>
> Frank
>

-- 
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] [HELP] How do I read SMART data from disk?

2017-05-13 Thread daniel . swarbrick
I realise this is a very old thread, but I am in the early stages of 
writing a pure Go library for reading SMART attributes from HDDs / SSDs. So 
far it works for simple SCSI block devices (i.e., those that have a sd* 
device name) via SCSI pass-through, and I am in the process of adding 
support for devices attached to MegaRAID controllers.

You can find the code at https://github.com/dswarbrick/smart

On Friday, March 23, 2012 at 12:15:16 PM UTC+1, Jeff R. Allen wrote:
>
>
>
> On Thursday, March 22, 2012 4:59:09 PM UTC+1, minux wrote:
>>
>> you can strace(1) the command line app and find out how to read these 
>> data. 
>>
>
> Out of curiosity, I did just that, and I found that smartctl is using 
> ioctl SG_IO to do SCSI Generic commands on the device:
>
> 4602  ioctl(3, SG_IO, {'S', SG_DXFER_FROM_DEV, cmd[6]=[*12, 00, 00, 00, 
> 24, 00*], mx_sb_len=32, iovec_count=0, dxfer_len=36, timeout=2, 
> flags=0, data[36]=["*\0\0\5\2[\0\0\0ATA TOSHIBA THNSNC12*"...], 
> status=00, masked_status=00, sb[0]=[], host_status=0, driver_status=0, 
> resid=0, duration=0, info=0}) = 0
>
> (The request and reply are emboldened.)
>
> You can see an example of how to access ioctl from Go in the exp/terminal 
> package: 
> http://code.google.com/p/go/source/browse/src/pkg/exp/terminal/util.go
>
> If you want to make this portable, you'll need to think about making a 
> package in Go that can do SCSI Generic commands, hiding the 
> platform-dependent parts inside of it. Take a look at the source to the net 
> package to see how to make one Go package that's got OS-dependent 
> implementations of the same external API.
>
> Then you can use your new package to talk S.M.A.R.T. with your device.
>
> I think that project would be a very good fit for Go; at the low levels, 
> you need control of the bits to do the ioctl, and once you get the data, 
> you have all the niceities of Go to transform it, store it in a database, 
> graph it, etc. Go for it!
>
>  -jeff
>

-- 
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] When appending to arrays, gmp.Int values change for large number arrays

2017-05-13 Thread dantesepicsneeze


We're using gmp (library found at https://github.com/ncw/gmp) to run on 
large inputs, and we have arrays with thousands of elements at a time in 
our code. When we write these arrays to files, we find that the values of 
some of the elements have changed.


We tested our by code by reading in an input file of large numbers, casting 
them to gmp.Int, storing them in an array, and writing them to an output 
file. This works for an array of ~1400 numbers, but if the array gets any 
larger than that the values in the array change.

Below we print the first element of our array each time a new element gets 
appended. As the size goes past 1435, the value of the first value changes, 
and it changes again when the size goes past 1437:


output: 1434 
27928410756179523138881080989986005991789933932188228018115755918494634799929873910027825747854697455979387110847058629350347288500624884424807086906801594642406392448568530327829083514883524712985492538589993807582131300292739787897589360129490451849769622648595726892334513355855504557741514903175075958458960111055024641406976670602678887952234068019841236549447926340755063903373950684252611325596552928912480285833159841819645546289989159869982214159616531691638376958340264087137749469269647555189450117026947774590910035240238694361652478067361121651905941283054193444516391789652433009672685099320489013369511

output: 1435 
27928410756179523138881080989986005991789933932188228018115755918494634799929873910027825747854697455979387110847058629350347288500624884424807086906801594642406392448568530327829083514883524712985492538589993807582131300292739787897589360129490451849769622648595726892334513355855504557741514903175075958458960111055024641406976670602678887952234068019841236549447926340755063903373950684252611325596552928912480285833159841819645546289989159869982214159616531691638376958340264087137749469269647555189450117026947774590910035240238694361652478067361121651905941283054193444516391789652433009672685099320489013369511

output: 1436 
27928410756179523138881080989986005991789933932188228018115755918494634799929873910027825747854697455979387110847058629350347288500624884424807086906801594642406392448568530327829083514883524712985492538589993807582131300292739787897589360129490451849769622648595726892334513355855504557741514903175075958458960111055024641406976670602678887952234068019841236549447926340755063903373950684252611325596552928912480285833159841819645546289989159869982214159616531691638376958340264087137749469269647555189450117026947774590910035240238694361652478067361121651905941283054193424735876961338910144554408906597071520268288

output: 1437 
27928410756179523138881080989986005991789933932188228018115755918494634799929873910027825747854697455979387110847058629350347288500624884424807086906801594642406392448568530327829083514883524712985492538589993807582131300292739787897589360129490451849769622648595726892334513355855504557741514903175075958458960111055024641406976670602678887952234068019841236549447926340755063903373950684252611325596552928912480285833159841819645546289989159869982214159616531691638376958340264087137749469269647555189450117026947774590910035240238694361652478067361121651905941283054193424735876961338910144554408906597071520268288

output: 1438 
2393706525861729360741922124137674923885378648574768525617853818377338295726770968837510115411713639449942813542410122781003049158815334638386757489378865115690993509412251696127283961449052609910367016753503276717219374706887218515185370729246298124537836902676996868643830290196728475836135942660102147078687203464316120920925288760650180847521449886391007761057733951927560142110014087955337930094606086003264404490081726797410733774516424213240813188435922154321511108819176444188185518457225955025510879142933128937566544835525378040039436242357463757111369800670593394434569238912921305016540547229516010929


We tried the exact same test with math/big, and this was not an issue. Can 
someone please take a look at this?

-- 
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] New fully featured bash completion for go - written in go

2017-05-13 Thread Eyal Posener
Thanks!

On Saturday, May 13, 2017 at 10:03:25 PM UTC+3, Jonathan Yu wrote:
>
> Nifty! Do the bash completion scripts need to be dynamically regenerated? 
> I guess so for some of the features like completing on package names.
>

Not sure I understand your question, but the bash completion script does 
not need to be regenerated.
What happens under the hood is that there is a go binary that completes the 
next word. the go binary is called by the shell when the tab key is pressed.
What that tells the shell to call that binary for completion is a line in 
the bashrc or zshrc, which does not need to be changed, and is added when 
you type `gocomplete -install`. 

>
> It seems useful to have some Go completions (e.g. go in == go 
> install) available as part of distro packages.
>
> On Sat, May 13, 2017 at 1:29 AM, Eyal Posener  > wrote:
>
>> Simple to install (Assuming GOPATH and PATH are correct):
>>
>> go install github.com/posener/complete/gocomplete
>> gocomplete -install
>>
>>
>> Features:
>>
>>- Complete go command, sub commands and flags.
>>- Complete package names, .go files and ellipsis when necessary.
>>- Complete test names after -run flag!
>>
>> Works with bash / zsh shells
>>
>> This is also a package, that enables writing bash completion scripts, or 
>> add them to an existing go program.
>>
>> Please, open issues, contribute and star!
>>
>> -- 
>> 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.
>>
>
>
>
> -- 
> Jonathan Yu / *@jawnsy* on LinkedIn , 
> Twitter , GitHub , 
> Facebook 
> *“Ever tried. Ever failed. No matter. Try again. Fail again. Fail better.”* — 
> Samuel Beckett, Worstward Ho (1983) 
>
> “In an adaptive environment, winning comes from adapting to change by 
> continuously experimenting and identifying new options more quickly and 
> economically than others. The classical strategist's mantra of sustainable 
> competitive advantage becomes one of serial temporary advantage.” — 
> Navigating 
> the Dozens of Different Strategy Options 
> 
>  (HBR)
>

-- 
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] New fully featured bash completion for go - written in go

2017-05-13 Thread Jonathan Yu
Nifty! Do the bash completion scripts need to be dynamically regenerated? I
guess so for some of the features like completing on package names.

It seems useful to have some Go completions (e.g. go in == go install)
available as part of distro packages.

On Sat, May 13, 2017 at 1:29 AM, Eyal Posener  wrote:

> Simple to install (Assuming GOPATH and PATH are correct):
>
> go install github.com/posener/complete/gocomplete
> gocomplete -install
>
>
> Features:
>
>- Complete go command, sub commands and flags.
>- Complete package names, .go files and ellipsis when necessary.
>- Complete test names after -run flag!
>
> Works with bash / zsh shells
>
> This is also a package, that enables writing bash completion scripts, or
> add them to an existing go program.
>
> Please, open issues, contribute and star!
>
> --
> 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.
>



-- 
Jonathan Yu / *@jawnsy* on LinkedIn ,
Twitter , GitHub ,
Facebook 
*“Ever tried. Ever failed. No matter. Try again. Fail again. Fail better.”* —
Samuel Beckett, Worstward Ho (1983)

“In an adaptive environment, winning comes from adapting to change by
continuously experimenting and identifying new options more quickly and
economically than others. The classical strategist's mantra of sustainable
competitive advantage becomes one of serial temporary advantage.” — Navigating
the Dozens of Different Strategy Options

 (HBR)

-- 
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] How to get size of http request/stream size transferred over wire?

2017-05-13 Thread Jonathan Yu
Have you considered an external tool, like Wireshark or tcpdump? (The
latter can capture pcap files for processing with the former)

On Sat, May 13, 2017 at 12:04 AM,  wrote:

> I'm trying to make a comparison between http1.x and http2's long-polling.
> Since headers are only sent once in http2, I'm trying to figure out the
> difference in the size of the data transferred over the wire. Is there a
> way to do that?
>
> Thanks
>
> --
> 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.
>



-- 
Jonathan Yu / *@jawnsy* on LinkedIn ,
Twitter , GitHub ,
Facebook 
*“Ever tried. Ever failed. No matter. Try again. Fail again. Fail better.”* —
Samuel Beckett, Worstward Ho (1983)

“In an adaptive environment, winning comes from adapting to change by
continuously experimenting and identifying new options more quickly and
economically than others. The classical strategist's mantra of sustainable
competitive advantage becomes one of serial temporary advantage.” — Navigating
the Dozens of Different Strategy Options

 (HBR)

-- 
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] Are there any implicit type conversions in Go?

2017-05-13 Thread Jan Mercl
On Sat, May 13, 2017 at 8:19 PM st ov  wrote:

> Go appears to be very strict when using types. Even aliases need to be
explicitly cast.
>
> Are there any contexts where types are implicitly cast? Or must all type
conversions be specified?

cast != conversion

Otherwise for example:

- Ideal constants are implicitly converted according to context in which
they appear.
- If valid, any value is implicitly converted to the appropriate interface
type on assignment/when used as a function argument.

-- 

-j

-- 
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] Are there any implicit type conversions in Go?

2017-05-13 Thread st ov
Go appears to be very strict when using types. Even aliases need to be 
explicitly cast.

Are there any contexts where types are implicitly cast? Or must all type 
conversions be specified?

-- 
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] How to get size of http request/stream size transferred over wire?

2017-05-13 Thread mujtaba . altameemi
I'm trying to make a comparison between http1.x and http2's long-polling. 
Since headers are only sent once in http2, I'm trying to figure out the 
difference in the size of the data transferred over the wire. Is there a 
way to do that?

Thanks

-- 
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] would it be good a go runtime support both GC (garbage collection) and ARC (automatic reference counting)?

2017-05-13 Thread Jesper Louis Andersen
On Fri, May 12, 2017 at 4:55 PM T L  wrote:

>
> The 100µs is STW duration. I mean the fps may decrease some during the
> period of GC running.
>

This is true. But if a refcounter needs to use a bit of CPU power in the
background to eventually collect data then it has the same problems with
fps drops. And in general, refcount maintenance is more expensive than
maintaining GC. There is a bit more instruction pressure in a system with
refcounting.

I've mentioned "A unified theory of Garbage collection' by Bacon, Cheng,
and Rajan (2004) before. In that paper they conjecture that refcounting and
(mark'n'sweep) garbage collection are each others duals and that they tend
to converge to the same methods. In short: it doesn't matter that much if
you use one of the other in practice.

I'd have absolutely no qualms on using Go for a game now. A 100us stw pause
can easily be hidden in a 16.7ms frame rendering time. And if you ask the
GC itself, it usually reports how much time it is spending. I'd be much
surprised if you don't have 16ms available per frame even in the worst
situation.

-- 
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] LinkedList implementation

2017-05-13 Thread Keith Brown
forgot about that. thanks, I will study this.
thinking of skipping linked list and going ahead to graphs and trees

On Sat, May 13, 2017 at 8:52 AM, andrey mirtchovski
 wrote:
> Perhaps looking at the history of the implementation will shed some light:
>
> https://github.com/golang/go/commit/01389b966ed81fad6e5fac3e98fe46e162645659
>
> On Sat, May 13, 2017 at 6:28 AM, Keith Brown  wrote:
>> I am learning basic data structures and I chose golang  since it  provide C
>> like pointers. While looking at list.go I noticed this in the Element struct
>>
>>
>> type Element {
>> next, prev *Element //makes sense. Doubly linked list
>> list *List //Why! I don't understand why there is a pointer to List
>> Value interface{} //makes sense. Data interface
>> }
>>
>> Source: https://github.com/golang/go/blob/master/src/container/list/list.go
>>
>>
>>
>> --
>> 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.


Re: [go-nuts] LinkedList implementation

2017-05-13 Thread andrey mirtchovski
Perhaps looking at the history of the implementation will shed some light:

https://github.com/golang/go/commit/01389b966ed81fad6e5fac3e98fe46e162645659

On Sat, May 13, 2017 at 6:28 AM, Keith Brown  wrote:
> I am learning basic data structures and I chose golang  since it  provide C
> like pointers. While looking at list.go I noticed this in the Element struct
>
>
> type Element {
> next, prev *Element //makes sense. Doubly linked list
> list *List //Why! I don't understand why there is a pointer to List
> Value interface{} //makes sense. Data interface
> }
>
> Source: https://github.com/golang/go/blob/master/src/container/list/list.go
>
>
>
> --
> 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.


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

2017-05-13 Thread 温博格
Hi. I was one of the people who failed in an attempt to auto-insert
contexts in all of google3. I no longer remember all the obstacles I failed
to overcome, but would encourage others to take on the project.

One issue was libraries that were used both in paths from http requests (so
they needed the context propagated through them) but were also used in
places where their callers (starting at main) didn't have any contexts at
all. Sitting by my coffee this morning this no longer seems like an
insuperable obstacle (e.g., pass nils and change them to
context.Background() inside, or, like appengine's log, split packages into
one that requires contexts and one that doesn't). But I had lots of what I
thought were plausible ideas that broke on the hard rock of google3, and I
suspect these would too.

(The project wasn't a total failure. It did plumb contexts through a bunch
of packages. But the general case was too hard for me.)

On Sat, May 13, 2017 at 3:50 AM,  wrote:

> A reference i found about "reactive programming"
> https://github.com/dsyer/reactive-notes/blob/master/intro.adoc
>
> Hope this introduced the concept correctly, thanks for pointing that.
>
> Following are only some thoughts,
>
> Two things surprising here,
> 1/ a programmer prefers not to solve a problem
> 2/ one failed attempt mean the end of all attempts**
>
> That being said, my little understanding so far is that current context is
> used for two purposes,
> - cancellation
> - data (transmission? not sure) (+/- ts, have not checked i expect so in
> regards to previous referenceS cited)
>
> While cancellation is a feature i really want to take advantage of,
> the other one is much more arguable in the sense that
> it can remains expressed purely by the end user without bloating
> his productivity and quality (you don t really need it everywhere, just
> where it is needed),
> it seems to be highly software context dependent.
>
> Whereas cancellation, while it looks likes simple, is maybe more subtle.
> After all it is about assigning uuid to a chain of call and
> appropriately propagate, disjoint/rejoin new uuids with the previous one,
> so that we can ask to stop execution of a sub selection of a chain of calls
> via an handle.
> Am i too simplistic?
>
> Its difficulty reside in its requirement to be passed absolutely
> everywhere,
> That reveals an important fact about the nature of cancellation,
> it is there, it is everywhere, at all time (...within the program
> lifetime),
> it is somewhere in the background of every ops since the very beginning
> the program began,
> but not necessarily enabled, and certainly not a straight line.
>
> That is where the syntax might help to establish the plots
> that the runtime consumes to connect the dots
> and support what the developers want to achieve,
> in my understanding so far.
>
> My best comparison to cancellation is
> request rays tracing in micro services oriented architecture,
> on both end it is a multi-tenant,
> it always start with one ray,
> the ray always split into multiple rays,
> because we do programming, we need ways
> to create, control distribute existing/new rays,
> and possibly let the userland introduce a new behavior for the rays.
>
> So yeah basically main has a ray,
> if you process an http request,
> you to create a new ray
> to be able to cancel only that request,
> but it needs to be connected to the main ray
> because if main should be canceled,
> that signals should propagate to all rays connected with it,
> probably.
>
> ** i want to put emphasis because in the description provided
> by Sameer, as i tried to summarize, It has been tried to handle
> the problem via the type system as if it was
> a completely defined set of types.
> Which in go is wrong (yeah i m very affirmative here :),
> from my understanding, that might be correct in other oop languages.
> Technically it is possible to rewrite interfaces, methods signatures,
> taken individually,
> as a whole, and from the consumer pov,
> i d say it is an impossible task in go because it it goes against its
> nature.
> And i confirm/understand that by reading to Sameer feedback.
>
> Notes: i m a strong lover of go type system (not talking about values and
> pointers ;)
>
>
> On Friday, May 12, 2017 at 4:42:54 PM UTC+2, Henrik Johansson wrote:
>>
>> With the whole "Reactive" movement thread locals have started to vanish
>> at least in the Java ecosystem.
>> I agree with Sameer that, while convenient, it comes with a whole set of
>> obscure bugs.
>>
>> On Fri, May 12, 2017, 14:57 Sameer Ajmani  wrote:
>>
>>> Hmm, I'm not finding good open-source examples of ThreadLocal context
>>> propagation in C++ and Java.  My experience with this is based on what
>>> Google uses internally.  Perhaps someone more familiar with context use
>>> (tracing?) outside Google can chime in? +Jaana Burcu Dogan
>>>
>>> On Thu, May 11, 2017 at 7:02 AM  wrote:
>>>
 thanks,

 

Re: [go-nuts] would it be good a go runtime support both GC (garbage collection) and ARC (automatic reference counting)?

2017-05-13 Thread Dave Cheney
Maybe that tells us something about the prescience of the design decisions made 
by Go's authors. 

-- 
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] would it be good a go runtime support both GC (garbage collection) and ARC (automatic reference counting)?

2017-05-13 Thread T L


On Saturday, May 13, 2017 at 3:42:36 PM UTC+8, Sokolov Yura wrote:
>
> 1. Go's GC is quite predictable.
> 2. Go's runtime has no deallocation without GC for simplicity. You want to 
> return complexity to runtime.
> 3. Why not use other language? Go is quite opinionated by its creators. 
> Either you share that opinion, or use other language.
> For example, D language can use both GC and ARC (with template-defined 
> custom pointer types). It also has fibers (but with fixed stack). Vibe.d 
> adds async networking with sync interface. I think, you will be able to 
> implement channels and select. Go ahead.


But it looks the go ecosystem is larger and more active.  :(

-- 
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] New fully featured bash completion for go - written in go

2017-05-13 Thread Eyal Posener
Simple to install (Assuming GOPATH and PATH are correct):

go install github.com/posener/complete/gocomplete
gocomplete -install


Features:

   - Complete go command, sub commands and flags.
   - Complete package names, .go files and ellipsis when necessary.
   - Complete test names after -run flag!
   
Works with bash / zsh shells

This is also a package, that enables writing bash completion scripts, or 
add them to an existing go program.

Please, open issues, contribute and star!

-- 
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] Re: adding context.Context to new code

2017-05-13 Thread mhhcbon
A reference i found about "reactive programming"
https://github.com/dsyer/reactive-notes/blob/master/intro.adoc

Hope this introduced the concept correctly, thanks for pointing that.

Following are only some thoughts,

Two things surprising here,
1/ a programmer prefers not to solve a problem
2/ one failed attempt mean the end of all attempts**

That being said, my little understanding so far is that current context is 
used for two purposes,
- cancellation
- data (transmission? not sure) (+/- ts, have not checked i expect so in 
regards to previous referenceS cited)

While cancellation is a feature i really want to take advantage of,
the other one is much more arguable in the sense that
it can remains expressed purely by the end user without bloating 
his productivity and quality (you don t really need it everywhere, just 
where it is needed), 
it seems to be highly software context dependent.

Whereas cancellation, while it looks likes simple, is maybe more subtle.
After all it is about assigning uuid to a chain of call and 
appropriately propagate, disjoint/rejoin new uuids with the previous one, 
so that we can ask to stop execution of a sub selection of a chain of calls
via an handle. 
Am i too simplistic?

Its difficulty reside in its requirement to be passed absolutely everywhere,
That reveals an important fact about the nature of cancellation,
it is there, it is everywhere, at all time (...within the program lifetime),
it is somewhere in the background of every ops since the very beginning the 
program began,
but not necessarily enabled, and certainly not a straight line.

That is where the syntax might help to establish the plots
that the runtime consumes to connect the dots 
and support what the developers want to achieve,
in my understanding so far.

My best comparison to cancellation is 
request rays tracing in micro services oriented architecture,
on both end it is a multi-tenant,
it always start with one ray,
the ray always split into multiple rays,
because we do programming, we need ways
to create, control distribute existing/new rays,
and possibly let the userland introduce a new behavior for the rays.

So yeah basically main has a ray,
if you process an http request,
you to create a new ray 
to be able to cancel only that request,
but it needs to be connected to the main ray
because if main should be canceled,
that signals should propagate to all rays connected with it,
probably.

** i want to put emphasis because in the description provided
by Sameer, as i tried to summarize, It has been tried to handle
the problem via the type system as if it was 
a completely defined set of types.
Which in go is wrong (yeah i m very affirmative here :), 
from my understanding, that might be correct in other oop languages.
Technically it is possible to rewrite interfaces, methods signatures, taken 
individually, 
as a whole, and from the consumer pov, 
i d say it is an impossible task in go because it it goes against its 
nature.
And i confirm/understand that by reading to Sameer feedback.

Notes: i m a strong lover of go type system (not talking about values and 
pointers ;)


On Friday, May 12, 2017 at 4:42:54 PM UTC+2, Henrik Johansson wrote:
>
> With the whole "Reactive" movement thread locals have started to vanish at 
> least in the Java ecosystem. 
> I agree with Sameer that, while convenient, it comes with a whole set of 
> obscure bugs. 
>
> On Fri, May 12, 2017, 14:57 Sameer Ajmani  
> wrote:
>
>> Hmm, I'm not finding good open-source examples of ThreadLocal context 
>> propagation in C++ and Java.  My experience with this is based on what 
>> Google uses internally.  Perhaps someone more familiar with context use 
>> (tracing?) outside Google can chime in? +Jaana Burcu Dogan  
>>
>> On Thu, May 11, 2017 at 7:02 AM  wrote:
>>
>>> thanks,
>>>
>>> ..integrating Context into the runtime..
>>>
>>>
>>> 50% runtime, 50% syntax with explicit contextualization.
>>>
>>> ..The flow of request processing in Go may include multiple goroutines 
>>> and may move across channels;
>>>
>>>
>>> yes big ? mark here. might the 50% of an handy and explicit syntax help 
>>> with it?
>>>
>>>
>>> C++ and Java use thread-local Contexts, and while this is convenient, it 
>>> is often a source of mysterious bugs.
>>>
>>> thanks! I don't know them, 
>>>
>>> I quickly checked according to this 
>>>
>>> https://dzone.com/articles/painless-introduction-javas-threadlocal-storage 
>>> I may have totally wrong, the syntax does not look like, not even from a 
>>> 100km,
>>> to how i represent go contexts in my head.
>>>
>>> This is more like the actor pattern dave cheney talks about in
>>> https://dave.cheney.net/2016/11/13/do-not-fear-first-class-functions
>>> (search for  Let’s talk about actors)
>>>
>>> Is the dzone link correctly describe 
>>> what you mentioned as being go context equivalent in java ?
>>>
>>> sorry my questions are so basic.
>>>
>>>
>>> On Thursday, May 11, 2017 at 

Re: [go-nuts] would it be good a go runtime support both GC (garbage collection) and ARC (automatic reference counting)?

2017-05-13 Thread Sokolov Yura
1. Go's GC is quite predictable.
2. Go's runtime has no deallocation without GC for simplicity. You want to 
return complexity to runtime.
3. Why not use other language? Go is quite opinionated by its creators. Either 
you share that opinion, or use other language.
For example, D language can use both GC and ARC (with template-defined custom 
pointer types). It also has fibers (but with fixed stack). Vibe.d adds async 
networking with sync interface. I think, you will be able to implement channels 
and select. Go ahead.

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