Re: [go-nuts] Why isn't there "number plus" postfix syntax for more than or equal?

2020-04-23 Thread 'Dan Kortschak' via golang-nuts
I look forward to the addition of the definition of "in a handwavy sense" to the spec. On Thu, 2020-04-23 at 11:41 -0700, Michael Jones wrote: > You could extend the notation: > > If r 13+- { > // if r is close to 13, in a handwavy sense > : > } > > On Thu, Apr 23, 2020 at 9:43 AM Ian Lance

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-09 Thread 'Dan Kortschak' via golang-nuts
Yes, sorry. Eight years of habit is hard to break. I think I agree with you; a small bit of text in https://golang.org/ref/spec#Type_definitions linking to https://golang.org/ref/spec#Predeclared_identifiers and saying that there exist already defined types may ease this, or the suggestion you

Re: [go-nuts] Should an assignment from int to a type based on int succeed?

2020-05-09 Thread 'Dan Kortschak' via golang-nuts
In https://golang.org/ref/spec#Types a Type is defined in terms of a TypeName a TypeLit or a (Type). A TypeName is what makes a type a named type. This is defined as either an identifier or a qualified identifier. For the discussion here we can ignore the latter. An identifier contains letters and

[go-nuts] cgo godefs questions

2020-09-01 Thread 'Dan Kortschak' via golang-nuts
I am working on some C/Go interop code that includes this horror on the C side (TYPE_BITS is 5 and NAMED_BITS is 16): ``` struct sxpinfo_struct { SEXPTYPE type : TYPE_BITS; /* ==> (FUNSXP == 99) %% 2^5 == 3 == CLOSXP * -> warning:

Re: [go-nuts] cgo godefs questions

2020-09-01 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2020-09-01 at 17:03 -0700, Ian Lance Taylor wrote: > > This is a bug. Sent https://golang.org/cl/252378. > > I think that currently cgo -godefs ignores #cgo lines. This was > recently reported at https://golang.org/issue/41072. > > Ian Thanks, Ian for both of those. Dan -- You

Re: [go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-09-09 at 12:50 +0200, Jan Mercl wrote: > On Wed, Sep 9, 2020 at 12:41 PM Dan Kortschak > wrote: > > > I get the following > > > > ``` > > C alignof struct s: 8 > > Go alignof struct s: 8 > > Go alignofS: 8 > > ~/cznic $ go version > > go version go1.15.1 linux/arm64 > >

Re: [go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-09-09 at 13:21 +0200, Jan Mercl wrote: > > > On Wed, Sep 9, 2020 at 1:09 PM 'Dan Kortschak' via golang-nuts < > golang-nuts@googlegroups.com> wrote: > > > What does cgo -godefs give you? On my amd64 and arm64 I get this: > > > > ``` >

Re: [go-nuts] linux/arm struct alignment seems wrong

2020-09-09 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-09-09 at 12:19 +0200, Jan Mercl wrote: > Observation: > > pi@raspberrypi:~/src/tmp.tmp $ go version > go version go1.15.1 linux/arm > pi@raspberrypi:~/src/tmp.tmp $ cat main.go > package main > > /* > > struct s { > long long i; > } x; > > size_t align() { > return

Re: [go-nuts] Re: method resolution order

2020-09-16 Thread 'Dan Kortschak' via golang-nuts
Yes, it's sort of like asking what the best way to translate "This sentence is not Spanish." into Spanish; you can do it, but it doesn't make a lot of sense. On Wed, 2020-09-16 at 02:13 -0700, Volker Dobler wrote: > On Wednesday, 16 September 2020 at 10:51:27 UTC+2 > stephan...@gmail.com wrote:

Re: [go-nuts] obtaining the original type from a named alias type with go/types?

2020-08-21 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2020-08-15 at 21:44 -0700, Ian Lance Taylor wrote: > On Sat, Aug 15, 2020 at 3:45 PM 'Dan Kortschak' via golang-nuts > wrote: > > > > I would like to be able to obtain the original type for an alias > > given > > a source input. I can see in "g

Re: [go-nuts] obtaining the original type from a named alias type with go/types?

2020-08-21 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2020-08-21 at 21:51 -0700, Ian Lance Taylor wrote: > > > Thanks, Ian. > > > > No that doesn't work. For example with type byte, you get back the > > byte > > name. > > > > https://play.golang.org/p/PPjHBotsIsw > > The underlying type of byte is indeed byte. What are you hoping for? >

Re: [go-nuts] obtaining the original type from a named alias type with go/types?

2020-08-21 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2020-08-22 at 06:00 +0100, Paul Jolly wrote: > I think you were unlucky with your choice of type to experiment with. > My understanding is that byte is special cased, despite being an > alias: > >

Re: [go-nuts] [ANN] CGo-free sqlite database/sql driver 1.4.0 for linux/amd64 released

2020-08-26 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-08-26 at 23:50 +0200, Jan Mercl wrote: > From the change log ( > https://godoc.org/modernc.org/sqlite#hdr-Changelog) > > 2020-08-26 v1.4.0: > > First stable release for linux/amd64. The database/sql driver and its > tests are CGo free. Tests of the translated sqlite3.c library still

Re: [go-nuts] Nondeterministic Behavior of for Loop Ranging Over a map

2020-05-26 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2020-05-26 at 16:26 +1000, Jesse McNelis wrote: > On Tue, May 26, 2020 at 3:37 PM Paul Jolly wrote: > > > Why the output of this code is nondeterministic? > > > > See https://golang.org/ref/spec#For_statements, specifically the > > "For > > statements with range clause" subheading,

Re: [go-nuts] Generics and parentheses

2020-07-15 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-07-15 at 14:36 -0700, Randall O'Reilly wrote: > And the use of [ ] in map is more semantically associated with its > conventional use as an element accessor in arrays / slices, not with > some more general kind of type parameter. The [] syntax can be viewed as an indexing operation

Re: [go-nuts] Generics and parentheses

2020-07-15 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-07-15 at 15:27 -0700, Bakul Shah wrote: > The second issue is the usage for generic functions. Contrast > > (float64, int)PowN(1.2, 3) > with > PowN[float64, int](1.2, 3) > or currently > PowN(float64, int)(1.2, 3) > > I find the alternate syntax easier because

Re: [go-nuts] Generics and parentheses

2020-07-15 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-07-15 at 17:10 -0500, Seebs wrote: > That said, if people don't like square brackets, I'm totally prepared > to make worse suggestions until they give up and say square brackets > aren't that bad. > Let's bring back the special five keywords! func despiteallobjections F insofaras

Re: [go-nuts] A few thoughts on type parameters

2020-08-03 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2020-08-03 at 10:45 -0700, Ian Lance Taylor wrote: > Another possibility is constraints.Any, although that is no shorter > than interface{}. I'm not sure _ is best; currently _ fairly > consistently means "ignore this value," but in this usage it would > mean something different. Another

[go-nuts] gophers analysing genomes

2020-08-06 Thread 'Dan Kortschak' via golang-nuts
The genome of the New Zealand 'lizard', the tuatara[1], has just been sequenced and published in Nature[2,3]. The analysis of the genome included an examination of the repetitive sequences within the genome. The engine for finding novel repeats for this analysis is written in Go. Gophers analyse

Re: [go-nuts] How to print arrays with commas and brackets

2020-08-07 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2019-10-09 at 06:02 -0700, Nalin Pushpakumara wrote: > Hi, > I tried to print array with brackets and commas in golang. I want to > get > array like this. > ["record1", "record2". "record3"] > > Does anyone know how to do it? > > Thank you > Not the most efficient, but simple and

Re: [go-nuts] gophers analysing genomes

2020-08-06 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2020-08-06 at 07:41 +, Sebastien Binet wrote: > ‐‐‐ Original Message ‐‐‐ > On Thursday, August 6, 2020 9:16 AM, 'Dan Kortschak' via golang-nuts > wrote: > > > The genome of the New Zealand 'lizard', the tuatara[1], has just > > been > > sequenc

Re: [go-nuts] Bitstring package?

2020-06-29 Thread 'Dan Kortschak' via golang-nuts
Probably math/big.Int will do what you want. Dan On Mon, 2020-06-29 at 18:58 -0700, hardconnect@gmail.com wrote: > I'm looking for a package that implements arbitrary length bit > strings and > supports set all, clear all, set and reading back of arbitrary bits > and setting and clearing

Re: [go-nuts] Generics and parentheses

2020-07-15 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2020-07-14 at 23:05 -0700, Bakul Shah wrote: > I don't much like square brackets or angle brackets or guillemets. > But here is a different way > of reducing the need for parentheses at least for the common case: > > A proposal for fewer irritating parentheses! > > One thing to note

Re: [go-nuts] Generics and parentheses

2020-07-15 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2020-07-14 at 23:53 -0700, Randall O'Reilly wrote: > So, essentially, this puts the onus back on the parser programmers to > definitively *rule out* the use of < > -- is it really that difficult > / costly to do a bit of look-ahead and disambiguate the different use > cases? The absence

[go-nuts] retaining mapiterkey return values in *reflect.MapIter

2020-06-30 Thread 'Dan Kortschak' via golang-nuts
Is there a reason not to retain the returned value from `mapiterkey` on line 1243 of reflect/value.go[1] for use on line 1249[2]. ``` // Key returns the key of the iterator's current map entry. func (it *MapIter) Key() Value { if it.it == nil { panic("MapIter.Key called

Re: [go-nuts] retaining mapiterkey return values in *reflect.MapIter

2020-06-30 Thread 'Dan Kortschak' via golang-nuts
actually leaning towards the similarity being a benefit and one that would be broken by retaining the value. Dan On Tue, 2020-06-30 at 19:24 -0700, Ian Lance Taylor wrote: > On Tue, Jun 30, 2020 at 6:39 PM 'Dan Kortschak' via golang-nuts > wrote: > > > > Is there a reason not to r

[go-nuts] generics and absence of ability to specify correlated types

2020-06-17 Thread 'Dan Kortschak' via golang-nuts
Since this has come up again in [1], I would like to re-raise the issue of being able to correlate float and complex types so that a func(float32) complex64/func(float64) complex128-like function can be written generically. This issue was raised in [2] in the last round of generics discussions

Re: [go-nuts] Re: go get with vanity import path and 404: fails

2020-06-20 Thread 'Dan Kortschak' via golang-nuts
Thanks to Tim and Eric Bajumpaa on slack. The issue was due to an error in minification where the quotes around the name attribute value are stripped. Turning off minification is an interim workaround while that is broken. Dan On Sat, 2020-06-20 at 18:10 -0700, Tim Heckman wrote: > Closing the

Re: [go-nuts] Re: go get with vanity import path and 404: fails

2020-06-21 Thread 'Dan Kortschak' via golang-nuts
As a follow-up to the follow-up, I have filed golang.org/issue/39748; the error is apparently not in minification, but in the go command's handling of html. The workaround remains the same. On Sun, 2020-06-21 at 03:23 +, Dan Kortschak wrote: > Thanks to Tim and Eric Bajumpaa on slack. > >

Re: [go-nuts] generics and absence of ability to specify correlated types

2020-06-18 Thread 'Dan Kortschak' via golang-nuts
With the multitude of answers for use of alternative syntaxes for specifying type parameter lists, is there a chance that this concern could be addressed? thanks Dan On Wed, 2020-06-17 at 11:24 +, 'Dan Kortschak' via golang-nuts wrote: > Since this has come up again in [1], I would l

[go-nuts] go get with vanity import path and 404: fails

2020-06-20 Thread 'Dan Kortschak' via golang-nuts
Yesterday we replaced the old gonum.org site with a new hugo build. This appears to have broken go get for clients that do not use proxy.golang.org or some other proxy that already has gonum.org/... cached (this includes gddo). ``` $ GOPROXY=direct go get gonum.org/v1/gonum go get

Re: [go-nuts] Re: pure-go implementation of sqlite

2020-06-16 Thread 'Dan Kortschak' via golang-nuts
This is at https://modernc.org/sqlite now, along with the rest of Jan's amazing things, https://gitlab.com/cznic. On Tue, 2020-06-16 at 12:27 -0700, Mandolyte wrote: > SQLite3 support is the stated goal of > https://github.com/elliotchance/c2go > > Also, I believe I tested this one a long time

Re: [go-nuts] net.go ok function's c != nil check right ?

2020-06-03 Thread 'Dan Kortschak' via golang-nuts
It's perfectly valid to call a method on a nil receiver, so long at the nil receiver is not dereferenced. https://play.golang.org/p/Z-zXlj0-eVy On Wed, 2020-06-03 at 00:03 -0700, apmat...@gmail.com wrote: > Read function at net.go is like this: > > func (c *conn) Read(b []byte) (int, error) {

Re: [go-nuts] compress/bzip2:Why is there only a decompression function, no compression function.

2020-06-08 Thread 'Dan Kortschak' via golang-nuts
Also see https://godoc.org/github.com/dsnet/compress/bzip2 and https://github.com/dsnet/compress/issues/58 On Mon, 2020-06-08 at 13:14 -0400, Sam Whited wrote: > See: https://github.com/golang/go/issues/4828 > > On Mon, Jun 8, 2020, at 05:09, lziqia...@gmail.com wrote: > > Why is there no bzip2

Re: [go-nuts] compress/bzip2:Why is there only a decompression function, no compression function.

2020-06-08 Thread 'Dan Kortschak' via golang-nuts
bzip2 compression is not trivial so making sure the review catches any issues will take time. Finding people with the relevant expertise and the time to do the review is not necessarily easy. Note that you can use the dsnet package. On Mon, 2020-06-08 at 18:55 -0700, lziqia...@gmail.com wrote: >

Re: [go-nuts] political fundraising on golang.org!

2020-06-14 Thread 'Dan Kortschak' via golang-nuts
In the context of a sufficiently large collection of people all actions are political to some degree, *including inaction and non-comment*. Where the boundary is for the degree on what constitutes a political action and what doesn't varies between people. On Sun, 2020-06-14 at 16:44 -0400, Eric

Re: [go-nuts] A question about copying

2020-07-25 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2020-07-25 at 01:09 -0700, chri...@surlykke.dk wrote: > &(*f1) > > would, first, create a copy of *f1, and then a pointer to that copy, > but evidently f2 becomes a pointer to the same struct as f1. Is this > something I should have deduced from the language spec? &(*p) says "give me

Re: [go-nuts] Generics and parentheses

2020-07-15 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-07-15 at 18:09 -0700, lotus.developer.mas...@gmail.com wrote: > Personally think this way is easier to read. In this way, I wrote a > few examples, which may be different from the creator Please post in unstyled plain text. It is almost impossible to read the code examples you have

Re: [go-nuts] Re: Generics and parentheses

2020-07-17 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2020-07-17 at 15:56 -0700, Jay Kay wrote: > How about a "-generics" compile flag that lets you select one pair > from a character set of [ ( { < « . This hits two of the things that Go doesn't do: 1. proliferation of compiler option flags 2. enabling dialect spliting -- You

Re: [go-nuts] Re: Generics and parentheses

2020-07-16 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2020-07-16 at 13:44 -0700, jpap wrote: > Notwithstanding a concise unambiguous alternative, I would rather > type parameters "stick out" so they are easily identified when > visually scanning through code. func ᕙ(⇀ X ↼‶)ᕗ GenericFunction(x X) ... -- You received this message because

[go-nuts] obtaining the original type from a named alias type with go/types?

2020-08-15 Thread 'Dan Kortschak' via golang-nuts
I would like to be able to obtain the original type for an alias given a source input. I can see in "go/types" that it's possible to know whether a named type is an alias by `typ.Obj().IsAlias()`, but I cannot see how to obtain the actual original type unless it is an alias for a basic type. Can

Re: [go-nuts] Re: Generics - please provide real life problems

2020-12-25 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2020-12-25 at 18:11 +0100, Martin Hanson wrote: > > What are you on about!? This is my second post on this list, and even > though both are about > generics, they are adequately different to be kept about otherwise it > becomes a big mess. Some mailers do not properly handle headers

Re: [go-nuts] Online service to run Go code with Go modules support

2020-11-20 Thread 'Dan Kortschak' via golang-nuts
That's not an error. https://github.com/rsc/quote/blob/754f68430672776c84704e2d10209a6ec700cd64/quote.go#L22-L24 On Fri, 2020-11-20 at 17:49 -0800, Alexey Melezhik wrote: > Thanks. I receive " Don't communicate by sharing memory, share memory > by communicating. " error (?) when run the example

Re: [go-nuts] Generics - please provide real life problems

2020-12-24 Thread 'Dan Kortschak' via golang-nuts
I agree. A lot of Gonum code would be greatly simplified with the availability of generics, particularly the linear algebra part. The graph packages would be richer and we could do more things with tensor-like operations. On Wed, 2020-12-23 at 23:54 -0800, Marcin Romaszewicz wrote: > Those are

Re: [go-nuts] Obtaining an efficient hash for Go values

2020-12-24 Thread 'Dan Kortschak' via golang-nuts
You can also use the internal map implementation and make us of the runtime's map iterator. This is relatively straightforward at the cost of vigilance for changes in the runtime. Here is an example (note that yo need a .S file as well to get the go:linkname magic to work).

Re: [go-nuts] printing an empty slice with fmt.Printf()

2020-12-18 Thread 'Dan Kortschak' via golang-nuts
I think that's the question. Here's a simpler example, https://play.golang.org/p/9Kv3PhlM-OF That is, is 00 an expected %02x representation of a zero-length byte slice? The answer to that is yes; the 02 forces leading zeros. The %x verb essentially renders bit strings as hex, so a zero-length

Re: [go-nuts] using the xml package with data with complex name spacing

2020-12-14 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2020-12-14 at 13:53 +, Sam Whited wrote: > In the example you provided it is working as expected. The element > you're unmarshaling is in the " > http://www.w3.org/1999/02/22-rdf-syntax-ns#; namespace (it has an > "rdf" > prefix) but the thing you're unmarshaling it into expects >

[go-nuts] using the xml package with data with complex name spacing

2020-12-13 Thread 'Dan Kortschak' via golang-nuts
I'm needing to consume some XML which has a namespace identifier reused. http://purl.obolibrary.org/obo/go/subsets/goslim_yeast.owl#; xml:base="http://purl.obolibrary.org/obo/go/subsets/goslim_yeast.owl; xmlns:go="http://purl.obolibrary.org/obo/go#;

Re: [go-nuts] go list "go:generate" files

2020-11-10 Thread 'Dan Kortschak' via golang-nuts
//go:generate is not limited to dependency on Go source files, so this is not possible in the general case. On Tue, 2020-11-10 at 01:05 -0800, gta wrote: > Thanks for the reply, > yes I know I can grep for those files, but I was hoping that go list > could give me the files in the reverse

Re: [go-nuts] Re: use same for/range code on a hash map but it has different result

2020-11-10 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2020-11-10 at 19:08 -0800, 'Kilos' via golang-nuts wrote: > Thanks for reply, but I want to know the underlying reason about it, > I think the reason is in how the runtime functions works. The direct cause is that the hash function used for the map implementation is seeded from the system

Re: [go-nuts] Let Go also support manual memory management, a good or bad idea?

2020-11-15 Thread 'Dan Kortschak' via golang-nuts
This can already be done using C.malloc and C.free. You won't have access to map types using a Cgo allocator, but then you wouldn't if you had to allocate using built-ins either. On Sun, 2020-11-15 at 17:37 -0800, tapi...@gmail.com wrote: > For example, by adding two new built-in functions: alloc

Re: [go-nuts] detecting cyclic references

2020-11-14 Thread 'Dan Kortschak' via golang-nuts
Or github.com/kortschak/utter . This package does an arguably better job at dealing with self- referencing structures. On Sat, 2020-11-14 at 03:52 -0800, twp...@gmail.com wrote: > > My use case is that I want to pretty print in-memory objects for > debug purposes during testing, and one of the

Re: [go-nuts] Go modules in gihub repos

2020-11-19 Thread 'Dan Kortschak' via golang-nuts
You should tag the version with the path to the module root: for example path/from/root/v1.2.3 On Thu, 2020-11-19 at 18:58 -0800, Victor Denisov wrote: > Hi, > > I've recently encountered an interesting behavior of go modules. > I have a library in a repository on github. The go.mod file for

Re: [go-nuts] Go modules in gihub repos

2020-11-19 Thread 'Dan Kortschak' via golang-nuts
Reference: https://golang.org/ref/mod#vcs-version > If a module is defined in a subdirectory within the repository, that > is, the module subdirectory portion of the module path is not empty, > then each tag name must be prefixed with the module subdirectory, > followed by a slash. For example,

Re: [go-nuts] Online service to run Go code with Go modules support

2020-11-20 Thread 'Dan Kortschak' via golang-nuts
It does, but it depends on how big of a dependency set is imported due to timeout. The example below does work. https://play.golang.org/p/WL-OhWYsx68 On Fri, 2020-11-20 at 22:45 +, Paul Jolly wrote: > Hi, > > > Hi go devs. I am thinking about brining up a service that would > > execute Go

Re: [go-nuts] Re: use same for/range code on a hash map but it has different result

2020-11-10 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2020-11-11 at 06:02 +, 'Dan Kortschak' via golang-nuts wrote: > So long as you take into account these caveats, mutating a map during > a range will not corrupt the map or other data structure, and will > cause your application to crash. s/will cause/will not cause/ -- You

Re: [go-nuts] Re: use same for/range code on a hash map but it has different result

2020-11-10 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2020-11-10 at 22:17 -0800, Kurtis Rader wrote: > Jeebus. H. Christ! Yes, you can "safely" mutate a map while iterating > over it. In as much as doing so will not result in a panic; although, > I'm not convinced that is true. The point of the O.P. is that they > expect the map mutation to

Re: [go-nuts] Re: use same for/range code on a hash map but it has different result

2020-11-10 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2020-11-10 at 20:28 -0800, 'Kilos' via golang-nuts wrote: > You cannot safely mutate a Go map while iterating over it with the > `range` operator. This is not true, depending on your definition of "safely". See https://golang.org/ref/spec#For_statements "For statements with range

Re: [go-nuts] Syntactic Sugar Idea for Go 2.0: until/unless, and postfix conditionals

2020-11-02 Thread 'Dan Kortschak' via golang-nuts
My first professional programming language was Perl, decades later I still wake up in a sweat thinking about post-fix conditionals and the 'unless' conditional. Please no. On Mon, 2020-11-02 at 14:26 -0800, Jeffrey Paul wrote: > Hello Gophers, > > There's two tiny pieces of syntactic sugar I

Re: [go-nuts] Syntactic Sugar Idea for Go 2.0: until/unless, and postfix conditionals

2020-11-02 Thread 'Dan Kortschak' via golang-nuts
There are two parts. The worse part is the negative conditional (unless), which has the problem that humans are bad at negations; nearly always when there is a complex condition with an "unless", it needs to be mentally refactored into an "if !" (when working through other people's bugs, I

Re: [go-nuts] Licence details of github.com/golang/sync

2020-10-30 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2020-10-29 at 22:54 -0700, Ian Lance Taylor wrote: > On Thu, Oct 29, 2020, 10:48 PM Denis Cheremisov < > denis.cheremi...@gmail.com> wrote: > > Well, as usual I wrote something in the way, not the real thing. > > > > The case is: > > > > - At my company we are using errgroup from that

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread 'Dan Kortschak' via golang-nuts
You're using go test, with -mod=readonly, but it's running your code with go run, without -mod=readonly. Either you'll need to unconditionally pass -mod=readonly to go run in the regression_test.go file, or find wether it's been passed to go test and then conditionally pass it to go run. On

Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-11-01 Thread 'Dan Kortschak' via golang-nuts
Ah, it just clicked. You're indirectly using go/packages, which will (unless configured not to), cause changes to the go.mod and go.sum file. This configuration happens for this by adding "-mod=readonly" to packages.Config.BuildFlags (I think). But this isn't exposed via the go/analysis API (the

Re: [go-nuts] strconv.ParseFloat panic

2020-11-06 Thread 'Dan Kortschak' via golang-nuts
The full panic would help, but somehow you have a string with a nil pointer that is 4 bytes long. Where is the string generated? Are you using Cgo? Have you run with the race detector? Also, what version of Go are you using? On Fri, 2020-11-06 at 00:00 -0800, blade...@gmail.com wrote: > i check

Re: [go-nuts] strconv.ParseFloat panic

2020-11-06 Thread 'Dan Kortschak' via golang-nuts
OK, so you're not using Cgo, that leaves some other unsafe use, a data race or unlikely some weird compiler bug. I'd start looking in api.handleDPriceRange to see where the string input to strconv.ParseFloat is being constructed. On Fri, 2020-11-06 at 01:10 -0800, blade...@gmail.com wrote: > go

Re: [go-nuts] Generics syntax suggestion

2021-01-19 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2021-01-19 at 20:01 +, Kevin Chadwick wrote: > I was inquiring about the possibility of no identifiers or > abstraction but simply like Gos non generic functions (possibly > reversed if needed). Using type OR type. > > func (String | []byte firstInput, myType | publicKey >

Re: [go-nuts] package is not in goroot

2021-01-19 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2021-01-19 at 13:54 -0800, Alexander Mills wrote: > i am getting this weird error message: > > package twitch/go-scripts/dynamo-creators-to-s3/lib is not in GOROOT > (/usr/local/Cellar/go/1.15.6/libexec/src/twitch/go-scripts/dynamo- > creators-to-s3/lib) > > my GOPATH=$PWD/scripts/go >

Re: [go-nuts] Generics syntax suggestion

2021-01-19 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2021-01-19 at 21:09 +, Kevin Chadwick wrote: > On January 19, 2021 8:22:01 PM UTC, 'Dan Kortschak' via golang-nuts < > golang-nuts@googlegroups.com> wrote: > > On Tue, 2021-01-19 at 20:01 +, Kevin Chadwick wrote: > > > I was inquiring about the po

Re: [go-nuts] Generics syntax suggestion

2021-01-19 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2021-01-19 at 22:44 +, Kevin Chadwick wrote: > On January 19, 2021 9:13:55 PM UTC, Levieux Michel < > mlevieu...@gmail.com> wrote: > > I think the question was: "given your proposal here, I can write > > func > > (string | []byte in1, string | []byte in2) which enforces that in1 > >

Re: [go-nuts] Interface arguments to generic functions

2021-01-19 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2021-01-19 at 21:38 -0800, Ian Lance Taylor wrote: > On Tue, Jan 19, 2021 at 8:41 PM Dan Kortschak > wrote: > > > > Would that work for non-comparable types? Say the T has an > > underlying > > []int type, then the comparison is not against nil and you end up > > with > > a panic. > >

Re: [go-nuts] package is not in goroot

2021-01-19 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2021-01-19 at 16:08 -0800, Alexander Mills wrote: > I have never seen the dot needed, I have used plenty of packages that > are in GOPATH but not GOROOT https://go.googlesource.com/go/+/go1.15.6/src/cmd/go/internal/search/search.go#542 This is why it is saying that it's expecting it to

Re: [go-nuts] How to improve the parallelism of go routine?

2021-02-02 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2021-02-01 at 23:48 -0800, 颜文泽 wrote: > This is my code: > 2021-02-02 15-45-01 的屏幕截图.png Please don't post code as images. -- 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

Re: [go-nuts] Knowing from documentation whether an interface is holding a pointer or a struct?

2021-06-08 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2021-06-08 at 07:57 -0500, robert engels wrote: > The following code is works fine from the developers perspective: > > https://play.golang.org/p/gC1XsSLvovM > > The developer says, oh cool, I see this great new 3P library that > does background logging - I want to use that instead. Hey, I

Re: [go-nuts] What is the point of gzip Reader.Close?

2021-06-22 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2021-06-22 at 12:45 -0500, Steven Penny wrote: > Thanks for the help, but I found a much simpler example: > > https://play.golang.org/p/EcitH-85X6S Yes, trivial examples also exist. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] What is the point of gzip Reader.Close?

2021-06-21 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2021-06-21 at 17:57 -0500, Steven Penny wrote: > > No, I gave a clear path that would lead to a case of a non-detected > > error when Close is not called. > > > > This seems like a really odd hill to die on, but it's your choice I > > guess. > > You calling "go look through 3200 lines of

Re: [go-nuts] What is the point of gzip Reader.Close?

2021-06-21 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2021-06-21 at 18:22 -0500, Steven Penny wrote: > I am not questioning anyones knowledge, I am just asking for a > demonstration, rather than "do it because we said so". https://play.golang.org/p/gwDnxVSQEM4 -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] What is the point of gzip Reader.Close?

2021-06-21 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2021-06-21 at 16:53 -0500, Steven Penny wrote: > > Again, the idiom is, if you get an `io.Closer`, `Close` should be > > called once > > you're done with it. > > Thanks for the responses, but I am not convinced. Other than "its > just good > practice", I havent seen a single concrete

Re: [go-nuts] What is the point of gzip Reader.Close?

2021-06-21 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2021-06-21 at 17:30 -0500, Steven Penny wrote: > > No other compress reader even has a Close method, so I think Im > > fine: > > - https://golang.org/pkg/compress/bzip2 > - https://golang.org/pkg/compress/flate > - https://golang.org/pkg/compress/lzw > -

Re: [go-nuts] What is the point of gzip Reader.Close?

2021-06-21 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2021-06-21 at 17:44 -0500, Steven Penny wrote: > and none has been able to provide a simple program that demonstrate a > problem that could arise from not closing gzip reader. No, I gave a clear path that would lead to a case of a non-detected error when Close is not called. This seems

Re: [go-nuts] How can I check error types of gRPC calls?

2021-05-15 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2021-05-15 at 04:47 -0700, cpu...@gmail.com wrote: > In my local code, I'm using things like > > if errors.Is(err, api.ErrMustRetry) { ... } > > How would I achieve the same on errors returned by the gRCP > interface? I've noticed these are wrapped: > > rpc error: code = Unknown desc =

Re: [go-nuts] SetMapIndex() equivalent for slice/array

2021-06-04 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2021-06-04 at 20:29 -0700, Deiter wrote: > The reflect package provides the SetMapIndex method for updating > elements in a map that are represented by a reflect.Value type, but I > don’t see an equivalent for array/slice. > The sample app (link provided below) includes an example of map >

Re: [go-nuts] Why the limit on regex repeat is 1000?

2021-06-06 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2021-06-06 at 18:14 +1000, Rob Pike wrote: > You are using a steamroller to press a shirt. Tomi Ungerer has already published this approach. https://kotonoha-books.ocnk.net/data/kotonoha-books/product/20160619_70ddf5.JPG -- You received this message because you are subscribed to the

Re: [go-nuts] Knowing from documentation whether an interface is holding a pointer or a struct?

2021-06-06 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2021-06-06 at 03:17 -0700, Brian Candler wrote: > When you assign a regular (non-pointer) value to an interface > variable, it does take a copy of that value: > https://play.golang.org/p/XyBREDL4BGw It depends on whether it's safe to leave uncopied or not. You can see this here

Re: [go-nuts] how to purge invalid tags from GOPROXY?

2021-06-30 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2021-06-30 at 15:45 -0700, 'Jay Conrod' via golang-nuts wrote: > Hi Sebastien, once a version is in proxy.golang.org, it usually can't > be removed. This is important to ensure that builds continue working > when a repository disappears upstream. > > You may want to publish a new version

Re: [go-nuts] Data race problem with mutex protected maps

2021-06-26 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2021-06-26 at 23:26 +0100, Rory Campbell-Lange wrote: > I'm trying to work out why I have a data race problem (on go 1.15 and > 1.16). > > *SearchResults.Set is called from several goroutines. I am trying to > avoid concurrent access to its two maps using a mutex, but this isn't > working.

Re: [go-nuts] Data race problem with mutex protected maps

2021-06-26 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2021-06-26 at 20:44 -0700, Ian Lance Taylor wrote: > Looks like you have multiple SearchResults values that refer to the > same map. Shouldn't that result in a panic, even without -race? Dan -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] rationale for math.Max(1, math.NaN()) => math.NaN()?

2021-04-27 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2021-04-26 at 23:28 -0700, christoph...@gmail.com wrote: > It seam that C is wrong on this one and Go is right. The rationale is > that a NaN must propagate through operations so that we can detect > problems (avoid silent NaNs). See https://en.wikipedia.org/wiki/NaN > > Thus any operation

[go-nuts] rationale for math.Max(1, math.NaN()) => math.NaN()?

2021-04-22 Thread 'Dan Kortschak' via golang-nuts
This is not something that I've thought about before, but the behaviour of math.Max when only one of its arguments is NaN does not agree with the C convention or the IEEE-754 standard behaviour for max (5.3.1 p19 "maxNum(x, y) is the canonicalized number y if x #include void main() {

Re: [go-nuts] R.I.P. Michael Jones

2021-02-04 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2021-02-05 at 00:12 +0100, Jan Mercl wrote: > https://www.geospatialworld.net/blogs/goodbye-michael-jones-the-man-who-gave-the-power-of-maps-in-our-hands/ Thank you for letting us know, Jan. He will be missed. -- You received this message because you are subscribed to the Google

Re: [go-nuts] Code style in golang compiler

2021-02-08 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2021-02-08 at 19:09 -0800, messi...@gmail.com wrote: > Hi, > > I'm reading the go compiler source code and found the following code > style in several places: > > > > Is there some special reasons to group n,m,p to a local struct? > > Why don't we just init n the following way:

Re: [go-nuts] Re: Parallel Matrix Multiplication

2021-03-25 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2021-03-25 at 14:20 -0400, jasm...@gmail.com wrote: > Blast from the past so it's hard to be sure, but I think that was how > many rows or columns to pick for parallel sub matrices to multiply. > > On Thu, Mar 25, 2021, 1:17 PM Gabriel Pcklub < > gabrielpckl...@gmail.com> wrote: > > Hello,

Re: [go-nuts] Oopses in standard-library documentation

2021-03-24 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2021-03-24 at 18:31 -0700, Scott Pakin wrote: > I just noticed that some of the package comments in the standard > library are coming from the wrong source file. Here are two examples > from a golang.org/pkg/ screenshot: > > > In the case of the former, src/os/exec/read3.go appears to be

Re: [go-nuts] Thanks

2021-03-24 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2021-03-24 at 22:09 +, alex breadman wrote: > Let's keep divisive political BS away from this lovely project. > > Glad to see the political header removed from the website, at least > on mobile. > > All lives matter. This too is a political statement. -- You received this message

Re: [go-nuts] [ANN] MQTT烙

2021-03-14 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2021-03-14 at 10:41 -0700, Pascal de Kloe wrote: > New MQTT client library + command line tool available. > > https://github.com/pascaldekloe/mqtt > > Comments are welcome. Did you consider using context.Context rather than quit channels? -- You received this message because you are

Re: [go-nuts] Re: [ANN] New german translations

2021-03-16 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2021-03-16 at 03:10 -0700, Haddock wrote: > Anyhow, if I hear how young people are talking nowadays, it makes me > sick. Die Funktion wurde "gecalled" und die Exception "gethrown". > Sometimes I fear the next generation will not have learned to watch > what their mind is doing. I might be

[go-nuts] addressing the issue of correlating built in structured types in generic code: float/complex

2021-03-14 Thread 'Dan Kortschak' via golang-nuts
Now that a proposal for an approach to generics has been approved[1], it seems like a good time to again[2] raise the issue of how to be able to write code that has correlated types where types are structured but built-in, and so fields are not available to examine. The only case of this in the

Re: [go-nuts] [ANN] MQTT烙

2021-03-14 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2021-03-14 at 15:08 -0700, Pascal de Kloe wrote: > > Did you consider using context.Context rather than quit channels? > > Applying a context.Context pretty much implies using a quit channel. > Done is the only way to receive an expiry signal. > > I just don't want to lock code into using

Re: [go-nuts] What does `go install path/to/main.go` do with GO111MODULE=on?

2021-03-10 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2021-03-10 at 15:20 -0800, Matt Mueller wrote: > I'm assuming this is by design, but it feels to me like go install > ./cmd/app/main.go silently failing is a bug. > > Is this worth opening an issue for? If it's a bug it's an error reporting bug. The go install command is documented to

Re: [go-nuts] Contrary to popular opinion...

2021-02-28 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2021-02-28 at 10:11 -0800, Bob Alexander wrote: > I never have understood the *serious* hatred of Python's "indentation > as syntax" approach. I've used lots of bracketed and begin/end > languages (C/C++, Algol & relatives, Ruby, and most other programming > languages), and when I write

Re: [go-nuts] go install, replace directive any ongoing discussions?

2021-03-07 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2021-03-07 at 07:57 +, Paul Jolly wrote: > Erroring on replace directives is an intentional decision for now: > https://github.com/golang/go/issues/40276#issue-659471259 > > But might be relaxed in the future: > > > Parts of this proposal are more strict than is technically > >

  1   2   3   >