Re: [go-nuts] Representing Optional/Variant Types Idiomatically (or not)

2021-06-17 Thread Jan Mercl
On Thu, Jun 17, 2021 at 9:43 AM Joshua wrote: > 1) I'm modelling a data type which has a field which may or may not be >there, would most Gophers reach for a pointer here, and use `nil' to >represent a missing value? That's the usual approach seen in the wild and IMO often the wrong one.

Re: [go-nuts] Re: Go 1.17 Beta 1 is released

2021-06-15 Thread Jan Mercl
On Mon, Jun 14, 2021 at 11:38 PM Ian Lance Taylor wrote: > Go 1.17 continues to support GOPATH mode if you explicitly set the > environment variable GO111MODULE=off. This is the same as Go 1.16. > See https://golang.org/ref/mod#mod-commands. Quoting from "New module changes in Go 1.16", 18 Febr

Re: [go-nuts] Are receiver copies atomic?

2021-06-08 Thread Jan Mercl
On Tue, Jun 8, 2021 at 12:08 PM Ian Davis wrote: > When a method with a non-pointer receiver is called, is the copy made > atomically? My intuition says it must be but perhaps someone else can confirm > it? I don't think the specs require that and I don't think well known implementations try t

Re: [go-nuts] Does anyone konw which proposal changes the access for embeded field name of struct?

2021-06-07 Thread Jan Mercl
On Mon, Jun 7, 2021 at 11:20 AM Ally Dale wrote: > I want to know why golang change the access method. The name of the programming language is Go. > Anyone who knows the isssue link, please reply me. Thanks a lot. There's no proposal and there's no issue. It always worked like that. You canno

Re: [go-nuts] Query on using Closures

2021-06-06 Thread Jan Mercl
On Sun, Jun 6, 2021 at 8:44 PM 'Suveetha Kamatchi' via golang-nuts wrote: Please post code as plain text, no colors, no inverted schema in particular. Or share code via a link at play.golang.org, thank you. -- You received this message because you are subscribed to the Google Groups "golang-nu

Re: [go-nuts] Computing a hash over a uintptr ?

2021-06-04 Thread Jan Mercl
On Fri, Jun 4, 2021 at 3:02 PM christoph...@gmail.com wrote: > > That is true in current implementations, but Go, the language, does not > > guarantee that pointers will never move. > > That is what I thought, but it is allowed to use a pointer far map keys. And > I have seen some programs/pack

Re: [go-nuts] Re: Is this a bug ?

2021-06-03 Thread Jan Mercl
On Thu, Jun 3, 2021 at 11:21 AM Brian Candler wrote: > > Weird. It simplifies to this: https://play.golang.org/p/OsOhRMC6kBu I think this case is WAI. >From https://golang.org/ref/spec#Operators " If the left operand of a non-constant shift expression is an untyped constant, it is first implic

Re: [go-nuts] Re: The last line makes the variable y escape. But should it?

2021-06-02 Thread Jan Mercl
On Wed, Jun 2, 2021 at 8:48 AM cheng dong wrote: > `y` escape because the println use interface{} as its parameter, println is a bootstrap function that the compiler knows about by itself. It's formal/pseudo signature does not use 'interface{}'. I haven't checked the actual implementation, but I

Re: [go-nuts] Re: Is the escape analysis reports accurate?

2021-06-01 Thread Jan Mercl
On Tue, Jun 1, 2021 at 4:40 PM tapi...@gmail.com wrote: > The following is a tip to get an array pointer but avoid the array escaping. I don't think so. The pointer to the local array 't', stored in 'y' never leaves the function, so there's no need for 't' to escape. See the previous post. > >

Re: [go-nuts] The last line makes the variable y escape. But should it?

2021-06-01 Thread Jan Mercl
On Tue, Jun 1, 2021 at 3:52 PM tapi...@gmail.com wrote: By default, any local variable that has its address taken and that address can outlive the function execution forces the variable to escape, quite naturally as the stack frame with the variable is destroyed upon returning from the function.

Re: [go-nuts] Table-driven benchmarks defeat inlining

2021-06-01 Thread Jan Mercl
On Tue, Jun 1, 2021 at 12:29 AM Paul S. R. Chisholm wrote: > P.S.: Out of curiosity, how can I post a message with fancy code examples > like this one? > https://groups.google.com/g/golang-nuts/c/5DgtH2Alt_I/m/hlsqdRSGAgAJ FTR, that's not fancy in my books. Code is best posted to email list

Re: [go-nuts] Value copy costs are not very predictable.

2021-05-30 Thread Jan Mercl
Within the benchmark loops of the linked code a sufficiently smart compiler can optimize the source values away completely and/or collapse all writes to the destination values to a single write. Have you looked at the actual code the CPU executes? > > -- You received this message because you ar

Re: [go-nuts] time.ParseInLocation fails silently

2021-05-28 Thread Jan Mercl
On Fri, May 28, 2021 at 12:32 PM NieomylnieJa wrote: > But the docs state something different: > > // ParseInLocation is like Parse but differs in two important ways. > // First, in the absence of time zone information, Parse interprets a time as > UTC; > // ParseInLocation interprets the time a

Re: [go-nuts] parameter name a of fmt package

2021-05-25 Thread Jan Mercl
On Tue, May 25, 2021 at 10:14 AM Delta Echo wrote: > What does the parameter name `a` stands for in fmt package's functions? > func Printf(format string, a ...interface{}) (n int, err error) > > Is it argument? It's a parameter name. ...interface{} is the type of that argument, variadic in this

Re: [go-nuts] Re: Is the escape analysis reports accurate?

2021-05-23 Thread Jan Mercl
On Sun, May 23, 2021 at 11:11 AM tapi...@gmail.com wrote: > > It says both "make([]T, N) does not escape" and "make([]T, N) escapes to > heap" for the slice allocated by g. What's conflicting about? You still did not explain that. I noted before that the code is different. Yes, the different co

Re: [go-nuts] Re: Is the escape analysis reports accurate?

2021-05-23 Thread Jan Mercl
On Sun, May 23, 2021 at 11:01 AM tapi...@gmail.com wrote: > And how to interpret the conflicting messages for the following program? Please share what conflict and where do you see it. I see only different escape/does not escape status for different code but nothing conflicting. -- You receiv

Re: [go-nuts] Syscalls that take structs with embedded pointers

2021-05-14 Thread Jan Mercl
On Fri, May 14, 2021 at 12:36 PM sh...@tigera.io wrote: > One way I could see to solve this would be to do some manual memory > management with MMap or BRK to allocate the buffer but I wondered if there > was an easier way? IMO using manual memory management _is_ the easy way in this case. I'm

Re: [go-nuts] defer and Go memory model

2021-05-12 Thread Jan Mercl
On Wed, May 12, 2021 at 7:55 PM Ge wrote: > Do you mean in following case if anthoer goroutine is observing A and B, > there is no possbility that A is 0 and B is 5? (assuming no other > synchronization here) > > ``` > var A, B int > func try() { > defer func() { B = 5 } > A = 3 > } The

Re: [go-nuts] defer and Go memory model

2021-05-12 Thread Jan Mercl
On Wed, May 12, 2021 at 4:38 PM Ge wrote: > > According to https://golang.org/ref/spec#Defer_statements there is such an > expression: > `A "defer" statement invokes a function whose execution is deferred to the > moment the surrounding function returns` > > Does `defer` ensure happens-before

Re: [go-nuts] Boxing bytes is faster than boxing integers within [0. 255]. Why?

2021-05-10 Thread Jan Mercl
On Mon, May 10, 2021 at 4:30 PM tapi...@gmail.com wrote: https://github.com/golang/go/commit/9828c43288a53d3df75b1f73edad0d037a91dff8 -- 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] problems using external modules with go 1.16.4

2021-05-07 Thread Jan Mercl
On Fri, May 7, 2021 at 3:21 PM natxo@gmail.com wrote: > I do not want to write a module, I just want to use a module. So how do I do > this? I am reading all the tutorials listed on the go help modules output, > but at this point I do not need to write a module. I don't know what "write a

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-05-05 Thread Jan Mercl
On Wed, May 5, 2021 at 6:56 PM Øyvind Teig wrote: > hiPri is a disconnect message of a smoke detetector. loPri is a fire alarm. > If the disconnect hiPri is activated before (1 sec to 1 ns) or simulatenously > (same polling of "hw pins") as the alarm loPri there should be no alarm being > sent

Re: [go-nuts] Recursive type definition

2021-05-03 Thread Jan Mercl
On Mon, May 3, 2021 at 6:44 PM Delta Echo wrote: > Hi, Is there any document that explains how recursive type definitions like > > type stateFn func(*Scanner) stateFn > > are handled in Go? Not sure what "handle" means in this case. The language specs do not mention recursive types, so what foll

Re: [go-nuts] How string constants are propagated inside a small func

2021-04-30 Thread Jan Mercl
On Fri, Apr 30, 2021 at 7:51 PM 'Valentin Deleplace' via golang-nuts wrote: > func f() string { > s := "a" + "b" > return s > } Handled by constant folding. > func g() string { > s := "a" > s += "b" > return s > } The second assignment to 's' here is not

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-04-29 Thread Jan Mercl
On Thu, Apr 29, 2021 at 3:54 PM Øyvind Teig wrote: > Even if that probability is low, it would need knowledge like yours to show > that this may in fact be zero. There could be a descheduling in between, one > of those in my opinion, not relevant arguments. The upper limit of 4c happening is 1

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-04-29 Thread Jan Mercl
On Thu, Apr 29, 2021 at 3:23 PM Øyvind Teig wrote: > 4c is not "correct" as I want it. In the pri select case, if more than one is > ready, then they shall not be randomly chosen. Never. They should be selected > according to priority. That's not what 4c says. Instead of "more than one ready"

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-04-29 Thread Jan Mercl
On Thu, Apr 29, 2021 at 2:26 PM Øyvind Teig wrote: > Your suggestion would in fact do pri select in the special case 1. below: > > Poll highPri first (take it if it's ready), if highPri not ready then take > lowPri (provided highPri has not become ready since the first poll) > However, if highPr

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-04-29 Thread Jan Mercl
On Thu, Apr 29, 2021 at 11:24 AM Øyvind Teig wrote: > This is not solved with a default clause, which transforms the selective > choice waiting for some event to happen into busy polling. It's nice yo have > some times, but that is something orthogonal to pri/ordered. Not sure if I would call

Re: [go-nuts] Still "missing" priority or ordered select in go?

2021-04-29 Thread Jan Mercl
On Thu, Apr 29, 2021 at 10:52 AM Øyvind Teig wrote: > I know from some years ago that go did not have any priority or ordered > select construct [1]. Not sure what does "ordered" wrt select mean, but the default clause of the select statement provides exactly that - a priority mechanism: first

Re: [go-nuts] tests, init() and flags

2021-04-24 Thread Jan Mercl
On Sat, Apr 24, 2021 at 10:37 PM Shivendra Singh wrote: > ..., now in the init() method it parses flag to read variables such as env > and app name that is required to load the appropriate config. IINM, calling flag.Parse anywhere else than in main() or TestMain() is not really compatible with

Re: [go-nuts] what is a &^= b means?

2021-04-24 Thread Jan Mercl
On Sat, Apr 24, 2021 at 2:42 PM xie cui wrote: > func f(a, b int) int { > a &^= b > return a > } > what is this op (&^=) means? There is a wonderful source of answers to such questions here: https://golang.org/ref/spec -- You received this message because you are subscribed to the Goog

Re: [go-nuts] Unexpected pointer dereference behavior

2021-04-22 Thread Jan Mercl
On Thu, Apr 22, 2021 at 1:39 PM Mikhail Mazurskiy wrote: > Thanks for the response, I didn't see this section. However, I'm still > confused as it says the exception in 3. only applies to fields, not to > methods. RLock() is obviously a method, not a field. You're right. And because the playgr

Re: [go-nuts] Unexpected pointer dereference behavior

2021-04-22 Thread Jan Mercl
On Thu, Apr 22, 2021 at 1:15 PM Mikhail Mazurskiy wrote: > I stumbled upon this strange looking piece of code [1]. I thought it > dereferences the pointer, creating a copy of the mutex, and then calls > RLock() on the copy (i.e. a nop). But it does not work this way. I > experimented with it [

Re: [go-nuts] Go Semantics Aware diff tool?

2021-04-14 Thread Jan Mercl
On Wed, Apr 14, 2021 at 1:51 PM Steve Mynott wrote: > I'm aware tools exist to parse go and a quick google search search > fails me but I was wondering if there was a utility which was a > go-aware diff which I could use like "git diff master" which printed > out a list of funcs changed? Would t

Re: [go-nuts] Why can I not install external packages?

2021-04-13 Thread Jan Mercl
On Tue, Apr 13, 2021 at 11:40 AM Tenjin wrote: > So I am using WSL2 to develop using golang but for some reason I am unable to > use other peoples packages. > For example: I am wanting to use the sql driver > https://github.com/go-sql-driver/mysql I am able to go get it and it says it > is dow

Re: [go-nuts] `for i, v := range` causes allocation

2021-04-12 Thread Jan Mercl
On Mon, Apr 12, 2021 at 6:01 PM Luke Wilson wrote: > I've heard several times from members of the community (on Matrix and > possibly on answers) that a simple iteration like > > const mixed = "\b5Ὂg̀9! ℃ᾭG" > for _, c := range mixed { > ... do something with c (but not write to it) > > will act

Re: [go-nuts] What is the easiest way to find out the source hosting url of a thrid-party dependency module/package?

2021-04-08 Thread Jan Mercl
On Thu, Apr 8, 2021 at 5:18 PM tapi...@gmail.com wrote: > It looks such info is not recorded in GOPATH/pkg/mod. Do you mean the import path to repository URL mapping? jnml@e5-1650:~/tmp$ wget modernc.org/sqlite && grep go- sqlite --2021-04-08 17:23:49-- http://modernc.org/sqlite Resolving mode

Re: [go-nuts] GOOGLE LLC v. ORACLE AMERICA, INC.

2021-04-05 Thread Jan Mercl
On Mon, Apr 5, 2021 at 5:17 PM peterGo wrote: > Held: Google’s copying of the Java SE API, which included only those lines of > code that were needed to allow programmers to put their accrued talents to > work in a new and transformative program, was a fair use of that material as > a matter o

Re: [go-nuts] Re: [golang-dev] Go 1.16.3 and Go 1.15.11 are released

2021-04-02 Thread Jan Mercl
On Fri, Apr 2, 2021 at 4:40 PM Michael Pratt wrote: > mgcsweepbuf.go was deleted in 1.16, so it seems you still have files from > 1.15 sitting around in /usr/local/go/. I would swear I've deleted those files, but doing all the steps once again from scratch proves you are right and I can no more

[go-nuts] Re: [golang-dev] Go 1.16.3 and Go 1.15.11 are released

2021-04-02 Thread Jan Mercl
On Thu, Apr 1, 2021 at 11:52 PM Dmitri Shuralyov wrote: > We have just released Go versions 1.16.3 and 1.15.11, minor point releases. Cleared everything ($ go clean -cache -modcache -testcache ; rm -rf ~/pkg ~/.cache/go-build) and upgraded from 1.15.10 to 1.16.3. Now I am seeing while hacking so

Re: [go-nuts] What's the BUG in the flag package?

2021-03-24 Thread Jan Mercl
On Wed, Mar 24, 2021 at 11:25 PM Matt Mueller wrote: > I noticed a lonely BUG comment without an explanation in the flag package: > https://github.com/golang/go/blob/master/src/flag/flag.go#L955 Looking at the code it seems to me that the comment is saying the _client_ code has a bug in that it

Re: [go-nuts] about untyped type?

2021-03-19 Thread Jan Mercl
On Fri, Mar 19, 2021 at 1:47 PM xie cui wrote: > https://github.com/golang/go/blob/master/src/cmd/compile/internal/types2/universe.go#L58-L64 > there are some basic type call untyped xxx? what is it mean? Untyped bool, int, etc are the types of untyped constants: https://golang.org/ref/spec#Cons

Re: [go-nuts] Some questions about the memory allocation strategy of channel

2021-03-19 Thread Jan Mercl
On Fri, Mar 19, 2021 at 4:36 AM Paul Zhang wrote: Please do not post colorized code to the ML. Particularly with inverted colors. Please use plain black on white text, thank you. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe fr

Re: [go-nuts] Re: build world question

2021-03-18 Thread Jan Mercl
On Thu, Mar 18, 2021 at 4:51 PM Brian Candler wrote: > OK. I'll just point out that if the repo contains a set of related packages, > then normally you'd only put a go.mod at the top level. I think the OP never mentioned a repository but "world". I infer that means all the repositories the OP

Re: [go-nuts] About the efficency of modifying map elements.

2021-03-17 Thread Jan Mercl
On Wed, Mar 17, 2021 at 9:18 PM tapi...@gmail.com wrote: > Now, to modify a map element, especially the element type is not a basic > type, two hashes are needed to compute. https://github.com/golang/go/issues/5147 -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Supporting contained zip archives inside of tar and zip archives

2021-03-17 Thread Jan Mercl
On Wed, Mar 17, 2021 at 7:38 PM Glen Newton wrote: > > zip archives contain files and directories. Often, some of the files > contained in zip archives are also archives, zip and tar(.gz|bz2). Sometimes, > these contained archives also contain such archives (and so on...). > > Reading a zip file

Re: [go-nuts] How to search standard libarary?

2021-03-17 Thread Jan Mercl
On Wed, Mar 17, 2021 at 4:59 PM jake...@gmail.com wrote: > > On Tuesday, March 16, 2021 at 11:59:31 AM UTC-4 Jan Mercl wrote: >> >> Entering `rename site:golang.org/pkg` in Chrome seems to work well, for >> example. >> >> (But I'm not using this kin

Re: [go-nuts] now that the election is over can we please remove the political ad for golang.org

2021-03-17 Thread Jan Mercl
On Wed, Mar 17, 2021 at 10:57 AM mortdeus wrote: I'm probably giving up any hopes to work for Google in the future by writing this: +1. I find the banner deeply offensive, divisive and excluding for people with dissenting views, regardless of the omnipresent inclusiveness narrative. I cannot stan

Re: [go-nuts] How to search standard libarary?

2021-03-16 Thread Jan Mercl
On Tue, Mar 16, 2021 at 4:53 PM jake...@gmail.com wrote: > It seems like a real oversight that there is no search on the official go > documentation though. It seems like it would be really helpful, especially to > beginners. I would love to hear from someone involved why the go team decided >

Re: [go-nuts] Is there a final document on generics?

2021-03-16 Thread Jan Mercl
On Tue, Mar 16, 2021 at 1:10 PM 'Axel Wagner' via golang-nuts wrote: > On Tue, Mar 16, 2021 at 1:05 PM Robert Engels wrote: >> >> Failure to provide a standard “collections” package would be a huge mistake. >> It is certainly a top 3 reason for the success of Java. It would be probably a huge

Re: [go-nuts] Searching recursively in GOLANG

2021-03-15 Thread Jan Mercl
On Tue, Mar 16, 2021 at 7:06 AM Sharan Guhan wrote: > Seems a trivial problem, but unable to find the right imports to do this.. > Want to search for a substring in a huge string ( output of a exec.command) > and get the index for every occurrence of that substring. I used Index and > LastInd

Re: [go-nuts] No generic, part -2

2021-03-15 Thread Jan Mercl
On Mon, Mar 15, 2021 at 11:03 PM Ian Lance Taylor wrote: > The formal proposal (https://golang.org/issue/43651) got 1784 thumbs > up and 123 thumbs down (and ten "confused"). Yes, there were critics. > But I think it is fair to say that the proposal has far more > supporters than critics. I thi

Re: [go-nuts] Why do type aliases change behaviour (i.e. json.Unmarshal)?

2021-03-15 Thread Jan Mercl
On Mon, Mar 15, 2021 at 1:49 PM cpu...@gmail.com wrote: > type WrappedToken Token Note that this is not a type alias. WrappedToken is a new type. Even if its underlying type is Token, WrappedToken does not automatically have any methods of Token. > Only to find out, that unmarshaling a WrappedT

Re: [go-nuts] Analysis check for leaked pointers to loop variable address

2021-03-15 Thread Jan Mercl
On Mon, Mar 15, 2021 at 3:03 AM Barisere Jonathan wrote: > I think this mistake can be caught by code analysis tools, but I don't know > of any that catches these. IMO the problem is that while sometimes it's a mistake, in some other cases it is not and it is perfectly good, reasonable code. Ne

Re: [go-nuts] insane idea to eliminate CGO latency

2021-03-14 Thread Jan Mercl
On Sun, Mar 14, 2021 at 12:57 PM Elias Naur wrote: > > Eg. if you really need to hook at battle-tested C code that needs no > > further maintenance, you may try https://github.com/minio/c2goasm > > It lets you bootstrap fast, then you may aim at a proper rewrite. > > > > A rewrite is one thing,

Re: [go-nuts] Auto Make a named return map

2021-03-13 Thread Jan Mercl
On Sat, Mar 13, 2021 at 5:52 PM Kevin Chadwick wrote: > Very little resources, unless the map is actually used and not for long. If > you really need to control gos memory use, you need to preallocate arrays in > a long standing manner anyway, not for maps though, as you can't delete > without

Re: [go-nuts] Re: go get v git clone

2021-03-13 Thread Jan Mercl
On Sat, Mar 13, 2021 at 4:57 PM arthurwil...@gmail.com wrote: > OK I'll try and figure out how to do that. What is a CL? Change List. A patch against the repository that implements a feature, fixes a bug etc. -- You received this message because you are subscribed to the Google Groups "golang

Re: [go-nuts] No generic, part -2

2021-03-13 Thread Jan Mercl
On Sat, Mar 13, 2021 at 4:43 PM 'Axel Wagner' via golang-nuts wrote: > > I don't think it is useful to quibble over the definition of "ignore". When I > said it is demonstrably false that arguments have been ignored, I was > assuming what I perceive to be the common definition: "refuse to take n

Re: [go-nuts] No generic, part -2

2021-03-13 Thread Jan Mercl
On Sat, Mar 13, 2021 at 4:18 PM Bruno Albuquerque wrote: > FWIIW, I also agree that "ignore" makes no sense here. You might listen and > think about several opinions/options and conclude that one of them is the > best one. This does not mean you ignored all the others. You do not ignore the di

Re: [go-nuts] Auto Make a named return map

2021-03-13 Thread Jan Mercl
On Fri, Mar 12, 2021 at 1:24 AM Kevin Chadwick wrote: > Why doesn't go auto init or make an empty map for a named return to avoid the > potential chance of a panic due to operating on a nil return? A non-zero value map value must be allocated. All well-known Go compilers allocate maps in heap.

Re: [go-nuts] No generic, part -2

2021-03-13 Thread Jan Mercl
On Sat, Mar 13, 2021 at 3:53 PM Axel Wagner wrote: > We have different interpretations of "ignore". To me, "ignore" means "be > unaware of or pretend they don't exist". > You seem to use it as "disagree about their validity or the weight they are > given in the decision". That seems questionabl

Re: [go-nuts] Re: go get v git clone

2021-03-13 Thread Jan Mercl
On Sat, Mar 13, 2021 at 3:35 PM arthurwil...@gmail.com wrote: > I just want to remove one thing go getted, not the entire cache. For new features one can fill a proposal. If accepted, a follow-up with the implementation CL is very nice -- You received this message because you are subscribed to

Re: [go-nuts] No generic, part -2

2021-03-13 Thread Jan Mercl
On Sat, Mar 13, 2021 at 3:31 PM 'Axel Wagner' via golang-nuts wrote: > I want to re-iterate: The discussion of whether or not generics will be added > to Go has been going on for more than a decade. All arguments from all sides > have gotten fair consideration. A decision was reached. > > You m

Re: [go-nuts] No generic, part -2

2021-03-13 Thread Jan Mercl
On Sat, Mar 13, 2021 at 1:44 PM Martin Schnabel wrote: > as far as i know there is no reason that anybody has to write code with > generics when they are available. therefor i really don't understand the > negative mails to this list. That nonchalantly ignores that code is way more often read th

Re: [go-nuts] Why this global variable assignment is deleted in the infinite loop?

2021-03-11 Thread Jan Mercl
On Thu, Mar 11, 2021 at 6:12 PM WX Lai <0xbill...@gmail.com> wrote: > The code: https://repl.it/talk/share/The-assignment-disappeared/127774 > > The assignment of the global variable `isRunning` in function `fg1` does not > work at all. > In fact, the assignment is deleted in the assembly (see th

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

2021-02-28 Thread Jan Mercl
On Sun, Feb 28, 2021 at 9:05 AM 'Dan Kortschak' via golang-nuts wrote: > I'm curious where the meaningful whitespace is in Go (for amounts > differences in number greater than 1). I meant, for example, in regexp notation, ` *` vs `\n *` between a function signature and the opening brace of the f

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

2021-02-27 Thread Jan Mercl
On Sat, Feb 27, 2021 at 10:37 PM Bob Alexander wrote: > Try removing all the space from your post and see how understandable it is, > or remove all indentation from a Go program, etc. (Hmm, that would make > formatters a lot easier to write... ) Removing all spaces makes most languages ambiguo

Re: [go-nuts] Golang Problems

2021-02-27 Thread Jan Mercl
On Sun, Feb 28, 2021 at 6:32 AM Marcin Romaszewicz wrote: > - if s is a string, s[0] is a rune If s is a non-empty string, s[0] is a byte. > - if r is a rune, string(r) is a 1 character string If r is a rune, string(r) is a string of 1 or more bytes. -- You received this message because you

Re: [go-nuts] gofmt return multiple function closures

2021-02-19 Thread Jan Mercl
On Fri, Feb 19, 2021 at 3:46 PM Neehar Vijay wrote: > Is this intentional? Does gofmt assume tab width of 4 or 8? No. Does this look better? https://play.golang.org/p/0NnZmegKVAu Ie. just add a line break between the return values. Gofmt will keep yout choice. -- You received this message be

Re: [go-nuts] Re: SQLite3 Support without CGo

2021-02-17 Thread Jan Mercl
On Tue, Feb 16, 2021 at 10:52 PM ben...@gmail.com wrote: > Jan, is there any write-up about modernc.org/sqlite? I've dabbled in > automated conversion, and I'm very curious if there's more information about > how it works, any pitfalls / unsupported stuff, etc, but having trouble > finding any

Re: [go-nuts] big.Float.Cmp does not work as expected

2021-02-16 Thread Jan Mercl
On Tue, Feb 16, 2021 at 9:30 PM Santhosh T wrote: > in Java, this is not case. That compares decimal vs floating point representations. Those have very different properties, for different usage patterns. -- You received this message because you are subscribed to the Google Groups "golang-nuts

Re: [go-nuts] Filtering a type of test in the whole project

2021-02-08 Thread Jan Mercl
On Mon, Feb 8, 2021 at 3:03 PM Johan Martinsson wrote: > Am I missing some option here? It's additionally possible to use a test flag like -mayfail and call flag.Parse() in TestMain(). -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubsc

Re: [go-nuts] Re: Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-06 Thread Jan Mercl
On Sat, Feb 6, 2021 at 8:01 PM Axel Wagner wrote: > FTR, I think even a library function that is defined as "the equivalent of > `append(a[:i], a[j:]...)`" (for example) would provide value. Yes, but IMO a net negative value. Many people will then mindlessly just use this O(n) variant even thou

Re: [go-nuts] Re: Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-06 Thread Jan Mercl
On Sat, Feb 6, 2021 at 5:36 PM Sean wrote: > I think there is definitely a need for a built-in "remove" function for > arrays and slice. > Everyone is writing their own implementation for this, it is both confusing > and "x = append(a[:x], b[x:])" like blablabla is not readable. Please define

Re: [go-nuts] Re: Possible Go 2 proposal for built-in Remove method for Slices.

2021-02-05 Thread Jan Mercl
On Fri, Feb 5, 2021 at 3:46 PM Fernando Meyer wrote: > I understand the pragmatism behind having or not features in the language and > its standard library. But, almost all the golang projects I've worked with > implement their own utility function to remove elements from a slice, > sometimes

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

2021-02-04 Thread Jan Mercl
https://www.geospatialworld.net/blogs/goodbye-michael-jones-the-man-who-gave-the-power-of-maps-in-our-hands/ -- 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 golan

Re: [go-nuts] Slice to array using the same buffer?

2021-02-01 Thread Jan Mercl
On Mon, Feb 1, 2021 at 1:38 PM Amit Lavon wrote: > I know it's possible to create a slice variable from an array with the [:] > syntax, and it points to the same underlying buffer. > Can one do the opposite? Given a slice, create an array variable based on the > same buffer? Arrays are values

Re: [go-nuts] Golang assertion issues

2021-02-01 Thread Jan Mercl
On Fri, Jan 29, 2021 at 6:52 PM nishant gupta wrote: > Being new to programming and to Golang i am running into issues while > asserting my test case. Looking for help here from the pros - > Any help is appreciated in this regards. Thanks in advance. Possibly not a popular advice: When possibl

Re: [go-nuts] Re: Gidelines or best practices on error on error handling?

2021-01-31 Thread Jan Mercl
On Sun, Jan 31, 2021 at 6:01 PM Amnon wrote: > If you take the > https://play.golang.org/p/L8z2Q_F_fi3 > > and change the line 18 > from > func foo() (err error) { > > to > func foo() error { > > The code will continue to compile. That's again the case of "making the return variable unnamed and d

Re: [go-nuts] Re: Gidelines or best practices on error on error handling?

2021-01-31 Thread Jan Mercl
On Sun, Jan 31, 2021 at 5:24 PM Amnon wrote: > https://play.golang.org/p/jnRn4Bv98xS > > See the example on the Go Playground. > > Jan, someone can explain to me why it will no longer compile? That's not an example of what I wrote: "Changing it to an unnamed one will cause the program to no long

Re: [go-nuts] Re: Gidelines or best practices on error on error handling?

2021-01-31 Thread Jan Mercl
On Sun, Jan 31, 2021 at 8:04 AM Amnon wrote: > I really do not like code like > defer func() { > if cerr := f.Close(); cerr != nil && err == nil { > err = cerr > } > }() .. > If somebody later > changes the function to return unnamed values, this defer will silently fail. The def

Re: [go-nuts] sycall/js : does it require build tags? if so whihc ones?

2021-01-23 Thread Jan Mercl
On Sun, Jan 24, 2021 at 12:57 AM atd...@gmail.com wrote: > My issue is that I do not know which build constraints I should specify for > the static analysers to process the code. Seems like js _and_ wasm: https://golang.org/src/syscall/js/js.go#L5 -- You received this message because you are

Re: [go-nuts] Re: SQLite3 Support without CGo

2021-01-23 Thread Jan Mercl
On Sat, Jan 23, 2021 at 7:02 PM supp...@lieferpool.de wrote: > If you want sqlite3 support without cgo, you might check out > https://github.com/cvilsmeier/sqinn-go Shameless plug: https://pkg.go.dev/modernc.org/sqlite -- You received this message because you are subscribed to the Google Group

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

2021-01-20 Thread Jan Mercl
On Wed, Jan 20, 2021 at 9:03 PM Marvin Renich wrote: > I still cannot find any mention of reserved import paths in any > documentation (go help modules/importpath/gopath). It's just an issue > on the tracker. When an important part of the implementation is undocumented then it's a documentation

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

2021-01-20 Thread Jan Mercl
On Wed, Jan 20, 2021 at 3:57 PM Marvin Renich wrote: > I don't understand what you are saying. What is a "reserved import > path" and where is it defined? See https://github.com/golang/go/issues/32819 -- You received this message because you are subscribed to the Google Groups "golang-nuts"

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

2021-01-20 Thread Jan Mercl
On Wed, Jan 20, 2021 at 2:58 PM Marvin Renich wrote: > The error message is really incomplete, and therefore confusing. It > should be "package ... is not in GOROOT or any element of GOPATH". _That_ would be incorrect and confusing. Reserved import paths are never searched for in GOPATH. -- Y

Re: [go-nuts] Re: goproxy.io was deployed in independent region in Europe and America

2021-01-02 Thread Jan Mercl
On Sat, Jan 2, 2021 at 4:29 AM not...@gmail.com wrote: > > @Amnon, I'm sorry I have no idea why the graphs are missing, Seems your mailer does not embed images the way many mail clients understand it. In Gmail I get plain text instead ``, so there míght be some extra quoting happening somewhere.

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

2020-12-30 Thread Jan Mercl
On Wed, Dec 30, 2020 at 7:38 PM Ian Lance Taylor wrote: > I don't think this is accurate. Surveys express a clear and > consistent desire for generics that is far ahead of requests for > operator overloading or other language features. No ordering or quantitative comparison was implied. Just th

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

2020-12-30 Thread Jan Mercl
On Wed, Dec 30, 2020 at 3:09 PM Jesper Louis Andersen wrote: > Almost. It requires me to cast, so I'm wrapping it in a set of functions > which makes that cast. With generics, I can get rid of that boilerplate. (Casting? Method receivers have static types.) So some use cases boil down to having

Re: [go-nuts] Re: Generics, please go away!

2020-12-29 Thread Jan Mercl
On Tue, Dec 29, 2020 at 5:01 PM L Godioleskky wrote: > Hopefully the GO leadership will isolate Generics to a module so that those > who dont wish to use them can quietly ignore them, while those that believe > Generics have value can just import the relevant module(s) It's a language change,

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

2020-12-27 Thread Jan Mercl
On Sun, Dec 27, 2020 at 3:51 PM Jesper Louis Andersen wrote: > I need a heap over any type which can be ordered, and its needs to drag > around any type of satellite data. I'm confused. Isn't that what https://golang.org/pkg/container/heap/#Interface provides already? -- You received this mes

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

2020-12-24 Thread Jan Mercl
On Thu, Dec 24, 2020 at 4:08 PM Arnaud Delobelle wrote: > The order is undefined but stable (provided you don't insert new values), and > accessible via the `next` function. Here is an example: Quoting from the provided link: next (table [, index]) Allows a program to traverse all field

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

2020-12-24 Thread Jan Mercl
On Thu, Dec 24, 2020 at 3:12 PM Arnaud Delobelle wrote: > That's interesting, thanks. Although I don't think it fits my use case > because I need something stronger than an iterator: a function that given a > table and a key returns the next key in the table (as this is a public API > that Lua

Re: [go-nuts] Re: Generics, please go away!

2020-12-22 Thread Jan Mercl
On Tue, Dec 22, 2020 at 1:02 PM Axel Wagner wrote: > I feel well justified in calling this out as destructive behavior. You've defined the problem much better than I could ever do. But this one is not technical and off topic in this thread. Thanks for considering. -- You received this message

Re: [go-nuts] Re: Generics, please go away!

2020-12-22 Thread Jan Mercl
On Tue, Dec 22, 2020 at 12:01 PM 'Axel Wagner' via golang-nuts wrote: > Go is an inclusive project and wants everyone to feel welcome - *obviously* > that includes people who want generics in the language. Please read - and > keep to - the Go community Code of Conduct: https://golang.org/conduc

Re: [go-nuts] The GitHub Vet Project

2020-12-21 Thread Jan Mercl
On Mon, Dec 21, 2020 at 8:30 PM K. Alex Mills wrote: > I think that it would be best to keep our discussion of the proposed change > part of the relevant GitHub tracker to ensure the conversation can happen in > context of prior discussions. Unfortunately, that's not going to happen, and I am

Re: [go-nuts] The GitHub Vet Project

2020-12-20 Thread Jan Mercl
On Sun, Dec 20, 2020 at 8:38 PM K. Alex Mills wrote: > During a Q&A session at this year's GopherCon, some members of the Go > language team indicated a willingness to modify the behavior of range loops > if we can be reasonably certain that the change will not cause incorrect > behavior in cu

Re: [go-nuts] Performance issue with os.File.Write

2020-12-20 Thread Jan Mercl
On Sun, Dec 20, 2020 at 11:53 AM Arnaud Delobelle wrote: > TLDR; a simple test program appears to show that Go's (*os.File).Write is 10x > slower than C's fputs (on MacOS). Apples and oranges. fputs buffers, os.File does not. Rewrite the benchmark using bufio. -- You received this message bec

Re: [go-nuts] Question about blog post: https://blog.golang.org/pipelines

2020-12-01 Thread Jan Mercl
On Tue, Dec 1, 2020 at 9:05 PM nc wrote: > I just wanted to know if there was a way to tell that the goroutines c1, c2 > actually are hung. Could I in my head add the sentences "While the program > terminates, that is only because the main goroutine has finished its > execution. One of the send

Re: [go-nuts] errors.Is and pointer arguments

2020-11-27 Thread Jan Mercl
On Fri, Nov 27, 2020 at 2:46 PM Arve Knudsen wrote: > I've noticed that errors.Is returns false if you compare two error instances > that are implemented as pointers. I.e., I'm using a struct where the Error > method has a pointer receiver, and when passing struct instance pointers to > errors

<    1   2   3   4   5   6   7   8   9   10   >