Re: [go-nuts] Unexpected pointer dereference behavior

2021-04-22 Thread Nail Islamov
Sorry, ignore that. In [1], I make a copy of a locked mutex, which creates a *new *locked mutex. Basically the only non-obvious behavior here is that `&(*m) == m` by the rules of Go, the rest was explained above. On Friday, 23 April 2021 at 9:36:26 am UTC+10 Nail Islamov wrote: > Answers above

Re: [go-nuts] Unexpected pointer dereference behavior

2021-04-22 Thread Nail Islamov
Answers above don't explain the difference in behavior: [1] https://play.golang.org/p/lXA2F4b880W [2] https://play.golang.org/p/doruBxrquhw Why did deadlock happen in [1], despite creating a variable? If I change the order ([2]), I do avoid a deadlock (meaning that I have two separate mutexes).

[go-nuts] Postgres Database Automatic Reconnect

2021-04-22 Thread Ryan Quinn
Hi! I have a little, low-traffic web app which connects to postgres 10 using the pgx library (https://pkg.go.dev/github.com/jackc/pgx), and the database connection gets closed causing 500 server error to be returned. I'm pretty sure this is related to the db server being rebooted after updates

[go-nuts] Re: [ANN] peanut - write tagged structs to disk, in a variety of formats

2021-04-22 Thread 'Ingo Oeser' via golang-nuts
A truly fantastic package idea! Thanks a lot for sharing it. I just wish it would be cut a little bit differently. 1 module for the formats using only the stdlib 1 module each for sqlite and excel support. That woukd allow better control over dependencies and allow me to avoid the cgo

[go-nuts] Re: HTTP Proxy in Go

2021-04-22 Thread Dang Dien
I recommend the fasthttp package. I have implemented an HTTP forwarding proxy in Go and use in production with high traffic (~40 rpm). https://github.com/valyala/fasthttp On Thursday, 22 April 2021 at 14:07:00 UTC+7 Van Fury wrote: > > Hi, > > I have to implement an HTTP forwarding proxy in Go

[go-nuts] Re: HTTP Proxy in Go

2021-04-22 Thread Van Fury
Hi, Thanks, I have created these two proxy using the httputil. How can i send JSON request body from proxyA to proxyB. Any help or idea? ProxyA: const ( ServerB = "" Port = "" ) func main() { // start server http.HandleFunc("/", proxyPass) log.Fatal(http.ListenAndServe(":" + Port,

[go-nuts] Suggestion to extend x/OAuth2 API

2021-04-22 Thread cpu...@gmail.com
After working with a few more-or-less OAuth2 APIs lately, I would like to propose slightly extending the API footprint of the oauth2 library. By doing so I expect that the amount of userland/provider-specific code can be reduced- both inside oauth2 and outside in realworld applications. Some

Re: [go-nuts] go text://protocol client?

2021-04-22 Thread Petite Abeille
> On Apr 11, 2021, at 12:22, 'Axel Wagner' via golang-nuts > wrote: > > Everything around it certainly emits the air of pretentiousness that the fine > art market is famous for. à propos: FTC Rules Businesses Must Disclose Whether They Actually Cool Or Just Use Minimalist Branding

Re: [go-nuts] Need help/tips on golang compiler souce code reading

2021-04-22 Thread messi...@gmail.com
Hi, Now I've finished the package types2 for typecheck logic, and continue the journey to next step: IR generation(directory: cmd/compile/internal/ir/). It seems the ir package is a new abstract layer created during the refactor process of types2, and it's main purpose is to translate the AST

[go-nuts] Re: unable to install go1.1.2

2021-04-22 Thread Brian Candler
On Thursday, 22 April 2021 at 13:45:52 UTC+1 manlio@gmail.com wrote: > The solution was to simply remove the `-Werror` warning in cmd/dist and > disable CGO with CGO_ENABLED=0 > Glad it's working. That's also one of the things you'll find

[go-nuts] Re: HTTP Proxy in Go

2021-04-22 Thread wilk
On 22-04-2021, Van Fury wrote: > --=_Part_322_998422299.1619075183467 > Content-Type: multipart/alternative; > boundary="=_Part_323_2099960923.1619075183467" > > --=_Part_323_2099960923.1619075183467 > Content-Type: text/plain; charset="UTF-8" > > > Hi, > > I have to implement

[go-nuts] Re: unable to install go1.1.2

2021-04-22 Thread Manlio Perillo
Il giorno giovedì 22 aprile 2021 alle 11:06:09 UTC+2 Manlio Perillo ha scritto: > I tried to install go1.1.2 on my system, without success. > > I encountered the following problems: > > 1. There is no binary release > 2. Compilation fails due to warnings: > warning "_BSD_SOURCE and

Re: [go-nuts] Unexpected pointer dereference behavior

2021-04-22 Thread 'Axel Wagner' via golang-nuts
I think what is going on here is that it is wrong to say that `(*observer)` creates a copy: https://golang.org/ref/spec#Address_operators > For an operand x of pointer type *T, the pointer indirection *x denotes > the variable of type T pointed to by x. That variable is addressable and

Re: [go-nuts] Unexpected pointer dereference behavior

2021-04-22 Thread Mikhail Mazurskiy
On Thu, 22 Apr 2021 at 21:27, Jan Mercl <0xj...@gmail.com> wrote: > 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

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

[go-nuts] Unexpected pointer dereference behavior

2021-04-22 Thread Mikhail Mazurskiy
Hi all, 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 [2] and [3] and it looks like my reading of code is wrong.

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

2021-04-22 Thread Jesper Louis Andersen
On Thu, Apr 22, 2021 at 11:54 AM 'Dan Kortschak' via golang-nuts < golang-nuts@googlegroups.com> wrote: > > Does anyone know the reason for this? (Looking through other languages, > the situation in general seems to be a mess). > > I looked at OCaml, which provides both variants: Float.max :

[go-nuts] Re: unable to install go1.1.2

2021-04-22 Thread Brian Candler
Ah well, if it's just for fun then please knock yourself out, but don't be surprised if compiling old code on new compilers turns up problems like this. My suggestion is firing up a VM containing a Linux distribution of similar vintage (say Ubuntu 12.04) and compile inside that. Aside: you'd

[go-nuts] Re: unable to install go1.1.2

2021-04-22 Thread Manlio Perillo
Il giorno giovedì 22 aprile 2021 alle 11:46:15 UTC+2 Manlio Perillo ha scritto: > [...] > About the gcc warnings, the _BSD_SOURCE and _SVID_SOURCE macros where > defined in include/u.h; after removing them I got 2 other warnings: > >- argument to 'sizeof' in 'strncpy' call is the same

[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() {

[go-nuts] Re: unable to install go1.1.2

2021-04-22 Thread Manlio Perillo
Il giorno giovedì 22 aprile 2021 alle 11:24:41 UTC+2 Brian Candler ha scritto: > Could you describe what platform you are trying to build on? > > Also, could you explain why you need to build such an ancient version? > There may be a better solution to whatever you're trying to do. > My

[go-nuts] Re: unable to install go1.1.2

2021-04-22 Thread Brian Candler
Could you describe what platform you are trying to build on? Also, could you explain why you need to build such an ancient version? There may be a better solution to whatever you're trying to do. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] unable to install go1.1.2

2021-04-22 Thread Manlio Perillo
I tried to install go1.1.2 on my system, without success. I encountered the following problems: 1. There is no binary release 2. Compilation fails due to warnings: warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE I solved by removing the `-Werror`

[go-nuts] HTTP Proxy in Go

2021-04-22 Thread Van Fury
Hi, I have to implement an HTTP forwarding proxy in Go which can be used in production and need advice from Go experts. Any advice like which Go library is best to use and other things to take not of when implementing it. BR Abraham -- You received this message because you are subscribed