[go-nuts] Code markup in golang-nuts

2021-02-20 Thread Amnon
Slightly off topic. But is there any way to enhance google groups so that it will support Markdown? Or at least provides a simple way to post formatted code without the indentation being destroyed? People often want post code snippets on this group. And I have yet to find an easy way to do

[go-nuts] Re: [ANN] star-tex: a Go engine for TeX

2021-02-20 Thread Patrick
Hi Sebastien, a few years ago I started with dvitype https://github.com/speedata/gotex Patrick Sebastien Binet schrieb am Dienstag, 16. Februar 2021 um 15:23:41 UTC+1: > hi there, > > I'd like to introduce star-tex[1], a (Work In Progress) TeX engine. > > it wraps the output of the official

[go-nuts] Re: How do you test an unpublished module?

2021-02-20 Thread 'Carla Pfaff' via golang-nuts
The modules documentation has a section on this: "Developing and testing against unpublished module code" https://golang.org/doc/modules/managing-dependencies#tmp_9 On Saturday, 20 February 2021 at 13:10:38 UTC+1 pkle...@xs4all.nl wrote: > Is there a way to tell go.mod that it should use local

[go-nuts] [generics] type switches

2021-02-20 Thread thepud...@gmail.com
Hello fellow gophers, Ian announced the intention to update how type switches work in the generics proposal in a golang-nuts thread from this August: https://groups.google.com/g/golang-nuts/c/iAD0NBz3DYw It included this from Ian (which is a snippet of his item #4 from his first post

Re: [go-nuts] where is an online version of older versions like 1.8 1.6 golang pkg doc ?

2021-02-20 Thread Garian Nobinger
Thank you derek, your references just saved me some headache. On Sunday, January 21, 2018 at 11:11:39 AM UTC-6 derek wrote: > On Fri, Jan 19, 2018 at 10:07 AM, Ian Lance Taylor > wrote: > > Sounds like a good approach. Or I'm also open to someone writing the > > necessary code for golang.org.

Re: [go-nuts] Error handling

2021-02-20 Thread Michael MacInnis
I don't believe anyone is talking about not handling errors. There are functions that perform a sequence of actions and need to go no further when an error is encountered. An example of this type of function is presented in the "Errors are Values" post:

Re: [go-nuts] How do you test an unpublished module?

2021-02-20 Thread Wojciech S. Czarnecki
Dnia 2021-02-20, o godz. 07:52:26 Peter Kleiweg napisał(a): > you *can* tell go.mod that it should use local files instead of a repository. [...] > replace github.com/pebbe/package => > /home/peter/go/src/github.com/pebbe/package In that sense, yes. You point to package directory and there are

Re: [go-nuts] Error handling

2021-02-20 Thread Wojciech S. Czarnecki
Dnia 2021-02-20, o godz. 13:21:09 Michael Ellis napisał(a): > FWIW, I've put together a tiny package that, with some tradeoffs, seems > useful for reducing boilerplate in the common case where a function simply > wants to return an error to its caller. > The code is almost trivial. It

Re: [go-nuts] Error handling

2021-02-20 Thread Michael MacInnis
Neat. What you and I are doing is very similar. Particularly how the handler is "bound" to the error and checks to make sure that the error is non-nil before attempting to recover. The differences I see in our approaches are as follows: I support wrapping an error or performing some arbitrary

Re: [go-nuts] Error handling

2021-02-20 Thread Robert Engels
Some developers build sheds others build skyscrapers. Exceptions let you build skyscrapers - but not everyone needs a skyscraper. I’ve use both methods extensively in my career - well written exception code is far easier to write and maintain for more complex systems. > On Feb 20, 2021, at

Re: [go-nuts] Error handling

2021-02-20 Thread Robert Engels
I consider checked vs unchecked exceptions “well written” or even valid code. Checked exceptions are similar to Gos error return except more/easier/better? compile and coding time validation. Unchecked exceptions are similar to panic recover except you have more information. There is no

Re: [go-nuts] Error handling

2021-02-20 Thread Michael Ellis
FWIW, I've put together a tiny package that, with some tradeoffs, seems useful for reducing boilerplate in the common case where a function simply wants to return an error to its caller. https://github.com/Michael-F-Ellis/ro The code is almost trivial. It consists of two small functions,

Re: [go-nuts] Error handling

2021-02-20 Thread Matthew Holiday
I'm referring to errors found in the function (i.e., by calling other functions). It's the responsibility of the callers of a function to handle the errors it returns, and not the function itself. How can one function claim responsibility for the error handling strategy of all programs using it?

Re: [go-nuts] Error handling

2021-02-20 Thread Ian Lance Taylor
On Sat, Feb 20, 2021 at 12:11 PM Robert Engels wrote: > > Can you clarify what you mean mean by “the code does exactly what it shows on > the page”? How do you know by looking at the code, or even compiling the > code, that all possible errors returned by a function are handled? That to me >

Re: [go-nuts] Error handling

2021-02-20 Thread Robert Engels
Can you clarify what you mean mean by “the code does exactly what it shows on the page”? How do you know by looking at the code, or even compiling the code, that all possible errors returned by a function are handled? That to me is biggest difficult in reading (or using) others Go code.

Re: [go-nuts] Error handling

2021-02-20 Thread Matthew Holiday
Roger beat me to it. But allow me to rephrase, "The users of Go for a long time have resisted any changes to its simple, clear method of error handling despite it being a major concern of folks who don't use Go much." * * I'm referring to the original survey, which was worded along the lines of

Re: [go-nuts] How to use atomic_int in cgo?

2021-02-20 Thread Ian Lance Taylor
On Sat, Feb 20, 2021 at 8:34 AM changkun wrote: > > Dear Ian, thanks for the inspiration and sorry for the late response. I just > got a chance to test your suggestion. > But, it turns out that the wrapping struct can cause the following error: > > panic: runtime error: cgo argument has Go

[go-nuts] Re: Differences between go1.16 and go1.15 ?

2021-02-20 Thread TiT8
Awesome !! Thank you. Il giorno sabato 20 febbraio 2021 alle 19:59:37 UTC+1 DrGo ha scritto: > Dear Lorenzo, > Here’s a link to an old but still relevant tutorial on benchmarking Go > programs > > https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go > > Happy benchmarking > > On

[go-nuts] Re: Differences between go1.16 and go1.15 ?

2021-02-20 Thread DrGo
Dear Lorenzo, Here’s a link to an old but still relevant tutorial on benchmarking Go programs https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go Happy benchmarking On Saturday, February 20, 2021 at 11:19:40 AM UTC-6 TiT8 wrote: > > Thank you Volker. > > I want to say that I was

[go-nuts] The composite pattern in GO

2021-02-20 Thread Travis Keep
I am writing this to see what everyone thinks about a solution I have for the composite pattern. The composite pattern is when 0 or more instances of some interface X can act together as a single instance of interface X. For instance you may have a Filter interface that filters instances of

Re: [go-nuts] Error handling

2021-02-20 Thread roger peppe
On Sat, 20 Feb 2021, 16:31 L Godioleskky, wrote: > Rust lang, very early in its evolution, saw the need to create its > operator '?' to more efficiently manage error handling. But the guardians > of Go lang have resisted any changes to its clumsy method of error handling > despite it being a

[go-nuts] Re: The GO equiv. to 'tail -f' ?

2021-02-20 Thread Steve Murphy
Many, many thanks. The hpcloud/tail hit the spot exactly, along with using timer.AfterFunc() along with judicious use of .Stop() calls to turn on and off audible alarms. That was just the help I needed! again, Many thanks! murf On Thursday, February 18, 2021 at 12:02:46 PM UTC-7 Amnon wrote:

[go-nuts] Re: Differences between go1.16 and go1.15 ?

2021-02-20 Thread TiT8
Thank you Volker. I want to say that I was not trying to benchmark the two version of Go (two weeks ago I had go1.15.8, now 1.16). At the beginning I was trying to do some linear algebra with Go as a free “alternative of Matlab”, so I noted the difference between the exe coming from the two

Re: [go-nuts] How to use atomic_int in cgo?

2021-02-20 Thread changkun
Dear Ian, thanks for the inspiration and sorry for the late response. I just got a chance to test your suggestion. But, it turns out that the wrapping struct can cause the following error: panic: runtime error: cgo argument has Go pointer to Go pointer If my understanding of Cgo constraints

[go-nuts] Re: Differences between go1.16 and go1.15 ?

2021-02-20 Thread Volker Dobler
(premature send, sorry) 4. Your matrix multiplication is just a few CPU instructions, it is hard to measure something tiny reliable. So use larger matrixes. 5. You are benchmarking also how fast you can format and output the results to stdout. This might or might not be intentional but probably

Re: [go-nuts] Error handling

2021-02-20 Thread L Godioleskky
Rust lang, very early in its evolution, saw the need to create its operator '?' to more efficiently manage error handling. But the guardians of Go lang have resisted any changes to its clumsy method of error handling despite it being a major concern of Go users for a very long time. On

[go-nuts] Re: Differences between go1.16 and go1.15 ?

2021-02-20 Thread Volker Dobler
1. Do not use go run main.go. Never! 2. Do not run your code with the much less problematic go run because go run compiles and executes your code and the time needed to compile it will ruin all benchmarks. 3. Always use the benchmarking infrastructure built into go test and and package testing.

Re: [go-nuts] How do you test an unpublished module?

2021-02-20 Thread Peter Kleiweg
Reading https://github.com/rogpeppe/gohack en trying some things, I found that you *can* tell go.mod that it should use local files instead of a repository. I have a test program outside my `~/go` tree with a `go.mod` like this: ``` module peter.nl/tester go 1.16 replace

[go-nuts] Differences between go1.16 and go1.15 ?

2021-02-20 Thread TiT8
Hello everyone, I'm Lorenzo and I'm not a computer scientist, I have used some "Matlab" and I am new with Go (surprisingly fast, simple and elegant). I'm trying to do some basic operation on matrix with the "Gonum" package using vectorization. I was curious about the speed of development and

Re: [go-nuts] How do you test an unpublished module?

2021-02-20 Thread Wojciech S. Czarnecki
Dnia 2021-02-20, o godz. 04:10:38 Peter Kleiweg napisał(a): > Suppose I am writing a package that is in its own module, and I want > to test it. Not with unit tests, but with a larger program that uses > other non-standard packages as well. [...] > How do I get this right? > > Is there a way to

[go-nuts] How do you test an unpublished module?

2021-02-20 Thread Peter Kleiweg
Suppose I am writing a package that is in its own module, and I want to test it. Not with unit tests, but with a larger program that uses other non-standard packages as well. Before modules, I would develop the package in ~/go/src, write the test program somewhere else, and import the package.

Re: [go-nuts] Re: "go1.15 mod tidy" fails if the current project depends on a module containing a file using embed and guarded by "+build go1.16"

2021-02-20 Thread tapi...@gmail.com
reasonable. Thanks both for explanations. On Friday, February 19, 2021 at 7:20:36 AM UTC-5 Amnon wrote: > go mod tidy has to ignore build tags. > > Because if it did not ignore build tags, it would delete dependencies > needed by other platforms. > > On Friday, 19 February 2021 at 02:23:45 UTC

Re: [go-nuts] Go Documentation for private github projects

2021-02-20 Thread Martin Schnabel
Hi, this January a fork of gddo was was announced to this list. Take a look https://godocs.io/ Best regards On 20.02.21 08:13, Sankar P wrote: Hi We have a bunch of private repos in github with Go sources. We want to see the documentation for these repository sources in an easy to click URL.