Re: [go-nuts] Re: Error handling

2023-08-04 Thread Miguel Angel Rivera Notararigo
On Fri, Aug 4, 2023, 13:57 Harri L wrote: > Yes, we can handle Go errors without language changes; that’s true. But > how we should annotate errors? The presented version of CopyFile leads to > following 'stuttering': > cannot copy '/tmpfs/play' to './tmp33/not-exist.txt': cannot create > destina

Re: [go-nuts] Re: Error handling

2023-08-04 Thread Miguel Angel Rivera Notararigo
I understand, but there is a little difference, you can find code out there improving performance thanks to generics, I am not sure if we can get any performance improvement by using "orelse return err". > -- You received this message because you are subscribed to the Google Groups "golang-nuts

Re: [go-nuts] Re: Error handling

2023-08-04 Thread Miguel Angel Rivera Notararigo
s room for changes... but changes > doesn't come without some resistance.. That is natural... > > > Go best features is the lack of new features. > > What about generics? That was a major change... It was really necessary or > not is another topic. > > El vie, 4 a

Re: [go-nuts] Re: Error handling

2023-08-04 Thread Miguel Angel Rivera Notararigo
On Thu, Aug 3, 2023, 23:45 DrGo wrote: > @Miguel Angel Rivera Notararigo > > Thanks for taking the time to write... > > In my proposal, people are free to add as much context as they want... > Yeah I know, I like your proposal, it is just how they handle errors in the V pr

Re: [go-nuts] Re: Error handling

2023-08-03 Thread Miguel Angel Rivera Notararigo
func CopyFile(src, dst string) error { r, err := os.Open(src) if err != nil { return fmt.Errorf("copy %s %s: %v", src, dst, err) } defer r.Close() w, err := os.Create(dst) if err != nil { return fmt.Errorf("copy %s %s: %v", src, dst, err) } if _, err := io.Copy(w, r); err != nil { w.Close() os.Re

Re: [go-nuts] Improving IPC latency?

2023-04-10 Thread Miguel Angel Rivera Notararigo
Not sure if you haven't tried them yet, but here: - https://github.com/tetratelabs/wazero - https://github.com/knqyf263/go-plugin - https://github.com/tetratelabs/wazero - https://github.com/ebitengine/purego I need some IPC too for a experiment, and was going to try them. On Sun, Apr 9, 2023

Re: [go-nuts] Re: heap profiling does not work on M2 MacBook air?

2023-03-01 Thread Miguel Angel Rivera Notararigo
Try commenting runtime.GC On Wed, Mar 1, 2023, 14:31 Jochen Voss wrote: > Dear Sean, > > Thanks for trying this out. Your result is different from mine, but I > don't think this can be right. According to the output, the only > allocation would be inside the regexp module. But there should be

Re: [go-nuts] Which error handling pattern do you prefer?

2021-11-12 Thread Miguel Angel Rivera Notararigo
I tend to use errX (X is adapted according to context) for function scoped errors, and err for block scoped errors func MyFunc() error { > v, errDS := doSomething() > ... > errDA := doAnotherthing() > } > if err := doAnotherthing(); err != nil { > return err > } > That way you don't shadow

Re: [go-nuts] Re: what is a minimal setup for compiling go programs in module mode?

2021-03-24 Thread Miguel Angel Rivera Notararigo
You can use the vendor folder, just copy (or symlink, but you will need to keep them updated) what you need there and will work. -- 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, sen

Re: [go-nuts] Error handling

2021-02-18 Thread Miguel Angel Rivera Notararigo
What would be the difference between using exceptions/deferring a generalized error wrapping, and panic-recover? -- 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 g

Re: [go-nuts] What are debian:buster-slim advantages vs alpine ones?

2020-12-20 Thread Miguel Angel Rivera Notararigo
Most of the issues presented here are only relevant for CGO and other programming languages, not Go. Also, could anyone share references about the security problems in Alpine? I may say Windows is more secure and faster than Linux (or the opposite), but without any evidence, it is just a conjectur

Re: [go-nuts] Reading multi line input from user

2020-06-21 Thread Miguel Angel Rivera Notararigo
Hi! you may try this https://play.golang.org/p/hDDyzm6IfED or this https://play.golang.org/p/MoKAbIbtR_J, but the user cannot edit previous lines and he/she have to hit Ctrl + D when is done -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsu

Re: [go-nuts] [generics] is generics with constrain needed ?

2020-06-18 Thread Miguel Angel Rivera Notararigo
ang true to me. After all, we *do* > allow converting between string and []rune, which has the same problem. > > On Thu, Jun 18, 2020, 04:53 Miguel Angel Rivera Notararigo < > ntr...@gmail.com> wrote: > >> Oh, it was a FAQ haha sorry about that and thanks Tyler and Ian :D &g

Re: [go-nuts] [generics] is generics with constrain needed ?

2020-06-17 Thread Miguel Angel Rivera Notararigo
Oh, it was a FAQ haha sorry about that and thanks Tyler and Ian :D -- 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. To vi

Re: [go-nuts] [generics] is generics with constrain needed ?

2020-06-17 Thread Miguel Angel Rivera Notararigo
Allowing this implicit conversion would be a bad thing? because it works like generics without any new syntax. Also, I found this a little messy type Ordered interface { type int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, uintptr, floa

Re: [go-nuts] go 1.13.1 (linux x64): Build and Test is slower.

2019-10-15 Thread Miguel Angel Rivera Notararigo
Hello :) I think you need to give some samples of what you are doing because without that the people that know about how to solve that problem cant help you. Remember, there are a lot of factors that may increase the building time, could you share at least something like time go build with both ver

Re: [go-nuts] Accessing css and js files in HTML served by Go

2019-05-06 Thread Miguel Angel Rivera Notararigo
You can write your own handler that serve static files and use main.html as index, but, the main.html name is mandatory? It breaks the convention -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving em

Re: [go-nuts] Accessing css and js files in HTML served by Go

2019-05-06 Thread Miguel Angel Rivera Notararigo
More than magic, it is a global convention. I guess it could be interpreted as: when you access a directory, the web server will index its content and will show you a list of links, if you want to override this behavior, you could create your own index. See https://github.com/golang/go/blob/b68624

Re: [go-nuts] Accessing css and js files in HTML served by Go

2019-05-04 Thread Miguel Angel Rivera Notararigo
Hi, this works for me: learn/ - webpages/ - css/ - main.css - js/ - file.js - index.html - main.go - package main import ( "net/http" ) func main() { http.Handle("/", http.FileServer(http.Dir("webpa

Re: [go-nuts] Facebook web app and go?

2019-04-29 Thread Miguel Angel Rivera Notararigo
Hi! you could use the standard library, take a look at https://golang.org/pkg/net/http and https://golang.org/pkg/html/template/ packages, should be enough with them. It looks like an embedded database fits for your use case, you could use https://github.com/dgraph-io/badger or SQLite if you prefer

Re: [go-nuts] Append array to slice of slice behavior puzzles me

2018-11-21 Thread Miguel Angel Rivera Notararigo
Hi, just add k := k after the for-range line -- 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, visit h

Re: [go-nuts] Position(s) available at FireEye

2018-11-20 Thread Miguel Angel Rivera Notararigo
Hi Dave, do you have space for a Jr Go developer? -- 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, visi

Re: [go-nuts] Start an HTTPS server using certificate input from byte content rather than file

2018-09-13 Thread Miguel Angel Rivera Notararigo
Hi, you could use a custom tls.Config, see this example ( https://golang.org/pkg/crypto/tls/#example_X509KeyPair_httpServer) On Thu, Sep 13, 2018, 03:49 Houzuo Guo wrote: > Hello fellow Gophers. > > I'm programming an HTTPS server and PEM-encoded certificate data is given > in bytes rather than

Re: [go-nuts] Does go dep support post install script like in php composer?

2018-08-27 Thread Miguel Angel Rivera Notararigo
Do you use a Makefile? .PHONY: deps deps: dep ensure path/to/the/script.sh -- 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...@googlegrou