[go-nuts] Using client-go to access a specific context, not current context

2024-02-25 Thread David Karr
I'm relatively new to golang, although I'm pretty familiar with Kubernetes. I want to see if I can use client-go as a framework for a set of scripts that get (or set) information on a specific cluster. I don't want to use the current context, I want to set the context name on the command

Re: [go-nuts] How to have a raw parameter value in cobra?

2024-02-25 Thread David Karr
hen, process the > 1st parameter > // Then > rootCmd.SetArgs(os.Args[2:]) > rootCmd.Execute() > } > > On Sun, Feb 25, 2024 at 1:50 PM David Karr wrote: > > > > But where would that be done? I'm not certain of the exact role of the > "rootCmd.Execute()&quo

Re: [go-nuts] How to have a raw parameter value in cobra?

2024-02-25 Thread David Karr
ess the first > parameter yourself. > > On Sun, Feb 25, 2024 at 11:43 AM David Karr wrote: > > > > I am not a new programmer, but I am pretty new to golang, having only > written a couple of small applications, and that was several months ago. > I'm trying to construc

[go-nuts] How to have a raw parameter value in cobra?

2024-02-25 Thread David Karr
I am not a new programmer, but I am pretty new to golang, having only written a couple of small applications, and that was several months ago. I'm trying to construct an application using Cobra, using some nonstandard conventions. Is it better to ask a question like this in an issue in the

Re: [go-nuts] Re: New edition of the Go Programming Language comming soon ?

2022-03-15 Thread David Karr
There is nothing new here. Every programming language, framework, and tool has had the same problem. Quality documentation and training is often the hardest thing to produce, and is often deemphasized in budgets. It's also part of the last 10% of doing something that usually takes 90% of the

Re: [go-nuts] How to debug "Not a valid zip file" from zip.OpenReader

2022-02-23 Thread David Karr
Ok. I did that. https://github.com/golang/go/issues/51337 . On Wed, Feb 23, 2022 at 4:20 PM Ian Lance Taylor wrote: > On Wed, Feb 23, 2022 at 1:46 PM David Karr > wrote: > > > > A while ago, I wrote a small Go app that reads things from zip files. I > tested it w

[go-nuts] How to debug "Not a valid zip file" from zip.OpenReader

2022-02-23 Thread David Karr
A while ago, I wrote a small Go app that reads things from zip files. I tested it with various zip files (usually Java jar files), and it has always worked perfectly fine. Today I'm looking at another jar file. The Java "jar" command likes it perfectly fine. I could list the contents and

[go-nuts] Getting "$GOPATH/go.mod exists but should not" when running build in a Docker image

2022-02-11 Thread David Karr
I had earlier written a note about troubles refactoring my project to have a "src" directory, but I've backed off on that for now. I see that the main problem I saw with that hasn't changed when backing out those changes. It appears that running this build inside a docker image seems to be

[go-nuts] Having trouble getting app to build with Docker after moving to a "src" directory

2022-02-10 Thread David Karr
I had a small go application building successfully. I had the go.mod and main.go in the root directory of the project, and I was building it pretty easily with a Makefile, which just did the following: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o target/dist/linux-amd64 I decided I

[go-nuts] What exactly can be supplied as "packages" on the go build command line?

2022-02-10 Thread David Karr
When I enter "go help build", the first few lines shows this: usage: go build [-o output] [build flags] [packages] Build compiles the packages named by the import paths, The instructions say very little about what can be supplied as "packages". It says it can be a list of .go files, and

Re: [go-nuts] How to vary cgo lib path by os?

2021-11-27 Thread David Karr
On Saturday, November 27, 2021 at 1:13:12 PM UTC-8 David Karr wrote: > On Sat, Nov 27, 2021 at 11:57 AM Ian Lance Taylor > wrote: > >> On Sat, Nov 27, 2021 at 11:01 AM David Karr >> wrote: >> > >> > I'm aware of the "build constraints" m

Re: [go-nuts] How to vary cgo lib path by os?

2021-11-27 Thread David Karr
On Sat, Nov 27, 2021 at 11:57 AM Ian Lance Taylor wrote: > On Sat, Nov 27, 2021 at 11:01 AM David Karr > wrote: > > > > I'm aware of the "build constraints" mechanism, which lets individual > files be only compiled on specific oses or architectures. > >

[go-nuts] How to vary cgo lib path by os?

2021-11-27 Thread David Karr
I'm aware of the "build constraints" mechanism, which lets individual files be only compiled on specific oses or architectures. I am constructing an app that has a single cgo module, which is the "meat" of the application (longest module). In my poc, the cgo header specifies a lib path with

Re: [go-nuts] some incorrect code in blog.

2021-11-25 Thread David Karr
%v\n", f) > if err != nil { > fmt.Println("NO FILE") > //return >} >defer f.Close() > fmt.Println("END") > } > > > Am Do., 25. Nov. 2021 um 21:43 Uhr schrieb David Karr < > davidmichaelk...@gmail.com>:

Re: [go-nuts] some incorrect code in blog.

2021-11-25 Thread David Karr
And did you test that with a file path that would fail? On Thu, Nov 25, 2021, 11:40 Roland Müller wrote: > Hello, > > actually trying this with os.Open() the program behaves the same > regardless whether the defer is before or after the error handling, Thus, > no panic :-) > > Isn't anything

Re: [go-nuts] some incorrect code in blog.

2021-11-24 Thread David Karr
On Wed, Nov 24, 2021 at 6:14 PM Fannie Zhang wrote: > Hi all, > > There is some incorrect code in > https://go.dev/blog/defer-panic-and-recover blog. > > The original code is > *func CopyFile() {* > * ...* > * if err != nil {* > * return* > * }* > * defer src.Close()* > * ...* >

[go-nuts] Re: Getting "cgo argument has Go pointer to Go pointer"

2021-11-15 Thread David Karr
On Monday, November 15, 2021 at 3:49:20 PM UTC-8 David Karr wrote: > > I'm pretty new to Go (many years in other languages). I'm trying to use > cgo to use a C library we're using. > > I have the following line of code, which is compiling (that's been enough > of a struggle)

[go-nuts] Getting "cgo argument has Go pointer to Go pointer"

2021-11-15 Thread David Karr
I'm pretty new to Go (many years in other languages). I'm trying to use cgo to use a C library we're using. I have the following line of code, which is compiling (that's been enough of a struggle): status = int(C.VeProtect(C.VeObj(fpeProtect), )) This is failing at runtime with