[go-nuts] Re: About "godebug (x509negativeserial=1)"

2025-06-12 Thread David Karr
nteger >>> on your certs serial numbers to see which if any are old... >>> >>> var tbs cryptobyte.String seems to imply it is using >>> "golang.org/x/crypto/cryptobyte" >>> so that code would be, in the v0.39.0 version, >>> &

[go-nuts] About "godebug (x509negativeserial=1)"

2025-06-11 Thread David Karr
This may be better asked in a k8s forum, but I'm not aware of a good one, and as I've never seen this anywhere but in Go applications, perhaps someone here will know about this. In our enterprise, we have a bunch of k8s clusters. I have a bunch of Go code using the k8s client api to get data f

Re: [go-nuts] Surprised by inflexibility of time.Parse wrt 1 or 2 digit months

2025-06-10 Thread David Karr
 PM UTC-7 Brian Candler wrote: > On Monday, 9 June 2025 at 20:15:52 UTC+1 David Karr wrote: > > I did. It fails to parse dates with two digits for the month or day. > > > Can you show a specific example?? It works for me: > https://go.dev/play/p/hu0q9uInP_h > > -- Yo

Re: [go-nuts] Surprised by inflexibility of time.Parse wrt 1 or 2 digit months

2025-06-09 Thread David Karr
I did. It fails to parse dates with two digits for the month or day. On Monday, June 9, 2025 at 12:05:26 PM UTC-7 burak serdar wrote: > > > On Mon, Jun 9, 2025, 10:00 PM David Karr wrote: > >> I've used "time.Parse()" several times in various small applica

[go-nuts] Surprised by inflexibility of time.Parse wrt 1 or 2 digit months

2025-06-09 Thread David Karr
I've used "time.Parse()" several times in various small applications, and today I realized a curious inflexibility with it. If I have to parse date values where the months or days could be either 1 or 2 digits, which is all cases if the code might be dealing with dates anywhere in the year, the

[go-nuts] Meta question about server cert at proxy.golang.org

2025-04-24 Thread David Karr
I haven't had to download a module from remote for a while. Today I am seeing the following: *go: module k8s.io/client-go/tools/clientcmd: Get "https://proxy.golang.org/k8s.io/client-go/tools/clientcmd/@v/list": tls: failed to parse certificate from server: x509: negative serial number* With

Re: [go-nuts] Can't figure out why simple mockserver doesn't hit the handler

2025-03-15 Thread David Karr
eader(http.StatusOK) > } > > server := newMockServer(handler) > defer server.Close() > > client := server.Client() > client.Get(server.URL) > > } > > func newMockServer(handlerFunc http.HandlerFunc) *httptest.Server { > return

[go-nuts] Can't figure out why simple mockserver doesn't hit the handler

2025-03-14 Thread David Karr
A little while ago, I was able to write some unit tests for some code that makes an http connection. I created a mockserver and a client using that server. That test in that application works fine. I'm now trying to do basically the same thing in a different application. I'm trying to start wi

[go-nuts] "gopkg.in/yaml.v2" package silently misparses file that is misformatted

2025-02-27 Thread David Karr
I wrote some code to load a yaml file and do some work with the resulting data. I'm using the "gopkg.in/yaml.v2" package for it. This has been working fine for properly formatted YAML. However, today I discovered that a slightly misformatted YAML file is being happily loaded by this code, wi

Re: [go-nuts] Trying to define generic methods to access a memory cache

2025-02-12 Thread David Karr
anch string, commits []T) { commitsCacheMutex.Lock() defer commitsCacheMutex.Unlock() var anyResult []any for _, commit := range commits { anyResult = append(anyResult, commit) } commitsCache[project+"/"+repo+"/"+branch] = anyResult } On Wednesday, February 12, 2025 at 2:33

Re: [go-nuts] Trying to define generic methods to access a memory cache

2025-02-12 Thread David Karr
Wed, Feb 12, 2025 at 10:54 PM David Karr wrote: > > `[]any` is a slice type (https://go.dev/ref/spec#Slice_types), not an > interface type (https://go.dev/ref/spec#Interface_types). > > But type assertions, as in `expr.(someType)`, are valid only for > interface types: ht

[go-nuts] Trying to define generic methods to access a memory cache

2025-02-12 Thread David Karr
I don't expect this should be very difficult, go-wise, but I haven't written much code with generics yet. I have an application that can read commits from either github or bitbucket, but each run will either be for bitbucket or github, not both. I have to retrieve the commits for a branch a co

[go-nuts] How to prove that GOPROXY is being used?

2024-12-13 Thread David Karr
I'm currently using Go 1.23.2. We have a few applications that reference packages on github. We're now in a situation where we have to ensure that packages are obtained from our internal github proxy, not directly from github. So, I set GOPROXY to point to the repository we set up for this, a

[go-nuts] How to define struct with defined properties that is also a map

2024-09-12 Thread David Karr
This is probably basic, but I'm working on some code that unmarshals JIRA tickets (just for some context). Examining the Json output, there is a big "fields" object that mostly contains custom fields, but also some defined fields. Right now, I defined "Fields" as a "map[string]any", which is approp

[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 line

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

2024-02-25 Thread David Karr
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(

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

2024-02-25 Thread David Karr
process 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 t

[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 Cobr

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 time

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 extr

[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 som

[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 w

[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 app

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&qu

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. > &g

[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 "li

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 dec

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

[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), &argsProtect)) This is failing at runtime with