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

2021-05-12 Thread Haddock
I once implemented something to solve the same problem in Java. So I have a high priority queue (hq) and a low priority queue (lq). Whenever an item is atted to the hq a token is also added to some associated high priority token queue (htq). Same for the lq and ltq. Some thread or goroutine tak

[go-nuts] proposal: ignore stale information in go list -find -json

2021-05-12 Thread Manlio Perillo
The go list `-find` flag was introduced to skip resolving imports. However, is it really necessary to include stale information in this case? Does `golang.org/x/tools/go/package` need it? Getting stale information is not a trivial work, AFAIK. Is it ok to change the meaning of an existing flag? T

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

2021-05-12 Thread Brian Candler
On Wednesday, 12 May 2021 at 08:40:36 UTC+1 Haddock wrote: > I once implemented something to solve the same problem in Java. So I have > a high priority queue (hq) and a low priority queue (lq). Whenever an item > is atted to the hq a token is also added to some associated high priority > token

[go-nuts] Fwd: protoc-gen-go and go modules

2021-05-12 Thread Amit Saha
Hi all, this is only relevant to people using grpc. I posted the query below to the grpc mailing list, thought of posting it here as welll. How are you importing the generated definitions and other resources them into your server and client? As far as I see it now, the protoc command will not gen

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

2021-05-12 Thread Haddock
Brian Candler schrieb am Mittwoch, 12. Mai 2021 um 10:34:31 UTC+2: > On Wednesday, 12 May 2021 at 08:40:36 UTC+1 Haddock wrote: > >> I once implemented something to solve the same problem in Java. So I have >> a high priority queue (hq) and a low priority queue (lq). Whenever an item >> is att

Re: [go-nuts] proposal: infer module name via version control when running `go mod init`

2021-05-12 Thread Wojciech S. Czarnecki
Dnia 2021-05-11, o godz. 11:14:24 Jon Calhoun napisał(a): > it saves me a handful of keystrokes at best - so I understand if it doesn't > seem > worth the effort. Right. > It feels close enough to the current behavior to be a good addition Gopath is retiring soon. Anyway, Someone needs to do

Re: [go-nuts] proposal: infer module name via version control when running `go mod init`

2021-05-12 Thread Jon Calhoun
After more thought, the proposal should be altered to only support git in the first pass. It would cover a majority of users, wouldn't affect the experience in other VCS, and would simplify the initial implementation. Doing every VCS at once would require someone learning how every VCS defines

[go-nuts] Re: go mod vendor without updating packages

2021-05-12 Thread 'Bryan C. Mills' via golang-nuts
Module dependencies are transitive. 'go mod edit' edits the syntax of the go.mod file, but does not ensure that the resulting transitive dependencies are consistent. To adjust your dependencies, use 'go get -d' instead of 'go mod edit': go get -d google.golang.org/grpc@v1.29.1 That will downgra

[go-nuts] defer and Go memory model

2021-05-12 Thread Ge
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 behaviour with non-defer code? I have read https://go

Re: [go-nuts] proposal: infer module name via version control when running `go mod init`

2021-05-12 Thread 'Bryan C. Mills' via golang-nuts
go mod init should only infer a module path when it can be certain that path is correct. For packages already stored in GOPATH/src, it knows the correct path with high confidence: the path relative to GOPATH/src is the path by which the packages in the module are imported when in GOPATH mode, s

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

[go-nuts] Re: proposal: ignore stale information in go list -find -json

2021-05-12 Thread 'Bryan C. Mills' via golang-nuts
https://golang.org/issue/29666 (still open) is the general issue for avoiding unnecessary work in 'go list'. It isn't obvious to me which kind of stale information we can omit for 'go list -find' in particular. On Wednesday, May 12, 2021 at 4:11:14 AM UTC-4 manlio@gmail.com wrote: > The go

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

2021-05-12 Thread Haddock
> In addition to htq and ltq you have a third queue into which you also > insert a token once one has been added to htq or ltp. The thread/goroutine > that serves htq, ltp, hq, lq is blocked by this additional queue. When it > is empty, htq and ltq are also empty. So when the goroutine is blo

Re: [go-nuts] proposal: infer module name via version control when running `go mod init`

2021-05-12 Thread Jon Calhoun
I suspect that the VCS path gives nearly the same level of confidence in practice. My personal experience shows that it is pretty rare for the two not to line up, and when it does the developer made a conscious decision to do so and knows to work around it. I'm also not suggesting that we remov

Re: [go-nuts] proposal: infer module name via version control when running `go mod init`

2021-05-12 Thread 'Jay Conrod' via golang-nuts
The go command used to infer the module path from .git/config for github origins specifically. However, that was removed in 1.13, based on discussion in #27951 . It wasn't a strong enough signal, and since it's important to get the module path right early

Re: [go-nuts] proposal: infer module name via version control when running `go mod init`

2021-05-12 Thread Jon Calhoun
Sounds like this functionality was removed intentionally and will be a no-go then. Thanks for sharing the link Jay! On Wed, May 12, 2021 at 11:19 AM Jay Conrod wrote: > The go command used to infer the module path from .git/config for github > origins specifically. However, that was removed in 1

[go-nuts] Re: proposal: ignore stale information in go list -find -json

2021-05-12 Thread Manlio Perillo
I was suggesting to not use work.Builder in the go list command, even in case the -json flag is specified or the -f flag contains the ".Stale" string. I'm not sure about the -f flag, however, since it is an explicit request from the user. On the other hand, if the user specified the -find flag

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

2021-05-12 Thread Øyvind Teig
I am not certain whether you start with Java and end up with describing a possible implementation for Go, or stay with Java. In any case Java is your starting point. I guess, comparing any feature of any language, from the outside, then the feature comparison lists turn up. But since you broug

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

2021-05-12 Thread Ge
Thank you Jan, sorry for my bad english. 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 } Ge 在2021年5月12日星期三 UTC+8

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

2021-05-12 Thread 'Axel Wagner' via golang-nuts
If we assume no other synchronization here, you have concurrent modification of variables, which is undefined behavior. But to answer your original questions: Yes, the behavior of `defer` is included in the clause "the order expressed by the program" - "the order specified by the program" doesn't

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

[go-nuts] TestSetuidEtc fails during test execution in a container

2021-05-12 Thread Kumar Srinivasan
Hello, This is the first time I am posting to this group, apologies if this is the wrong forum. I am trying to build the go sources and test the built sources, so effectively I am running % cd go-source-dir/src && GOROOT_BOOTSTRAP=/BOOT_GO bash ./all.bash I am seeing this failure attached belo

Re: [go-nuts] TestSetuidEtc fails during test execution in a container

2021-05-12 Thread Ian Lance Taylor
[ + agm ] On Wed, May 12, 2021 at 2:12 PM Kumar Srinivasan wrote: > > Hello, > > This is the first time I am posting to this group, apologies if this is the > wrong forum. > > I am trying to build the go sources and test the built sources, so > effectively I am running > % cd go-source-dir/src

Re: [go-nuts] TestSetuidEtc fails during test execution in a container

2021-05-12 Thread Kumar Srinivasan
Whoops, I missed mentioning I was trying to build and test this branch + hash: https://go.googlesource.com/go/+/fcee6b930a01407527e3a0386af2ea7ac4e66d44 Thanks Kumar On Wed, May 12, 2021 at 2:33 PM Ian Lance Taylor wrote: > [ + agm ] > > On Wed, May 12, 2021 at 2:12 PM Kumar Srinivasan > wr

Re: [go-nuts] TestSetuidEtc fails during test execution in a container

2021-05-12 Thread 'Andrew G. Morgan' via golang-nuts
It looks like the CapBound here is non-default. That is, this container is running with non-default restrictions. $ /sbin/capsh --decode=0xa80425fb 0xa80425fb=cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_

Re: [go-nuts] TestSetuidEtc fails during test execution in a container

2021-05-12 Thread Ian Lance Taylor
On Wed, May 12, 2021 at 2:47 PM 'Andrew G. Morgan' via golang-nuts wrote: > > > It looks like the CapBound here is non-default. That is, this container is > running with non-default restrictions. > > $ /sbin/capsh --decode=0xa80425fb > 0xa80425fb=cap_chown,cap_dac_override,cap_fow

Re: [go-nuts] TestSetuidEtc fails during test execution in a container

2021-05-12 Thread 'Andrew G. Morgan' via golang-nuts
OK. I've filed this bug. If we want to go this route, please assign it to me: https://github.com/golang/go/issues/46145 On Wednesday, May 12, 2021 at 2:53:19 PM UTC-7 Ian Lance Taylor wrote: > On Wed, May 12, 2021 at 2:47 PM 'Andrew G. Morgan' via golang-nuts > wrote: > > > > > > It looks lik

Re: [go-nuts] Fwd: protoc-gen-go and go modules

2021-05-12 Thread Jim Idle
Create a separate module that contains only the .proto files and use the generate directive. You can then version that module and share it. If your client is some other language, you can generate Its code from the same repo at the same version using your CI. For instance generate a pip wheel as wel

[go-nuts] cancel method of timerCtx of context package

2021-05-12 Thread qinggeer Bao
In the cancel method of timerCtx type: func (c *timerCtx) cancel(removeFromParent bool, err error) { c.cancelCtx.cancel(false, err) if removeFromParent { // Remove this timerCtx from its parent cancelCtx's children. removeChild(c.cancelCtx.Context, c) } c.mu.Lock()

Re: [go-nuts] TestSetuidEtc fails during test execution in a container

2021-05-12 Thread 'Andrew G. Morgan' via golang-nuts
Mea culpa. I clearly misread the capsh output. There is a cap_setgid in there. Looking closer at the output the miscompare is there in the first line. The groups are listed in an unsorted order. That is not expected by the test. Let me see what is causing this to happen. I'll use the bug to inv

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

2021-05-12 Thread robert engels
Here is a simple priority select implementation using unbuffered channels. https://play.golang.org/p/Hvl0iMr-cFW Uncomment the lines as instructed and you will see that channel A is always picked. What this demonstrates is that ‘priority’ and ‘event orde

Re: [go-nuts] TestSetuidEtc fails during test execution in a container

2021-05-12 Thread Kumar Srinivasan
Yes I was wondering about that. Meanwhile, is there a way to exclude that test ? Kumar On Wed, May 12, 2021, 7:31 PM 'Andrew G. Morgan' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Mea culpa. I clearly misread the capsh output. > > There is a cap_setgid in there. Looking closer at t

Re: [go-nuts] TestSetuidEtc fails during test execution in a container

2021-05-12 Thread 'Andrew G. Morgan' via golang-nuts
As a quick hack, you could just delete the src/syscall/syscall_linux_test.go file. Obviously, that will not test a bunch of stuff, but it should unblock you. Alternatively, you could try one of the 'Download' options from: https://go-review.googlesource.com/c/go/+/319591/ while we go throu