Re: [go-nuts] Re: Keep Vendor folder on library Repository is Bad or Good practice.

2018-08-13 Thread Dan Kortschak
It is still there because someone if (hopefully) benificently name squatting there with the same package. It went away and broke things. The person who owns jteeuwen is not Jim (the original owner), and has put back the go-bindata repo to avoid a breakage. It could be far worse. On Mon,

Re: [go-nuts] a preservable, forgettable map iterator?

2018-08-03 Thread Dan Kortschak
hat said, perhaps you could turn it around and have the iteration > process > take a closure, pretty much like path/filepath.Walk ? > > -s > > > On Fri, Aug 3, 2018 at 12:29 AM Dan Kortschak .edu.au> > wrote: > > > > > Go lacks a nice way to hand arou

[go-nuts] a preservable, forgettable map iterator?

2018-08-02 Thread Dan Kortschak
Go lacks a nice way to hand around a map iteration state. There are ways to to this, but they either require handing around a doubly- wrapped closure ``` func iterator(m map[KT]VT) func(func(v VT)) { return func(fn func (v VT)) { for _, v := range m {

Re: [go-nuts] "go list"-independent way to get list of all packages in std

2018-08-02 Thread Dan Kortschak
, 2018-08-01 at 10:22 -0700, Ian Lance Taylor wrote: > On Fri, Jul 27, 2018 at 9:33 PM, Dan Kortschak > wrote: > > > > > > That's fine. Though given that a program *can* shell out to `go > > list > > std` to get the list of std packages, it seems odd to m

Re: [go-nuts] Re: Go license and fitness for purpose

2018-05-16 Thread Dan Kortschak
I hope so. I provide a package (github.com/kortschak/zalgo) that I cannot promise will not summon demons. It was written intentionally as a joke. I disclaim all liability should use of the package bring about meetings with demonic presences. On Wed, 2018-05-16 at 07:25 -0700,

Re: [go-nuts] golang maven plug-in 2.2.0 has been published in maven central

2018-05-14 Thread Dan Kortschak
Why! On Sun, 2018-05-13 at 22:01 -0700, Igor Maznitsa wrote: > the 2.2.0 version of the maven golang plugin  > has been published in the > maven  > central -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

Re: [go-nuts] Go license and fitness for purpose

2018-05-13 Thread Dan Kortschak
Who would determine whether an mistaken action was intentional? This seems like a very dangerous inclusion. On Sun, 2018-05-13 at 08:56 -0700, matthewju...@gmail.com wrote: > THE AUTHORS OF THIS SOFTWARE DID NOT INTENTIONALLY MAKE MISTAKES OR > INCLUDE  > PRACTICAL JOKES. > > I’m not a lawyer,

Re: [go-nuts] Please help me solve a bug with my licencing system!

2018-05-11 Thread Dan Kortschak
Handling errors is a part of writing robust software. In this case an error should at very least result in a non-acceptance of the authentication request. After that, do whatever you want. On Fri, 2018-05-11 at 14:58 -0700, ati...@mail.ccsf.edu wrote: > How do you recommend I check errors. I

Re: [go-nuts] Re: Go could really use a while statement

2018-05-11 Thread Dan Kortschak
while dirty() { wash() } until !dirty() { wash() } Normal English semantics hold until as a negation of while. On Fri, 2018-05-11 at 01:17 -0700, Louki Sumirniy wrote: > Until condition is true is not a negation or negative. -- You received this message because you are

Re: [go-nuts] Please help me solve a bug with my licencing system!

2018-05-11 Thread Dan Kortschak
To summarise: always check your errors. On Thu, 2018-05-10 at 22:30 -0600, Burak Serdar wrote: > It is likely that HashDecoded is "" (line 28) because > hex.DecodeString() fails, so password check never fails. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Re: Go could really use a while statement

2018-05-11 Thread Dan Kortschak
Until implies a negation. The presence of unless in perl is a horror resulting from the same semantics - I'm sure it seemed like a good idea at the time. On Thu, 2018-05-10 at 23:25 -0700, Louki Sumirniy wrote: > I think better to use the context of the english language for a  > pre-condition

Re: [go-nuts] Go could really use a while statement

2018-05-03 Thread Dan Kortschak
Yeah, that's not `for {} else {}`. This is spelled ``` var done bool for condition() { done = true body() } if !done { outOfBody() } ``` On Wed, 2018-05-02 at 22:45 -0700, Sokolov Yura wrote: > >     for { >     Body() >     if !Condition() { >     break

Re: [go-nuts] Go could really use a while statement

2018-05-02 Thread Dan Kortschak
On weird proposals there's also the `for { } else { }` construct that has been put forward before. On Wed, 2018-05-02 at 21:06 +, Michael Jones wrote: > Ok, weird proposal: Make the per-iteration update part of a for loop > change > from "assignment to assignment or boolean expression" to

Re: [go-nuts] FR: godoc have Methods collapsed by default

2018-04-30 Thread Dan Kortschak
Both, depending on context. On Mon, 2018-04-30 at 17:08 +, Sean Henderson wrote: > True, but do you look for methods across structs or only methods > belonging > to one struct? > > On Thu, Apr 26, 2018 at 4:49 PM Dan Kortschak <dan.kortschak@adelaide > .edu.au> >

Re: [go-nuts] FR: godoc have Methods collapsed by default

2018-04-26 Thread Dan Kortschak
I like being able to look for methods, so I would be sad to see this as the default behaviour. On Thu, 2018-04-26 at 16:00 -0700, swufy via golang-nuts wrote: > Are there any counter-arguments for why we wouldn't want this for the > docs? -- You received this message because you are subscribed

Re: [go-nuts] [ANN] oksvg and rasterx; SVG 2.0 path compliant renderer and rasterizer

2018-04-23 Thread Dan Kortschak
The freetype license looks it's a BSD derivative. That license would be more consistent with the static linking used by gc, so since you can choose either the freetype license or the GPL 2+, if it's not against your ideals, the FTL is probably the better choice. Note that because oksvg imports

Re: [go-nuts] Order of evaluation question

2018-04-08 Thread Dan Kortschak
I think it is, though this is a bit lawyery. > Otherwise, when evaluating the operands of an expression, assignment, > or return statement, all function calls, method calls, and > communication operations are evaluated in lexical left-to-right > order. This does not mention type conversions, so

Re: [go-nuts] math type algo question and Go's int size

2018-04-08 Thread Dan Kortschak
For 64 bit word size: https://stackoverflow.com/questions/11376288/fast -computing-of-log2-for-64-bit-integers/11398748#11398748 This can be derived from examples in https://graphics.stanford.edu/~sea nder/bithacks.html which gives the 32 bit version. However, the math/bits package gives you

Re: [go-nuts] Re: Long running task in select case

2018-03-17 Thread Dan Kortschak
Only if it doesn't leave the shop like that, but with a P>0, it will. On Sat, 2018-03-17 at 15:24 -0700, matthewju...@gmail.com wrote: > Defending my reputation, I’m here for people making things, not for > being  > an educator. Thinking quickly and making it work even with mistakes > can be  > a

Re: [go-nuts] cumulative Chi square probability density function

2018-03-12 Thread Dan Kortschak
Gonum stat/distuv has this. https://godoc.org/gonum.org/v1/gonum/stat/distuv#ChiSquared On Mon, 2018-03-12 at 16:01 -0700, Kees Varekamp wrote: > Hello Gophers, > > Does anyone happen to have some Go code for the cumulative Chi > square  > probability density function lying around?  > > Thanks

Re: [go-nuts] My views on Go and why it's better than Scripting

2018-03-05 Thread Dan Kortschak
This was essentially my thinking in choosing Go to write my bioinformatics library in - mainly because much of our code will be written and maintained by students, but we want good performance as well. Some of my thought about this are in this paper https://www.biorxiv.org

Re: [go-nuts] Alibaba Cloud hash released official Go SDK v1.0.0

2018-03-04 Thread Dan Kortschak
Apart from the README, there is AFAICS no documentation. https://goreportcard.com/report/github.com/aliyun/alibaba-cloud-sdk-go#golint On Fri, 2018-03-02 at 13:53 +, Henrik Johansson wrote: > I am sure it's really cool but the docs are in chinese I assume. Most > other > projects speared by

Re: [go-nuts] json struct tag

2018-01-30 Thread Dan Kortschak
It does matter, and omitempty must have a leading comma; the first comma separated term is the JSON field name. From the json docs: ``` The format string gives the name of the field, possibly followed by a comma-separated list of options. The name may be empty in order to specify options without

Re: [go-nuts] Re: JSON and Embedded Types (Aliases)

2018-01-22 Thread Dan Kortschak
The discordance is unexpected. On Mon, 2018-01-22 at 19:28 -0500, Josh Humphries wrote: > I think that is expected, and it is the JSON marshaling that is > surprising > (and erroneous). > > If it were expected that the embed field names resolved to the alias > *target > type* name, it would

Re: [go-nuts] Re: JSON and Embedded Types (Aliases)

2018-01-22 Thread Dan Kortschak
This is sort of surprising though: https://play.golang.org/p/mjfkzIqAo_b On Mon, 2018-01-22 at 10:20 -0800, C Banning wrote: > From the Language Specification -  > > A field declared with a type but no explicit field name is called an > *embedded  > field*. An embedded field must be specified as

Re: [go-nuts] How to bufio.Write with a length specified?

2018-01-18 Thread Dan Kortschak
If you want to write a length shorter than the slice, make the slice shorter. No, seriously... n, err := f.Write(d[:2]) On Thu, 2018-01-18 at 17:04 -0600, Peng Yu wrote: > Hi, > > The following example shows how to write a byte slice to a buffer. > But > what if I want only write a length

Re: [go-nuts] Re: Why is the cpu usage so high in a golang tcp server?

2017-12-19 Thread Dan Kortschak
bufio.NewReader On Mon, 2017-12-18 at 05:11 -0800, Tamás Gulácsi wrote: > > n, err := sock.Read(buf) > > > > > This will be slow: TCP is a streaming protocol, so this Read can read > any  > length between 0 (! yes !) and 1024 bytes. > Use buffering (bytes.NewReader) and some kind of

Re: [go-nuts] os.remove is slow

2017-12-04 Thread Dan Kortschak
Have you tried os.RemoveAll("/var/spool/directory")? https://golang.org/pkg/os/#RemoveAll If that's slow, file an issue. On Mon, 2017-12-04 at 09:41 -0800, gabejessfors...@gmail.com wrote: > What takes 18 seconds in a perl command: > perl -e 'for(<*>){((stat)[9]<(unlink))}' > > is taking

Re: [go-nuts] Can someone explain this behavior with interfaces/points?

2017-11-14 Thread Dan Kortschak
This is explained in the FAQ: https://golang.org/doc/faq#nil_error On Tue, 2017-11-14 at 16:37 -0800, Travis Beauvais wrote: > https://play.golang.org/p/76gIgzXgcS > > Why is err not nil when a is? > > Our theory is that err is a pointer to a nil pointer so technically > not  > nil. We would

Re: [go-nuts] Simple exec.Command() program

2017-11-12 Thread Dan Kortschak
exec.Command does not invoke a shell, the `>' you use in bash is a shell function (https://www.gnu.org/software/bash/manual/bash.html#Redi rections). Note that the example for CombinedOutput invokes "sh" as the command with "-c", "ls... (https://golang.org/pkg/os/exec/#example_Cmd_

Re: [go-nuts] Re: A way to detect closed channel

2017-11-06 Thread Dan Kortschak
This is not a good idea (and is wrong since it does not check the ok value of the receive operation). As was pointed out previously, this is only true in the instant that the select is occurring. On Mon, 2017-11-06 at 18:39 -0800, sheepbao wrote: > func isClose() bool { >     select { >     case

Re: [go-nuts] A way to detect closed channel

2017-11-06 Thread Dan Kortschak
No. The complete select+code blocks is not atomic, so the select may see that closedchan is not closed, execute the default case, but in the mean time closedchan has been closed by someone else. Bang! On Mon, 2017-11-06 at 16:59 -0800, Albert Tedja wrote: > Since closing an already closed channel

Re: [go-nuts] append to a stem racy?

2017-11-05 Thread Dan Kortschak
With high N, I have been able to confirm raciness. On Mon, 2017-11-06 at 11:13 +1030, Dan Kortschak wrote: > I have not been able to get the race detector to complain about this, > even if I make len << cap. -- You received this message because you are subscribed to the Google Gro

[go-nuts] append to a stem racy?

2017-11-05 Thread Dan Kortschak
Say I have a []T that I want to use as a common stem that has a tail appended onto it, used concurrently, for example: for i := 0; i < N; i++ { tail := makeTail(i) // Returns a []T. wg.Add(1) go func() { defer wg.Done() a := append(stem,

Re: [go-nuts] import a "main" package

2017-10-24 Thread Dan Kortschak
The spec does preclude that since there must be a `package main`. https://golang.org/ref/spec#Program_execution On Wed, 2017-10-25 at 05:02 +, Alex Buchanan wrote: > Interesting, thanks. Let me try to clarify my idea with some simple > code: > > // file lives at

Re: [go-nuts] Re: awesome-go project on golang github organization

2017-10-24 Thread Dan Kortschak
I have similar sentiments. On Tue, 2017-10-24 at 09:19 -0700, prades.m...@gmail.com wrote: > I submitted several original projects i made to your list, they > passed all  > the tests, they sat in the pull-request list for 6 month then when > rejected  > for disingenuous or unspecified reasons.So

Re: [go-nuts] nil maps

2017-10-16 Thread Dan Kortschak
If you only need the map conditionally, you need to declare it and then conditionally make it. ``` var m map[string]int if needMap {     m = make(map[string]int) } ``` On Mon, 2017-10-16 at 21:52 -0700, Alex Dvoretskiy wrote: > Hello, Golang Nuts! > > I have an interesting question about maps.

Re: [go-nuts] Go IO/SPI broken?

2017-10-16 Thread Dan Kortschak
Try using the periph.io libraries; golang.org/x/exp/io/spi is no longer maintained[1]. [1]https://github.com/golang/go/issues/22058#issuecomment-332390766 On Sun, 2017-10-15 at 21:01 -0700, Eugene Dzhurinsky wrote: > Hello!  > > I was trying to make the RF522 (RFID reader) to initialize

Re: [go-nuts] A few go 2 suggestions

2017-10-10 Thread Dan Kortschak
On Tue, 2017-10-10 at 06:13 -0700, Scott Cotton wrote: > 1. "defer go"   extend defers to work on goroutine exit with > mechanism just  > like defer, but if we say "defer go f()" > instead of "defer f()" then we run on goroutine exit.  Very big gains > for  > scaling here IMHO. How is this

Re: [go-nuts] internal/poll.runtime_pollWait problem on RHEL with 3.10.0-327.el7.x86_64

2017-10-02 Thread Dan Kortschak
Agreed. I think there is a deep problem, but the deep problem is here rather than in the Go tests. thanks Dan On Mon, 2017-10-02 at 18:16 -0700, Ian Lance Taylor wrote: > 10 minutes is the default timeout, so that's why that run failed. > > 5 minutes, the time shown above, is an extraordinarily

Re: [go-nuts] internal/poll.runtime_pollWait problem on RHEL with 3.10.0-327.el7.x86_64

2017-10-02 Thread Dan Kortschak
``` On Fri, 2017-09-29 at 06:52 -0700, Ian Lance Taylor wrote: > On Thu, Sep 28, 2017 at 10:12 PM, Dan Kortschak > <dan.kortsc...@adelaide.edu.au> wrote: > > > > > > I have just tried replicating the issue today and this time, one > > machine passes everyt

Re: [go-nuts] Re: Graphing libraries in golang

2017-09-29 Thread Dan Kortschak
To get bitbucket.org/zombiezen/gopdf/... to install, you will need to install mercurial. On Thu, 2017-09-28 at 23:49 -0700, Vikram Rawat wrote: > Thanks for your reply. Library seems promising. but when I run it , > this  > errors out > > > > cannot find package

Re: [go-nuts] internal/poll.runtime_pollWait problem on RHEL with 3.10.0-327.el7.x86_64

2017-09-28 Thread Dan Kortschak
, 2017-09-28 at 21:23 -0700, Ian Lance Taylor wrote: > On Thu, Sep 28, 2017 at 5:40 PM, Dan Kortschak > <dan.kortsc...@adelaide.edu.au> wrote: > > > > > > I can replicate this on another newer RHEL machine. In both cases > > the > > machines are quiet (the

Re: [go-nuts] Needing some explanation of a compile time error

2017-09-28 Thread Dan Kortschak
StringChan and StringSendingChan are named types and so you will need a conversion. It would be easier though to just not declare types here. You don't need them. https://play.golang.org/p/0dBHgsaP0v On Thu, 2017-09-28 at 17:19 -0700, lmumar wrote: > Hi all, > > Good day to you all. I just

Re: [go-nuts] internal/poll.runtime_pollWait problem on RHEL with 3.10.0-327.el7.x86_64

2017-09-28 Thread Dan Kortschak
10:20 PM, Dan Kortschak > <dan.kortsc...@adelaide.edu.au> wrote: > > > > > > I am seeing all.bash fail when testing cmd/go with a likely cause > > being > > internal/poll.runtime_pollWait. > > > > I'm trying to build go1.9 (with a change to

[go-nuts] internal/poll.runtime_pollWait problem on RHEL with 3.10.0-327.el7.x86_64

2017-09-27 Thread Dan Kortschak
I am seeing all.bash fail when testing cmd/go with a likely cause being internal/poll.runtime_pollWait. I'm trying to build go1.9 (with a change to the heap size), but all.bash fails as shown below. Is this a known problem? and if it is, is there a workaround. thanks ``` panic: test timed out

Re: [go-nuts] Re: Graphing libraries in golang

2017-09-27 Thread Dan Kortschak
On Wed, 2017-09-27 at 08:54 -0700, Volker Dobler wrote: > One from https://awesome-go.com/#science-and-data-analysis > probably should fit your needs. Or try looking for R bindings and > run your plots through R. https://godoc.org/gonum.org/v1/plot for the first and

Re: [go-nuts] How to remove a struct value from a struct slice without memory leak?

2017-09-25 Thread Dan Kortschak
Just to clarify, this is from context discussing Aaron's code. On Mon, 2017-09-25 at 17:38 -0700, 'Keith Randall' via golang-nuts wrote: > I see a couple of issues with your code. >  > On Monday, September 25, 2017 at 5:14:22 PM UTC-7, kortschak wrote: > >  -- You received this message because

Re: [go-nuts] How to remove a struct value from a struct slice without memory leak?

2017-09-25 Thread Dan Kortschak
This is not nice if you want to reuse the slice, and still may leak the fields. clients[i] = clients[len(clients)-1] // If the current clients[i] is deleted it becomes inaccessible // and the ipAddr, name and conn fields potentially leak, so // zero them in the last position of the slice.

Re: [go-nuts] Re: expected bahaviour for fmt.Stringer within a container in a struct?

2017-08-31 Thread Dan Kortschak
Well that's dumb of me - too busy thinking about other details and forgetting the language I was speaking. Thanks. On Thu, 2017-08-31 at 01:24 -0700, moehrmann via golang-nuts wrote: > m is an unexported Field. fmt can not use interface() on the reflect > values  > to then call String on them on

[go-nuts] expected bahaviour for fmt.Stringer within a container in a struct?

2017-08-31 Thread Dan Kortschak
What is the expected behaviour for this code? https://play.golang.org/p/tp9YNQZRMo ``` package main import ( "fmt" ) type char int func (c char) String() string { return string(c) } type st struct { m map[int]interface{} } func main() { a := char('A') s :=

Re: [go-nuts] Why does assigning a function variable to a method value allocate memory?

2017-08-27 Thread Dan Kortschak
I've long liked using ragel, but I have to say that with the projects bus factor and recent removal of Go code generation, it's less attractive than it used to be. On Wed, 2017-08-23 at 23:56 -0700, Tamás Gulácsi wrote: > See ragel for an fsm generator! -- You received this message because you

Re: [go-nuts] check for *string that is nil

2017-08-22 Thread Dan Kortschak
Is there a reason to have the fields be *string rather than just string? On Tue, 2017-08-22 at 15:48 -0700, Eric Brown wrote: > Let's say I have a struct... > > type Contact struct { >  Id    int `json:"id"` >  FirstName *string `json:"firstname"` >  LastName  *string `json:"lastname"` >

Re: [go-nuts] Seemingly peculiar behavior with nil checks on pointers to structs encapsulating interfaces.

2017-08-21 Thread Dan Kortschak
This is explained here https://golang.org/doc/faq#nil_error On Mon, 2017-08-21 at 09:41 -0700, ellief...@gmail.com wrote: > Hi, > > I just bumped heads with an odd behavior that I can't quite wrap my > head  > around involving nil pointers to structs that encapsulate interfaces. > > The setup

Re: [go-nuts] Calling Julia from Go

2017-08-17 Thread Dan Kortschak
What is it that you want to do in Julia? On Wed, 2017-08-16 at 23:57 -0700, mrech...@gmail.com wrote: > I would like to implement a valuation server. For the whole server  > infrastructure I would like to use Go, because it feels more natural > than  > any other language for it. For the

Re: [go-nuts] Is there a more efficient way to slice a multidimensional matrix using proxy?

2017-08-12 Thread Dan Kortschak
The cap fields allow us to resize back to the original size (just the same as a cap in a Go slice). This is not necessary for any case where only slicing to a smaller size is needed. The allocation that we do in making a new *Dense would not be needed if the mat.Matrix returned did not modify its

Re: [go-nuts] Is there a more efficient way to slice a multidimensional matrix using proxy?

2017-08-12 Thread Dan Kortschak
We implement this for first and second order tensors in gonum.org/v1/gonum/mat[1], which you are welcome to borrow from to extend to third order. Our slice operation[2] is in principle non- allocating (though we do allocate a container for generality - a non- allocating version would simply not

Re: [go-nuts] cgo related error assigning from a ((size_T)(-1)) define

2017-08-10 Thread Dan Kortschak
Yeah, that doesn't work. Returning the value from the C.func does though. The whole system is pretty queasy-making. (Looking at the internal behaviour of SetSize, it should probably not take a uint64, since it expects a -1 sentinel for variable length). On Thu, 2017-08-10 at 12:00 +0100, roger

[go-nuts] cgo related error assigning from a ((size_T)(-1)) define

2017-08-10 Thread Dan Kortschak
I'm pretty sure this should never have worked, but it seemed to previously and now it doesn't. In the gonum/hdf5 package there is a var declared against an HDF5 define like so, `var h5t_VARIABLE int64 = C.H5T_VARIABLE`[1]. `H5T_VARIABLE` is defined in H5Tpublic.h as `#define H5T_VARIABLE

Re: [go-nuts] Can warnings of race detector be ignored and toleranted?

2017-08-08 Thread Dan Kortschak
No. https://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-wha t-could-possibly-go-wrong On Tue, 2017-08-08 at 19:52 -0700, Cholerae Hu wrote: > Some of my colleagues think that, in some cases, such as > approximately  > counting the sum total of requests, we don't need to know the

Re: [go-nuts] Re: [Go2] Reflect

2017-08-06 Thread Dan Kortschak
>From the Laws of Reflection[1]: > It's a powerful tool that should be used with care and avoided unless > strictly necessary.  The reflect package is not mentioned in the spec (except once to discuss struct tags), adding a built-in would require its definition there, and complicate the

Re: [go-nuts] [Go2] Reflect

2017-08-05 Thread Dan Kortschak
On Sat, 2017-08-05 at 09:58 -0700, Gert wrote: > Reflect should be a generic way of Go2, but everytime i need to > reflect  > around a Go1 interface i want to go on a vacation... Then the API is working! -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Re: Go one-line installer

2017-08-01 Thread Dan Kortschak
Thanks. On Tue, 2017-08-01 at 19:14 -0700, Steve Francia wrote: > > On Tuesday, August 1, 2017 at 7:49:32 PM UTC-4, Florin Pățan wrote: > > > > > > Hi, > > > > The idea is good but: > > - it needs to modify the path to add GOROOT/bin and GOPATH/bin to > > it > > > It does. If it didn't do

Re: [go-nuts] Re: Generics are overrated.

2017-08-01 Thread Dan Kortschak
On Tue, 2017-08-01 at 09:21 +0200, Sebastien Binet wrote: > the other place I had (very recently) felt they could have been > useful: >  - having a mat.Dense of math/big.Rat (in lieu of a mat.Dense of > float64) I think that would be very hard. The reasons behind this claim are that there is lot

Re: [go-nuts] Re: Generics are overrated.

2017-07-31 Thread Dan Kortschak
We use sets in the graph packages, but the number of set types is pretty limited (sets of nodes and sets of either int or int64) and map[T] works for that level of use. The only other place where it might be useful for us is in in place of generating float32 versions of float64 blas and lapack

Re: [go-nuts] Re: No Allman-Style, No go!

2017-07-27 Thread Dan Kortschak
Lovely post, Michael, as usual. http://photobucket.com/gallery/user/Clayskater/media/bWVkaWFJZDoxNzA1MjQzMDM=/ I ran out of pop-corn for this thread some years ago. Does anyone know where I can get some more? It must be butter soaked, cooked over coals and served in a silver tureen, otherwise I

Re: [go-nuts] Re: Named or unnamed struct initialisation? What is best practice?

2017-07-16 Thread Dan Kortschak
Yes, trailing zero-size elements affect the size. https://play.golang.org/p/Ox0FJX3C5V https://github.com/golang/go/commit/6f07ac2f280847ee0346b871b23cab90869f84a4 On Tue, 2017-07-11 at 20:34 -0700, Rader wrote: > I found the position of `[0]byte` in the struct matters.  >  type bar2 struct { >

Re: [go-nuts] Re: Named or unnamed struct initialisation? What is best practice?

2017-07-16 Thread Dan Kortschak
Both are used. On Wed, 2017-07-12 at 11:43 +, Matthew Zimmerman wrote: > Why not use struct{}?  Is what is recommended for maps to notate a > set > (only the keys mean something). -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Re: Named or unnamed struct initialisation? What is best practice?

2017-07-05 Thread Dan Kortschak
On Wed, 2017-07-05 at 17:26 -0700, rsr via golang-nuts wrote: > type bar struct { >    A int >    _ bool > } or `type bar struct { A int; _ [0]byte }` to avoid the additional byte use. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] unexpected strconv.FormatFloat behaviour

2017-07-02 Thread Dan Kortschak
Thanks Rémy. Welcome back. On Sun, 2017-07-02 at 09:04 +0200, Rémy Oudompheng wrote: > 2017-07-02 6:20 GMT+02:00 Dan Kortschak <dan.kortsc...@adelaide.edu.a > u>: > > > > Is this expected: > > > > ``` > > package main > > >

[go-nuts] unexpected strconv.FormatFloat behaviour

2017-07-01 Thread Dan Kortschak
Is this expected: ``` package main import ( "fmt" "strconv" ) func main() { fmt.Print(strconv.FormatFloat(0.5, 'f', 0, 64)) } ``` ``` 0 ``` https://play.golang.org/p/HEyxpGPrX3 This is truncating, not rounding. -- You received this message because you are subscribed

[go-nuts] fun: Gödel Escher Bach typogenetics game implemented in Go

2017-06-20 Thread Dan Kortschak
This is the bare bones implementation to allow playing with the game. Unstated assumptions from the book are not guessed at and the system is fairly broadly configurable. https://github.com/kortschak/typo -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Go For Data analysts

2017-06-02 Thread Dan Kortschak
On Thu, 2017-06-01 at 23:31 -0700, Vikram Rawat wrote: > Does anybody actually uses GO for data Analysis... Yes, they do. https://github.com/gophercon/2016-talks/tree/master/DanielWhitenack-GoForDataScience https://www.youtube.com/watch?v=D5tDubyXLrQ > Can it be used for Data analysis Yes, it

Re: [go-nuts] present tool running snippet on native client: "Native Client nameservice: not implemented on Native Client"

2017-05-30 Thread Dan Kortschak
It looks like the go version hits this. Updating to a more recent go install fixes the problem (the previous was go1.3.1). On Tue, 2017-05-30 at 15:38 +0930, Dan Kortschak wrote: > I have just updated (after some years) a server I use for presenting > course material to NaCl pepper_49 (prev

[go-nuts] present tool running snippet on native client: "Native Client nameservice: not implemented on Native Client"

2017-05-30 Thread Dan Kortschak
I have just updated (after some years) a server I use for presenting course material to NaCl pepper_49 (previously pepper_39). The runnable examples I have work, however stderr is contaminated with the string "Native Client nameservice: not implemented on Native Client". The documentation for

Re: [go-nuts] Re: Go 1.8.1 is released

2017-05-08 Thread Dan Kortschak
Is github not visible from there? If it is, clone the repos from github to the expected locations for $GOPATH and $GOROOT. On Mon, 2017-05-08 at 19:39 +0500, Micky wrote: > It's just politics! > > Simply use a VPN, Tor or a proxy to bypass the filter! -- You received this message because you

Re: [go-nuts] Recover considered harmful

2017-04-24 Thread Dan Kortschak
We (gonum) would extend the security exception to include scientific code; there are far too many peer reviewed works that depend on code that will blithely continue after an error condition that should stop execution or log failure. These can and do end up contributing to costs of

Re: [go-nuts] Is it harmful to always return invalid values on a non-nil-error?

2017-04-04 Thread Dan Kortschak
On Tue, 2017-04-04 at 18:41 -0700, utyughj...@mail.com wrote: > case in point: https://play.golang.org/p/p7WtbMZj3O Why would you return a newly allocated [c]byte pointer in fooSTUPID instead of nil? That is *not* doing what is suggested, but rather returning a more likely valid and usable

Re: [go-nuts] Is it harmful to always return invalid values on a non-nil-error?

2017-04-04 Thread Dan Kortschak
There are cases in the standard library that explicitly intentionally return, or leave, invalid values in cases when they should not be used. This being the generalised case of this question. One of the clearest examples (others don't necessarily have comments) of this is in go/types/initorder.go

Re: [go-nuts] Why were tabs chosen for indentation?

2017-03-20 Thread Dan Kortschak
On Mon, 2017-03-20 at 09:45 +0100, 'Axel Wagner' via golang-nuts wrote: > The "philosophy of gofmt" was to end arguments about how go code > should be formatted. > Which gives this thread a special form of irony :) People will always adjust their behaviour to minimise the delta on their

Re: [go-nuts] How do I test an func which depends on (pseudo)-random numbers, e.g. rand.Intn()?

2017-03-14 Thread Dan Kortschak
If you let randSpaceline take a *rand.Rand then you can control the source of the randomness and arbitrarily set the seed. You also get the advantage of having a non-mutex protected rand source if you don't need it (we do a similar thing and used rand. if the *rand.Rand is nil as a convenience).

Re: [go-nuts] Why is Go Unicode concat so slow compared to Python3 ?

2017-02-27 Thread Dan Kortschak
When the python functions are actually called the comparison is more reasonable: ``` ~/concat $ go test -bench . concat_test.go  BenchmarkUnicodeConcat-8      20 10379 ns/op PASS ok  command-line-arguments 2.193s ~/concat $ python concat_test.py  time_taken = 8901.3030529

Re: [go-nuts] Goroutine in a for loop: Closure versus direct

2017-02-26 Thread Dan Kortschak
On Sat, 2017-02-25 at 09:03 +, Jan Mercl wrote: > They're not, #2 has a data race. There is no race, the go routine is not a closure. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

Re: [go-nuts] Question about net/http package implementation

2017-02-20 Thread Dan Kortschak
Yep. I was lazy though - I should have read the example and I could have made a more careful parse of the text to see a lone *or" that might have prompted further investigation. Historical note: /, * and _ were used in text only mail and on usenet prior to html markup contaminating email.

Re: [go-nuts] Question about net/http package implementation

2017-02-19 Thread Dan Kortschak
On Sat, 2017-02-18 at 23:15 +, Matt Harden wrote: > They didn't say ; they said r2 := *r. Also read the example. > They > returned instead of r2. The code is equivalent to but shorter > than the > original. After I read the example I realised that. However the text shows up on a text-only

Re: [go-nuts] Question about net/http package implementation

2017-02-18 Thread Dan Kortschak
On Fri, 2017-02-17 at 22:59 -0800, vova...@gmail.com wrote: > I'm wondering, if there's any benefit of writing* r2 := new(Request); > *r2 = *r *rather than shorter *r2 := *r (example below) *or this is > just matter of style preference? *r2 := *r is not legal.

Re: [go-nuts] go executable cross-compiled for arm5 works on amd64 (and arm5)

2017-02-16 Thread Dan Kortschak
Thank you. Yes, I had forgotten I'd installed that (needed for kernel building for the very same arm5 device). Dan On Thu, 2017-02-16 at 21:31 +1300, Michael Hudson-Doyle wrote: > Do you have qemu-user-static or a similarly named package installed? > Then > the magic of binfmt_misc may be

[go-nuts] go executable cross-compiled for arm5 works on amd64 (and arm5)

2017-02-15 Thread Dan Kortschak
Can someone explain to me why this works? I am cross-compiling for arm5, but the executable works on amd64. $ cat hello.go  package main import "fmt" func main() { fmt.Println("hello") } $ GOARCH=arm GOARM=5 go build hello.go  $ ./hello  hello $ go env GOARCH="amd64" GOBIN="" GOEXE=""

Re: [go-nuts] json: cannot unmarshal array into Go value of type main error

2017-02-02 Thread Dan Kortschak
You have handed json.Unmarshal a non-slice/non-array type. Try this https://play.golang.org/p/Zl5G_Rkt26 On Thu, 2017-02-02 at 15:15 -0800, Rejoy wrote: > I 'd like to unmarshal database records into a struct type. I get the > error "json:  > cannot unmarshal array into Go value of type main..".

Re: [go-nuts] strange behavior for type switch

2017-01-11 Thread Dan Kortschak
What are you trying to do? The behaviour of LimRange as you have it here is to return the float64 value of x if it is a float64, zero if it is another numerical type in the case list and NaN if it is none of those. I would suggest you read https://golang.org/ref/spec#Switch_statements 

Re: [go-nuts] strange behavior for type switch

2017-01-11 Thread Dan Kortschak
On Wed, 2017-01-11 at 17:15 -0800, hui zhang wrote: >    switch v := x.(type) { >    case int,int8,int16,int32: What type is v here? It can't be any of the four types you have listed in the case since are not assignable to each other without conversion, so it must be an interface{}. interface{}

Re: [go-nuts] image Gray16 endianness

2017-01-11 Thread Dan Kortschak
On Wed, 2017-01-11 at 16:46 +1100, Pablo Rozas Larraondo wrote: > Thanks Dan. I'm just surprised that Gray16 uses big endian when, for > example, Go's uint16 type uses the little endian convention. On *most* supported architectures. > I guess I find this weird and I want to know if there is a

Re: [go-nuts] image Gray16 endianness

2017-01-10 Thread Dan Kortschak
On Wed, 2017-01-11 at 16:21 +1100, Pablo Rozas Larraondo wrote: > I'm confused with image.Gray16 having pixel values represented in the > wrong order. It seems to me that image.Gray16 considers numbers to be > big endian instead of little endian. Why do you think that is the wrong order? Here is

Re: [go-nuts] Reset Slice with Make Every Time?

2017-01-09 Thread Dan Kortschak
On Mon, 2017-01-09 at 15:12 -0800, Tomi Häsä wrote: > Is this the correct way of resetting a slice? I mean do I always need > to  > use make to reset a slice? > > // initialize slice > > onearea Area = Area{} > > group []Area = make( []Area, 0, MAX ) > > // add stuff to slice >

Re: [go-nuts] RDF "encoding"

2016-11-27 Thread Dan Kortschak
On Sun, 2016-11-27 at 01:46 -0800, Johann Höchtl wrote: > Is there a standard to perform IRIs encoding? Would URL-encoding the > read  > part be acceptable and interoperable? There is a published grammar for RDF, which defines the IRI grammar used. This can be used to write a parser. An example

Re: [go-nuts] Inevitable unexpected EOF

2016-11-27 Thread Dan Kortschak
I don't see anywhere that you are closing the gzip.Writer. Does doing that fix the problem? On Fri, 2016-11-25 at 05:12 -0800, Connor wrote: > Hi all. > > I'm trying to implement a structure which gzips multiple  > individually-inflatable messages in the same data stream. I've built > an  >

Re: [go-nuts] Reaching infinity

2016-11-16 Thread Dan Kortschak
Rename it buzz_lightyear.go On Wed, 2016-11-16 at 13:58 -0800, Nikita Loskutov wrote: > Is anybody know how to increase "infinities count"? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

Re: [go-nuts] How to conv [3]int to []int ?

2016-11-11 Thread Dan Kortschak
That's not necessary. https://play.golang.org/p/_iHnithuxz What a[:] does is create a slice header with the address pointing to the zeroth element of a. The code that is generated is exactly the same for both (you can check this with go tool compile -S). On Thu, 2016-11-10 at 23:46 -0800,

Re: [go-nuts] How to conv [3]int to []int ?

2016-11-10 Thread Dan Kortschak
They have different layouts in memory. Do you just want to do this: package main import ( "fmt" ) func main() { a := [3]int{1, 2, 3} b := a[:] fmt.Println(b) } https://play.golang.org/p/OBY7g3azBE If so, there's no need for unsafe. If not, what are you trying

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Dan Kortschak
Thank you Michael for that. I have written a small package to help with this kind of uncertainty :) https://play.golang.org/p/vSnG-HGdrU On Mon, 2016-11-07 at 16:08 -0800, Michael Jones wrote: > Not precisely so…Interfaces, and type switches, and related > mechanisms are safe. Their type

<    1   2   3   4   5   6   7   >