Re: [go-nuts] Using struct{} for context keys

2023-05-29 Thread Andreas Götz
Thank you. Zero values are of course identical. I was only thinking about the pointer case... On Sunday, May 28, 2023 at 5:10:33 PM UTC+2 burak serdar wrote: > Two values A and B are equal (A==B) if A and B have the same type and the > same values. In a code where > > a:=clientContextKey{} >

Re: [go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Andreas Götz
Sunday! On Sunday, April 16, 2023 at 1:02:31 PM UTC+2 Jan Mercl wrote: > On Sun, Apr 16, 2023 at 12:51 PM Andreas Götz wrote: > > > Isn't gofmt ist part of the go command? Go ist the latest version: > > It is but it's a separate binary/executable file. Go version is one

Re: [go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Andreas Götz
ossible that's too old? I don't know why that would matter here, > though, the code doesn't seem to be using any new language features. > > On Sun, Apr 16, 2023 at 12:34 PM Andreas Götz wrote: > >> The entire file is >> https://raw.githubusercontent.com/evcc

Re: [go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Andreas Götz
://go.dev/play/p/XhoSAFjpGXa On Sunday, April 16, 2023 at 12:31:22 PM UTC+2 Jan Mercl wrote: > On Sun, Apr 16, 2023 at 12:17 PM Andreas Götz wrote: > > > > Good morning. Please excuse me for asking here- I'm stuck with something > that looks like a gofmt bug though t

[go-nuts] gofmt: expected declaration, found ')'

2023-04-16 Thread Andreas Götz
Good morning. Please excuse me for asking here- I'm stuck with something that looks like a gofmt bug though that seems very unlikely. In CI (https://github.com/evcc-io/evcc/actions/runs/4712710735/jobs/8357929411?pr=7485) I'm using a "porcelain" step to make sure only go-fmt'ed sources are ch

[go-nuts] Re: Drain channel on demand without busy looping?

2023-02-08 Thread Andreas Götz
Thanks Jason, that is absolutely beautiful. Ranging over channel wont work when the channel remains open (my case), but the "callback" pattern is really nice. Much appreciated, Andi On Wednesday, February 8, 2023 at 2:38:28 AM UTC+1 Jason E. Aten wrote: > > I have the requirement of make sure

[go-nuts] Re: Error-checking with errors.As() is brittle with regards to plain vs pointer types

2022-09-22 Thread Andreas Götz
That is a *very* good point. It still seems more obvious that one would check for error instead of pointer to error. If we don't want to do this as part of errors.As (or cannot) it might make sense for golangci-lint. I'm seeing that plain errors is a quite popular pattern? On Thursday, Septembe

[go-nuts] duration^2

2022-07-19 Thread 'andreas graeper' via golang-nuts
hello, i am new to everything is new in programming-heaven. old-c-guy. and i thought it`s time to learn something most-modern .. time.NewTicker( time.Second ) ok time.NewTicker( 5 * time.Second ) ok var n int = 5 time.NewTicker( n * time.Second ) error : int * duration time.NewT

[go-nuts] goroutine private / local var/const

2022-07-19 Thread 'andreas graeper' via golang-nuts
hi, for i=0;i<10;i++ { go func () { /* const c=i OR var v=i */ fmt.Println("f:beg i=",i) // here c or v instead // action fmt.Println("f:end i=",i) // here c or v instead }} when this routines get interrupted then beg-i and end-i differ now i want at the beginning of the routine a const copy

Re: [go-nuts] encoding/asn1 overly strict?

2022-06-10 Thread Andreas Götz
On Thursday, June 9, 2022 at 6:44:58 PM UTC+2 Brian Candler wrote: > I forgot to add one thing, and you didn't paste the whole certificate PEM > so I can't check this. > > Recent versions of Go won't verify the certificate unless it contains a > subjectAltName; matching against only the CN is no

Re: [go-nuts] encoding/asn1 overly strict?

2022-06-08 Thread Andreas Götz
To be more specific: in order to connect to the IOT server presenting the rogue BER certificate, we have InsecureSkipVerify: true. The description of InsecureSkipVerify reads: // InsecureSkipVerify controls whether a client verifies the server's // certificate chain and host name. If InsecureSki

[go-nuts] Re: What are best practices for synchronizing data access in web applications?

2022-03-01 Thread Andreas Götz
> I would ask what is the shared resource that you're synchronizing access to. The resource is really the internal program state. It's a steering mechanism controlled by various parameters (mode, timings etc) that need be synchronized to avoid races. > I recommend you watch and digest "Rethi

[go-nuts] Re: How to diagnose a stuck program

2021-11-06 Thread Andreas Götz
Sorry if the question was stupid. Happened to find https://stackoverflow.com/questions/42238695/goroutine-in-io-wait-state-for-long-time and looking at pprof profile right now. On Saturday, November 6, 2021 at 10:59:26 AM UTC+1 cpu...@gmail.com wrote: > Developing https://github.com/evcc-io/e

Re: [go-nuts] http.Response.Body.Close when ignoring the resp

2021-08-06 Thread Andreas Götz
Replying here as I was thinking about suggesting a go/vet check if the body is actually being closed. What I realise now is, that closing the body is just as good as not closing it as long as one doesn't read it first. As for reading there is probably a trade-off on when actually reading is st

Re: [go-nuts] How to use errors.As with sentinel errors?

2021-08-04 Thread Andreas Götz
Opened https://github.com/golang/go/issues/47528 On Monday, August 2, 2021 at 6:30:04 PM UTC+2 Andreas Götz wrote: > > Because both are of type `*errors.errorString`, so the types match and > it copies over the value. > Arguably, `errors.errorString` should implement `As()` and r

Re: [go-nuts] How to use errors.As with sentinel errors?

2021-08-02 Thread Andreas Götz
> Because both are of type `*errors.errorString`, so the types match and it copies over the value. Arguably, `errors.errorString` should implement `As()` and return `false`, unless the pointers match. I suggest filing an issue. Will do. It could also be a vet check to highlight errors.As used on

Re: [go-nuts] bug or missbevae between GO and C -> GO crash

2020-02-16 Thread Andreas Otto
Ok, but that has massive consequences: 1. in order to bridge this, the code has to be changed to "*cast*" -> so the type safety is lost 2. or the *NULL* pointer test is drawn at the top, in the "caller" -> but this is a MASSIVE change to the existing CODE basis. 3. In "*C*" the call of a method

[go-nuts] Re: annoing: runtime error: cgo argument has Go pointer to Go pointer

2020-02-01 Thread Andreas Otto
No, because this is a *printf *like feature and the *callSig* is the format and the *option[] *are the arguments, which support many different types… Am Donnerstag, 30. Januar 2020 06:15:28 UTC+1 schrieb Tamás Gulácsi: > > What does "argv" hold? > > Can it be a concrete type, not an interface ? T

Re: [go-nuts] annoing: runtime error: cgo argument has Go pointer to Go pointer

2020-01-31 Thread Andreas Otto
thanks to the Info, don't have profiled this overhead… It was just an assumtion. Am Donnerstag, 30. Januar 2020 18:12:50 UTC+1 schrieb Jake Montgomery: > > > > On Thursday, January 30, 2020 at 2:31:59 AM UTC-5, Andreas Otto wrote: >> >> >> >> Am Mittwoc

[go-nuts] Re: annoing: runtime error: cgo argument has Go pointer to Go pointer

2020-01-31 Thread Andreas Otto
I do nothing on *C* with this pointer… I just give the Pointer as Argument to an *GO* callback. Am Donnerstag, 30. Januar 2020 14:25:48 UTC+1 schrieb Tamás Gulácsi: > > > > How do you handle the interface types on the C side? If you call back to > Go exported functions, > then you shouldn't tra

Re: [go-nuts] annoing: runtime error: cgo argument has Go pointer to Go pointer

2020-01-29 Thread Andreas Otto
Am Mittwoch, 29. Januar 2020 23:19:34 UTC+1 schrieb Bruno Albuquerque: > > One way to work this around is to use https://github.com/mattn/go-pointer. > > > thanks, but also use this kind of "*HASH based and export the hash handle*" solution. But I call this a "slow" solution, because of the *has

[go-nuts] Re: annoing: runtime error: cgo argument has Go pointer to Go pointer

2020-01-29 Thread Andreas Otto
Am Donnerstag, 30. Januar 2020 06:15:28 UTC+1 schrieb Tamás Gulácsi: > > What does "argv" hold? > > Can it be a concrete type, not an interface ? That would allow passing it > - or if you copy it to a C.malloc-ed array.. > > > *Argv* are the arguments of *Send* and many kind of types are are su

[go-nuts] Problem with migration to the new "module" technology from "go"

2019-11-16 Thread Andreas Otto
Hi, I have an existing project existing of a "library" creating a wrapper to "C" using "go install" and on a different place multiple "executable's" everything glue together using the *GOPATH* technology. NOW I start using the new "module" technology. Library: 1. I create with "mod init

[go-nuts] Re: chromedp – cannot get current window title

2019-10-22 Thread Andreas
I run it in normal browser mode (no headless) so the page was opened. Even if I try to get some element text there is empty value too, for example selector like this one: //div[@id="gbar"]/a[contains(@class, "gb1")] -- You received this message because you are subscribed to the Google Groups "

[go-nuts] chromedp – cannot get current window title

2019-10-22 Thread Andreas
Chromedp is used for browser automation. I try to get windows title on *gmail inbox page* after it was opened. For some reason the title is empty. What am I doing wrong? ``` ... var title string err := chromedp.Run(taskCtx, chromedp.Navigate(`https://mail.google.com/mail/u/0/h/`), ... chromedp.

[go-nuts] Re: VsCode syntax highlighting for tmpl files

2019-10-13 Thread Andreas
the drawback is when I enter in .gohtml file ```{{``` then vscode auto-copletes it with ```}}}``` did you get the same? On Wednesday, September 25, 2019 at 5:18:51 PM UTC+3, Denis Bakhtin wrote: > > This extension works well if templates have .gohtml extension. I had to > rename mine. > > On

[go-nuts] Re: VsCode syntax highlighting for tmpl files

2019-09-28 Thread Andreas
nice On Wednesday, September 25, 2019 at 5:18:51 PM UTC+3, Denis Bakhtin wrote: > > This extension works well if templates have .gohtml extension. I had to > rename mine. > > On Monday, September 23, 2019 at 7:25:52 PM UTC+4, cinem...@gmail.com > wrote: >> >> Is there way to highlight templates

[go-nuts] Seeting up a webhook for GAE (telegram bot deployed)

2019-09-15 Thread Andreas
I deployed a telegram bot on GAE but it seems something went wrong - I do not recive any updates from channel. Is this a valid example, or there is an error? import ( "log" "net/http" tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api" ) func main() { log.Printf("%s", "

[go-nuts] Re: GAE - Telegram bot stops working after some period of time

2019-09-15 Thread Andreas
te: > > switch to using a webhook so telegram calls you through a handler > > this is a limitation of GAE's request based model > > On Sunday, September 15, 2019 at 4:04:29 PM UTC+2, Andreas wrote: >> >> >> >> I uploaded a simple telegram bot to google-aplic

[go-nuts] GAE - Telegram bot stops working after some period of time

2019-09-15 Thread Andreas
I uploaded a simple telegram bot to google-aplication-engine. And after uploading it works as expected some time. Then it stoped respond to request from telegram. The bot is very simple func main() { > bot, err := tba.NewBotAPI("apitockenhere") > ... > for { > select { >

Re: [go-nuts] go1.9: problem with go get

2017-09-01 Thread Andreas Briese
Thx i uninstalled 1.9, reinstalled 1.8.3 and the error persisted. In the turned out, chromeos needed a bootstrap installation (using crew install). all the best Andreas On 1 September 2017 at 02:34, Ian Lance Taylor wrote: > On Thu, Aug 31, 2017 at 12:51 PM, abriese wrote: > > ~

[go-nuts] Re: os.Getwd() on windows changes drive letter casing

2017-04-19 Thread Andreas Reuterberg
uot; results in a binary where os.Getwd() does not rely on the GOPATH variable, or converts the volume name to upper case. os.TempDir(), for example, does not alter the volume name letter case depending on how it's executed. So it's a bit odd. Andreas On Tuesday, 18 April 2017 14:03:51 UTC+1

[go-nuts] Re: os.Getwd() on windows changes drive letter casing

2017-04-18 Thread Andreas Reuterberg
I care because the library I am trying out breaks due to this issue (easyjson). But also, isn't it a bit odd and interesting that the code works differently as a binary? Andreas -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] os.Getwd() on windows changes drive letter casing

2017-04-17 Thread Andreas Reuterberg
p However, if I set my GOPATH using an upper case drive letter, it all works out as expected. Should GOPATH always use an upper case drive letter? Should the test binary work differently to a command line "go test"? Regards, Andreas -- You received this message because you are su