[go-nuts] Re: Iterator handling error

2024-09-03 Thread Christoph Berger
I like this approach. - bufio.Scanner-style errors are a known pattern from the stdlib - The approach keeps the key and value params free for their intended use - It doesn't require nested iter seqs - It is compatible with range loops Made some sample code as PoC -> https://go.dev/pla

[go-nuts] Re: Iterator handling error

2024-08-30 Thread Christoph Berger
Opinionated answer: If a container type cannot iterate over its elements without fail, I would refrain from trying to build a standard iterator for this container type. You'd be shoehorning an iterator that can fail into the iter API that is not designed for dealing with errors. Putting half-w

[go-nuts] Re: Best IDE for GO ?

2023-08-20 Thread Christoph Berger
*> What I'm looking for is the ability to manage dependencies not only in code, but entirely in a project from requirements to deployment.* I read two different aspects/levels from your question. The first half sounds like you want a graphical/GUI equivalent of go mod for Go dependency managem

Re: [go-nuts] Go Toolchain Management from 1.21.0 onwards

2023-08-16 Thread Christoph Berger
/472> in docker-library/golang also assumes that GOTOOLCHAIN=local preserves pre-1.21 behavior. > On 16. Aug 2023, at 10:42, Stephen Illingworth > wrote: > > On Wednesday, 16 August 2023 at 08:47:36 UTC+1 Christoph Berger wrote: > > Thank you for replying. > > What

[go-nuts] Re: Go Toolchain Management from 1.21.0 onwards

2023-08-16 Thread Christoph Berger
As far as I understand the Toolchains document, Go projects made with Go 1.21 or later can demand a particular toolchain for compiling a module (through the go and toolchain directives). If you disable downloading toolchains as needed, the new behavior of the go and toolchain directives might b

Re: [go-nuts] I need confirmation about whether I'm in front of a linter false positive.

2023-08-15 Thread Christoph Berger
The linter complains because the second err occurs in a different scope. "if err = f(); err != nil" scopes this err instance to the if block. It re-uses the err from the outer scope, which might not be intended. If you only use either of "err = f(); if err..." or "if err = f(); err..." consist

[go-nuts] Re: Any option to substitute plug-in package ?

2023-08-03 Thread Christoph Berger
WebAssembly comes to mind - see, for example, https://wazero.io/ A plugin would then be a .wasm binary that can be compiled in any language that supports WebAssembly as target. Disclaimer: I have not yet tried this approach. On Wednesday, August 2, 2023 at 12:14:15 PM UTC+2 alex-coder wrote: H

Re: [go-nuts] Please consider voting to reopen Golang subreddit

2023-06-27 Thread Christoph Berger
> Personally, I see this as an opportunity to switch to a more > FOSS-friendly alternative: kbin, lemmy, you name it, as long as it > rhymes with fediverse. There is forum.golangbridge.org and maybe more, but the problem is, how to take 200k+ Gophers with you? /r/golang is the largest Go communi

Re: [go-nuts] Hosting to deploy && run exe ?

2023-06-12 Thread Christoph Berger
Also worth having a look at: - fly.io - encore.dev Fly.io lets you launch apps in micro VMs. Encore.dev is a Go-specific deployment & orchestration framework with a hosting option. Both have a free tier. (Disclaimer: I have no affiliate relationship with any of them.) On Sunday, June 11, 2023 a

Re: [go-nuts] Re: Looking Backend Dev Learning Resources

2022-12-05 Thread Christoph Berger
> that would mean the progress made did not invalidate any of effective Go (which seems not possible given the addition of generics) Adding new features makes Effective Go *incomplete* but not *invalid*. There is separate documentation available for Generics and other new features. Go documenta

[go-nuts] Re: Looking Backend Dev Learning Resources

2022-11-30 Thread Christoph Berger
If you know the basics of Go already, Effective Go and the Go FAQ are good starting points for learning what idiomatic Go is like and why certain decisions in the language design were made. On Saturday, November 26, 2022 at 11:37:29 AM U

[go-nuts] Re: Go Get Issues

2022-09-27 Thread Christoph Berger
You are right, when changing import paths, related info (go.mod contents in this case) need to be updated as well. This was missing from my answer, thanks for catching that. Glad to hear that go-getting the private module works after including the VCS extension. On Monday, September 26, 2022 a

[go-nuts] Re: Go Get Issues

2022-09-25 Thread Christoph Berger
Hi Rich, I guess, you run into the behavior described here : *> To declare the code location, an import path of the form> * repository.vcs/path *> specifies the given repository, with or without the .vcs suffix, using the named version con

[go-nuts] Go Vulnerability Database: integration into Go toolchain?

2022-09-13 Thread Christoph Berger
Does anybody know if there are plans to integrate vulnerability checks into Go tools like go get, go mod download, or go mod tidy? Right now, devs need to pull vuln information manually, either through running govulnchek or by visiting packages on pkg.go.dev and inspecting the package history

[go-nuts] Re: Is Go 1.19 the last 1.x release?

2022-07-18 Thread Christoph Berger
The talk is from 2017. The version numbers Russ Cox used back then are certainly only examples. As long as all changes and additions to Go are backward-compatible, Go will stay at 1.x. On Saturday, July 16, 2022 at 4:08:26 PM UTC+2 peterGo wrote: > Natasha, > > No. > > Planning Go 1.20 >

Re: [go-nuts] Generic interface compiles with incorrectly instantiated types

2022-06-21 Thread Christoph Berger
> > > On Tue, Jun 21, 2022 at 10:38 AM Christoph Berger > wrote: > >> > The Wrap interface ignores its type parameter >> >> Curious, why doesn't the compiler consider this an error? I would expect >> a "type parameter declared but not used&quo

Re: [go-nuts] Generic interface compiles with incorrectly instantiated types

2022-06-21 Thread Christoph Berger
> The Wrap interface ignores its type parameter Curious, why doesn't the compiler consider this an error? I would expect a "type parameter declared but not used" error, similar to the "variable declared but not used" error. Or are there valid use cases for types that declare a type parameter bu

[go-nuts] Re: go log.Println(http.ListenAndServe(...)) blocks

2022-02-18 Thread Christoph Berger
(And I really should hit "reply to all", lol) > https://go.dev/ref/spec#Go_statements : > > > The function value and parameters are evaluated as usual *in the calling goroutine*, but unlike with a regular call, program execution does not wait for the invoked funct

[go-nuts] go log.Println(http.ListenAndServe(...)) blocks

2022-02-18 Thread Christoph Berger
Hi gophers, I hope someone can help finding out why a particular goroutine call can block the main goroutine. In the following code, all "go" calls spawn off a goroutine and return as expected, except for the last one that blocks the main goroutine. Is this a bug, or am I missing something s

[go-nuts] Re: scripting in Go

2022-01-27 Thread Christoph Berger
Thanks for adding a long-name variant! Indeed I feel the code is much more self-documenting this way. But in the end it is only a matter of getting used to an API. Power users of "sc" will certainly be able to read the original short-name variant without problems. On Thursday, January 27, 2022

[go-nuts] Re: scripting in Go

2022-01-25 Thread Christoph Berger
Thanks for sharing your package. To me it seems that the functions are rather shallow wrappers around other single functions from the standard library (e.g., sc.P() maps 1:1 to fmt.Printf()). You certainly save a couple of keystrokes while *writing* a script this way, but on the other hand, *re

[go-nuts] Re: [ANN] Scriggo - Go template engine and embeddable interpreter

2021-09-16 Thread Christoph Berger
Hi Marco, That's super interesting, especially the Go interpreter part. Curious – how close is the interpreter to the latest Go version? And how fast are new Go versions adopted? Thanks, Christoph On Wednesday, September 15, 2021 at 3:15:43 PM UTC+2 Marco Gazerro wrote: > Announcing Scriggo,

[go-nuts] Re: my package not include in go modules

2020-07-28 Thread Christoph Berger
A module can consist of multiple packages. The packages in your repository all belong to the module in the root directory of the repo (where your go.,mod file is). And there is nothing wrong with this. You can maintain them all together in the same module. However, perhaps you want to make one

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

2020-05-08 Thread Christoph Berger
ity > or could be "except error"). That way, if someone uses a "defined type" link > to see what it means (as Christoph did here for assignability) they'll get an > immediate answer about the implications. > > > On Fri, May 8, 2020 at 4:43 PM Jan M

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

2020-05-08 Thread Christoph Berger
t still... On 8. May 2020, 16:42 +0200, Jan Mercl <0xj...@gmail.com>, wrote: > On Fri, May 8, 2020 at 4:31 PM Christoph Berger > wrote: > > > Unfortunately, the connection between "predeclared" (or "implicitly > > declared" as the first paragraph says) a

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

2020-05-08 Thread Christoph Berger
d it.) On 8. May 2020, 16:01 +0200, Jan Mercl <0xj...@gmail.com>, wrote: > On Fri, May 8, 2020 at 3:29 PM Christoph Berger > wrote: > > > So I conclude that the assignment of *int to intp succeeds because *int is > > not a defined type and both *int and intp have the s

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

2020-05-08 Thread Christoph Berger
Thanks for the quick reply Jan. So I conclude that the assignment of *int to intp succeeds because *int is not a defined type and both *int and intp have the same underlying type *int. Looking through the ref spec I found a couple of places that mention some defined types (esp., all numeric typ

[go-nuts] Re: Go policy does not fully support previous release

2019-10-01 Thread Christoph Berger
A question based on genuine interest: Which factors make it hard for you to upgrade to the latest Go release? On Monday, September 30, 2019 at 9:49:39 PM UTC+2, Liam wrote: > > I was startled to learn that regressions found in the previous release > (currently 1.12.x) will not be fixed in that

Re: [go-nuts] Re: concurrency programing about go

2017-11-06 Thread Christoph Berger
Always call Add() before spawning the corresponding goroutine(s). And always call Add() in the same goroutine that also calls Wait(). This way you have no race condition between Add(), Done(), and Wait(). On Saturday, November 4, 2017 at 10:46:21 AM UTC+1, Henrik Johansson wrote: > > I find con

Re: [go-nuts] Rationale in docs on why you need to use the result of append()

2017-11-06 Thread Christoph Berger
This describes pretty clearly what happens behind the scenes. Still, someone could wonder why append then does not receive a pointer to the slice, to ensure that both the slice header and the slice data are treated in a consistent way. What is the generally accepted answer to this? For exampl

[go-nuts] Re: How to learn golang web development

2017-10-15 Thread Christoph Berger
"Learn to Create Web Applications using Go" offers both a course and a book about the topic. I have the book and love it, and the course also looks impressive from what I can see on the landing page. On Thursday, October 12, 2017 at 3:39:32 PM UTC+2, snakes wrote: >

[go-nuts] Re: ListenAndServeTLS() godoc comment

2017-09-19 Thread Christoph Berger
September 19, 2017 at 11:43:49 AM UTC+2, Christoph Berger > wrote: >> >> My fault, I misinterpreted the diagram on Wikipedia. You are right, the >> root CA would not have to be sent to the client then. >> >> When I visit the source of ListenAndServeTLS and drill

[go-nuts] Re: ListenAndServeTLS() godoc comment

2017-09-19 Thread Christoph Berger
rtificate-Chains-and-Transvalid-Certificates.html > > ("a common issues is that people unneccesarily[sic] send the root > certificate, which doesn't cause issues but may make things slower") > > BTW: The Baseline Requirements do not allow that a server certificate

[go-nuts] Re: ListenAndServerTLS() godoc comment

2017-09-18 Thread Christoph Berger
I am no TLS expert, but your question makes me wonder why the server should *not* serve the root CA's certificate. After all, it contains the signature that validates the server's certificate (either directly of

Re: [go-nuts] Offline Go Documentation Tools

2017-08-10 Thread Christoph Berger
> > Is Visual Studio Code a .Net app that takes up lots of memory and CPU? > Worse, it's an Electron app :) I use VSC on an old 2012 Mac Mini, and I cannot confirm that it consumes lots of CPU or memory, even with about two dozen extension installed. It is fast and responsive (some say it is not

Re: [go-nuts] "find" for Slices like "append"

2017-08-08 Thread Christoph Berger
May I ask why you turned to Go in the first place? Your taunting remarks seem to indicate that you were forced moving to Go; but on the other hand, earlier you indicated that you need to sell Go (or rather, the lack of a feature in Go) to your team, so it seems you are the driving force behind

Re: [go-nuts] Reasoning behind behavior of range, when index is maintained

2017-08-02 Thread Christoph Berger
y 27, 2017 at 2:21:34 PM UTC+2, Christoph Berger wrote: > That’s actually what I meant to indicate in the last paragraph (emphasis > added by me): > > > The code in the Reddit post takes advantage of the fact that the last > > increment of the C-style loop can be observe

Re: [go-nuts] Reasoning behind behavior of range, when index is maintained

2017-07-27 Thread Christoph Berger
t been clear to everyone. > On Wed, Jul 26, 2017 at 08:44:46AM -0700, Christoph Berger wrote: > >>> someone shared [this question]( >>> https://www.reddit.com/r/golang/comments/6paqc0/bug_that_caught_me_with_range/) >>> >>> on reddit. I must say, th

[go-nuts] Re: Reasoning behind behavior of range, when index is maintained

2017-07-26 Thread Christoph Berger
Hi Axel, An attempt to explain this by looking at the C-style loop only: The classic C-style for loop for i:=0; i > Hey, > > someone shared [this question]( > https://www.reddit.com/r/golang/comments/6paqc0/bug_that_caught_me_with_range/) > > on reddit. I must say, that I'm surprised by the be

Re: [go-nuts] How to manage multiple versions of Go?

2017-06-25 Thread Christoph Berger
7, Jesper Louis Andersen > wrote: > > On Sun, Jun 25, 2017 at 4:36 PM Christoph Berger > mailto:christoph.g.ber...@gmail.com>> wrote: > Thanks to the Go 1 Compatibility Promise, it was never a problem for me to > always use the latest Go version (via Homebrew, BTW, which keep

Re: [go-nuts] How to manage multiple versions of Go?

2017-06-25 Thread Christoph Berger
Thanks! > > > > On Sunday, June 25, 2017 at 7:36:20 AM UTC-7, Christoph Berger wrote: > Thanks to the Go 1 Compatibility Promise, it was never a problem for me to > always use the latest Go version (via Homebrew, BTW, which keeps my Go > installation up-to-date with next-to-

[go-nuts] Re: How to manage multiple versions of Go?

2017-06-25 Thread Christoph Berger
Thanks to the Go 1 Compatibility Promise, it was never a problem for me to always use the latest Go version (via Homebrew, BTW, which keeps my Go installation up-to-date with next-to-zero effort). If I ever have the need to use an older version, I'd probably use Docker for that. Advantages o

[go-nuts] Re: Is it ok to separate Open and Close logic?

2017-05-15 Thread Christoph Berger
Is there any reason that Cleanup(f) should be called within DoingStuff()? (A reason that maybe is not visible in your example but might become obvious in a more complex scenario?) Otherwise you could just call `defer Cleanup(file)` in DoStuff() with exactly the same result, and you are back at

Re: [go-nuts] Re: Should a program always exit in main()?

2017-02-08 Thread Christoph Berger
Well, I already thought that my suggestion seems somewhat too simple… :) I agree, if a fatal error occurs within a goroutine but you don’t want to crash the whole process from within this goroutine (or even from within the library), then error channels seem the way to go. > Am 08.02.2017 um 11:

[go-nuts] Re: Should a program always exit in main()?

2017-02-08 Thread Christoph Berger
To me, the simplest way seems to be to just return an error to the caller outside the library: func (c *Client) Start() *error* { for { select { case m := <-c.message: for _, handler := range c.handlers { err := handler(m) *if err != nil {* *return err* * }* } } } } On Wednesday, Februa

Re: [go-nuts] Re: Disadvantage of Go

2017-01-14 Thread Christoph Berger
ave harder time > working around the lack of generics in Go because they are used to that > feature to solve their problems. > > To the latter I'd say that if Go feels tedious for a task then use something > else, really. Go wasn't designed to please people who l

[go-nuts] Re: Disadvantage of Go

2017-01-14 Thread Christoph Berger
Hi Yu, Generics have their use cases, e.g. when designing general data containers or in the context of numeric computation (matrix type of int, float, etc). In other areas, however, their use may be overrated. If you have a particular problem and you think, "I do need generics to implement th

[go-nuts] Deleting the /r/golang subreddit

2016-11-24 Thread Christoph Berger
Deleting /r/golang means destroying a very active community. Deleting /r/golang means deleting years of helpful answers, fruitful discussions, and useful links. Deleting /r/golang means thousands of seach engine results becoming stale. Deleting /r/golang means making Go less visible to the world.

Re: [go-nuts] Re: Namespacing hack using method on empty type

2016-08-05 Thread Christoph Berger
all, packages are the natural means for creating a namespace. Thx > Am 05.08.2016 um 11:10 schrieb Christian Joergensen > : > > Hi, > > For starters, packages can't implement interfaces. > > Cheers, > > On Friday, August 5, 2016 at 6:19:31 AM UTC+2, Chri

[go-nuts] Re: Namespacing hack using method on empty type

2016-08-04 Thread Christoph Berger
Are there any advantages over using real packages? -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, vis

[go-nuts] Re: OS X Installer: Why modify $PATH instead of adding symbolic links to /usr/local/bin?

2016-07-14 Thread Christoph Berger
I cannot answer your question; I just wanted to mention that homebrew creates symlinks in /usr/local/bin when installing Go. So if you are just looking for an installer that does not extend $PATH, you might want to give homebrew a try. On Tuesday, July 12, 2016 at 10:05:36 PM

Re: [go-nuts] function with goroutine returned will kill its goroutine?

2016-07-06 Thread Christoph Berger
m abnormally terminates), lest someone > complain that their defer functions were not run. > > On Tue, Jul 5, 2016 at 12:29 PM, Christoph Berger > mailto:christoph.g.ber...@gmail.com>> wrote: > In addition to that, all goroutines exit when the main function exits. In > your

Re: [go-nuts] function with goroutine returned will kill its goroutine?

2016-07-05 Thread Christoph Berger
In addition to that, all goroutines exit when the main function exits. In your code, this happens when i == 5. This explains the output that you get. Both goroutines are able to produce five numbers until the main loop finishes and the main function exits. On Monday, July 4, 2016 at 5:13:39 PM

[go-nuts] Re: Currying in Go

2016-06-19 Thread Christoph Berger
> this seems like an eyesore and maintenance concern. (...) it does cause me to hear code review sirens going off in the distance. Then why would you want to use currying in Go at all? What's the point of being able to write f(1)(2)(3) instead of f(1,2,3) *in a non-functional language?* Especi