[go-nuts] Re: Import files with extensions .xls and .xlsx .

2023-02-07 Thread Tamás Gulácsi
Yes, with github.com/extrame/xls and github.com/xuri/excelize/v2 . aadityasha...@gmail.com a következőt írta (2023. február 8., szerda, 7:29:22 UTC+1): > Is it possible to import files with extensions .xls and .xlsx with go ? -- You received this message because you are subscribed to the Googl

[go-nuts] Import files with extensions .xls and .xlsx .

2023-02-07 Thread Aadi Sharma
Is it possible to import files with extensions .xls and .xlsx with go ? -- 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.

Re: [go-nuts] recommendations please: go source level debugger for linux

2023-02-07 Thread Jason E. Aten
https://github.com/glycerine/vprint shows you how to get source file and line numbers (and timestamps) automatically in your PMD print statements. For examples, I use vv() or VV() for unconditional prints, and pp() or PP() for condition prints that only print if Verbose is true. Debuggers ar

[go-nuts] Re: golang protobuf, struct copy problem

2023-02-07 Thread Jason E. Aten
I wrote greenpack to avoid exactly this; having to maintain two structs in sync. Now I just maintain a single Go struct, and the .go source file serves as the IDL. Running go generate updates the generated serialization code. https://github.com/glycerine/greenpack It is also faster than proto

Re: [go-nuts] Re: TCP hand off?

2023-02-07 Thread Jason E. Aten
Hmm The mysql workbench is going to expect to run the mysql authentication handshake... so you would have to jump in the middle of the tcp stream and substitute the actual password, no? See here for how a new forward tunnel can be run from a client https://github.com/glycerine/sshego/blob/05

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

2023-02-07 Thread Jason E. Aten
I have the requirement of make sure that downstream processes all data currently being sent. I usually have the client submit a Request struct the includes a new Done channel. When the downstream goroutine finishes processing a given Request r, they close the r.Done channel. The client can wa

[go-nuts] Re: TCP hand off?

2023-02-07 Thread Jason E. Aten
I don't recall (would have to re-read the SSH RFCs) if an ssh server is allowed to initiate a tunnel. It might have to be started on the client side. But that is pretty easy to arrange using the ssh -L flag. Could you have them run your authentication tool after they ssh login with ssh -L 3306

Re: [go-nuts] Error Handling

2023-02-07 Thread Richard Masci
You said: "and FTR, I'd also consider your function a bad idea, but that's none of my business" <- I'll be the first to say not all my ideas are good ones, maybe this one isn't? Thanks for your response. On Tue, Feb 7, 2023 at 4:45 PM Axel Wagner wrote: > No, that is not possible. Only a `retur

Re: [go-nuts] Error Handling

2023-02-07 Thread 'Axel Wagner' via golang-nuts
No, that is not possible. Only a `return` statement can return. You *can* unwind the stack, using `panic` or `runtime.GoExit` (which is what `t.Fatal` does) but it's a bad idea in general (and FTR, I'd also consider your function a bad idea, but that's none of my business). On Tue, Feb 7, 2023 at

[go-nuts] Error Handling

2023-02-07 Thread Rich
In most of my code I create a function to handle errors. looks something like this: func errorHandle(err error, str string, ex bool) { if err != nil { fmt.Printf("error: %s -- %v\n",str, err) } if ex { os.Exit(1) } } This cleans up my code: inFile, err :

[go-nuts] TCP hand off?

2023-02-07 Thread Rich
I have a database that I want to be able to allow users to connect to. I didn't design this database, just trying to come up with a way to allow users to connect. The way they set this database up is that there are three users, Read, Read/write, and Admin. What I have done is write a tool tha

Re: [go-nuts] How to correctly use exec.Command and properly clean up all pipes

2023-02-07 Thread Rich
Not sure if this helps at all, but I've stopped using Go's exec and use bitfield's script command. You can do so much more with it than you can with the standard exec and it's shorter to implement than Go's exec. https://github.com/bitfield/script On Monday, February 6, 2023 at 5:43:45 PM UTC-

[go-nuts] Re: how to get the json line number when getting unmarshal errors?

2023-02-07 Thread Rich
I use a tool called hjson hjson/hjson-go: Hjson for Go (github.com) This not only lets you put comments into the code but many times can be used to fix json. Some of my tools the user has to generate a JSON payload then send it with my tool. I will take their

[go-nuts] Re: Re-entrant locks?

2023-02-07 Thread jake...@gmail.com
Or maybe its because, if the language included them, then people would use them. And that is (almost?) always a bad idea. Not providing a tool that usually leads to code that is hard to maintain, and often incorrect or poorly designed seems to be in line with Go's overall vision. One of the rea

Re: [go-nuts] extract VCS branch name used during build

2023-02-07 Thread Tobias Klausmann
Hi! On Mon, 06 Feb 2023, quin...@gmail.com wrote: > I would like to be able to extract the VCS branch name used during build. > Currently I append "-X main.BranchName=${BRANCH}" to the build line which > works, but I was hoping there might be a cunning way to extract this from > runtime/debug?

[go-nuts] Re: Re-entrant locks?

2023-02-07 Thread Robert Engels
And you have to make sure that a ctx is not incorrectly shared… ugh. > On Feb 7, 2023, at 7:41 AM, Robert Engels wrote: > > I know this topic comes up a bit and I’ve done a bit more research. > > Is a contributing reason that Go does not have re-entrant locks is that Go > does not have any

[go-nuts] Re-entrant locks?

2023-02-07 Thread Robert Engels
I know this topic comes up a bit and I’ve done a bit more research. Is a contributing reason that Go does not have re-entrant locks is that Go does not have any way to get Go routine identity? It seems you cannot write a reentrant lock - at least not with the typical syntax - without specialize