Re: [go-nuts] Re: [security] Go 1.24.3 and Go 1.23.9 are released

2025-05-11 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2025-05-11 at 13:30 +, 'Eric Jacksch' via golang-nuts wrote: > > > How to build go from source The instructions at https://go.dev/doc/install/source should help with this. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubsc

Re: [go-nuts] Re: Why this compilation error ?

2025-03-17 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2025-03-17 at 21:03 -0700, tapi...@gmail.com wrote: > I prefer *new(T) over T{}, because not only the reason here, but also > the former has a smaller inline cost. What do you mean by "inline cost"? https://godbolt.org/z/h8Krq7W8G -- You received this message because you are subscribed

Re: [go-nuts] Looking for a Learning Buddy to Learn Go Programming!

2025-02-24 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2025-02-24 at 16:43 -0800, Robert Solomon wrote: > I am interested in the gophers slack channel.  How do I join it?  > #newbies would probably be the best fit for me The invite link is here: https://invite.slack.golangbridge.org/ -- You received this message because you are subscribed t

Re: [go-nuts] why url.Parse return err=nil with an apparently invalid URL

2025-02-20 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2025-02-20 at 23:38 -0600, robert engels wrote: > Also, see https://datatracker.ietf.org/doc/html/rfc2396#section-3 for > more details on the scheme + authority. The BNF is (including only the parts that are necessary to show validity): absoluteURI = scheme ":" ( hier_part | opaque_par

Re: [go-nuts] why url.Parse return err=nil with an apparently invalid URL

2025-02-20 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2025-02-20 at 20:05 +0800, Lin Lin wrote: > Hi, gophers > > I ran into a URL parsing issue and am a little confused about the > url.Parse behavior.The doc says: > > // Parse parses a raw url into a [URL] structure. > // > // The url may be relative (a path, without a host) or absolute > /

Re: [go-nuts] Why does using time.Time.Compare like this work?

2025-02-20 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2025-02-20 at 09:57 -0800, cpu...@gmail.com wrote: > Sorry for not finding a better than this click bait subject.  > > In https://github.com/golang/go/issues/62642 this suggestion was > made: > > slices.SortFunc(times, time.Time.Compare) > > It's totally unclear to me how Time.Compare ma

Re: [go-nuts] Looking for Go module path (contains version) suggestion for github.com/spdx/spdx-go-model

2025-01-24 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2025-01-24 at 18:29 -0800, Meng Zhuo wrote: > The spdx has it's own version for SPDX spec (i.e. v3_0_1) > https://spdx.github.io/spdx-spec/v2.3/ > > but go module's version might conflict this. > If an user import spdx v2.3(with go mod version 1.0.0), he will end > up import  `github.com/s

Re: [go-nuts] Looking for Go module path (contains version) suggestion for github.com/spdx/spdx-go-model

2025-01-23 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2025-01-23 at 19:17 -0800, Meng Zhuo wrote: > Hi,  > > What should we do if module named with version? > ``` > import ( >     "testing" > >     Spdx3_0_1 "github.com/spdx/spdx-go-model/v3_0_1" > ``` > > https://github.com/spdx/spdx-go-model/pull/1 >From the code that's in that change, t

Re: [go-nuts] When are two channels equal?

2025-01-21 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2025-01-21 at 23:13 -0800, Jason E. Aten wrote: > I think comparable just means "will compile without error". Yes, this is the case. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

Re: [go-nuts] When are two channels equal?

2025-01-21 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2025-01-21 at 23:00 -0800, Jason E. Aten wrote: > > So what is "the same make"? It's not the same make, it's the same *call* to make. So a := make(chan struct{}); b := a; if a == b { /* this executes */ }. -- You received this message because you are subscribed to the Google Groups "go

Re: [go-nuts] inconsistent min max signatures with variadics

2025-01-20 Thread 'Dan Kortschak' via golang-nuts
Agreed. My understanding was that this was because the min and max functions get written as an unrolled set of cmp instructions, rather than as a loop, and while this was not included in the spec for obvious reasons, it is why the spec was written that way. Dan On Mon, 2025-01-20 at 14:35 -0800,

Re: [go-nuts] inconsistent min max signatures with variadics

2025-01-20 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2025-01-20 at 10:42 -0800, Ian Lance Taylor wrote: > Calling append with an empty slice is well defined. Calling min or > max with an empty slice is not. If the only input to min/max were the slice, this would be true, but I do not think it is in the case that is implemented in the standar

Re: [go-nuts] Allow relaxed type casting on more general assignments?

2025-01-14 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2025-01-15 at 02:33 -0500, Mike Schinkel wrote: > When you say compatibility, what would be a use-case where existing > code would break?  Something related to using reflection that expect > the exact signature? For example https://go.dev/play/p/MLT3byjtGRJ -- You received this message b

Re: [go-nuts] "go-import" is great, we need "go-delete"

2025-01-12 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2025-01-12 at 19:45 -0600, Jeffery Carr wrote: > > https://go.dev/desidesign/25530-sumdbgn/25530-sumdb. > > > > Ironically, someone did 'go-delete' on that package so the document > is missing ;) This is the correct link: https://go.dev/design/25530-sumdb -- You received this message b

Re: [go-nuts] "go-import" is great, we need "go-delete"

2024-12-27 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-12-27 at 17:01 -0800, Jeffery Carr wrote: > I won't go into the nefarious reasons here. Let's just say it's going > to have to be fixed. > > Cryptographically signing this is bad. This kind of argument is unlikely to result in any change. If there is something that you have knowledge

Re: [go-nuts] "go-import" is great, we need "go-delete"

2024-12-27 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-12-27 at 15:42 -0800, Jeffery Carr wrote: > The fact of the matter is that sometimes, I make really dumb > mistakes. In the case of versioning things wrong, or making namespace > errors, one needs to redo the namespace from scratch. This means we > need some sort of way of purging name

Re: [go-nuts] Re: Working with release candidates

2024-12-20 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-12-20 at 16:13 -0600, Jeffery Carr wrote: > versions of required binaries are, in my experience, best left to the > OS distribution and packaging people. Almost certainly not. The point of module version specification is to allow reproducible builds. Leaving this up to things outside

Re: [go-nuts] deadcode: unreachable func which is exclusively used in tests

2024-11-19 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2024-11-19 at 15:52 +0100, Chris Burkert wrote: > Hi Axel, > > > Maybe you can add something like `var _ = SkipIfIntegration` to > > your package? i.e. trick the linter to stop it from complaining?  > > > > > I already tried this, but it did not help. > > I even added the following, wh

Re: [go-nuts] Re: no direct write to a complex types components?

2024-11-09 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2024-11-09 at 17:01 -0800, 'simon place' via golang-nuts wrote: > > > That's because Complex numbers are immutable - just like strings, > > and regular numbers for that matter. > > > > Hence to replace one component of a complex number, you have to > > create a new complex number. > > htt

Re: [go-nuts] first class iterator values?

2024-08-16 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-08-16 at 12:09 +0200, 'Axel Wagner' via golang-nuts wrote: > Or with half the allocations: https://go.dev/play/p/LmtNdR-hfWY > I can't get it down to 1 allocation, which should be the theoretical > minimum, as I can't get the compiler to move the closure and the > state being closed ov

Re: [go-nuts] first class iterator values?

2024-08-16 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-08-16 at 07:34 +, Costanza, Pascal wrote: > I haven’t double-checked, but according to the documentation of the > standard library, this should be possible: You can get an iterator > over a map from the maps package, and then convert it into a pull- > style iterator using the iter

[go-nuts] first class iterator values?

2024-08-15 Thread 'Dan Kortschak' via golang-nuts
Currently the Gonum graph packages make use of go:linkname abuse to be able to implement first class iterator values that can be passed. We also have a reflect-based implementation, but this incurs a significant performance cost and so cannot be used as the default implementation (users are able to

Re: [go-nuts] Preserving special characters when reading Go POST request body

2024-07-02 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2024-07-01 at 12:03 -0700, Hugh Myrie wrote: > I am trying to preserve special characters (group separators and > field separators) when reading the request body from a POST request. > > When I do a dumpRequest I am able to see the special characters (Hex > Format, for example: \x1c or \x0

Re: [go-nuts] strip / reduce module compile size

2024-06-14 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-06-14 at 19:35 -0500, robert engels wrote: > Something doesn’t seem right... You state the total compiled size is > 22MB, but the first 3 entries combined are more than that. It looks like goweight just gets the size of the .a files that are generated during the build and returns the

Re: [go-nuts] var errors stdlib

2024-05-10 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-05-10 at 04:24 -0700, Sebastian Bogan wrote: > Hello Everyone, > > I was wondering, what was / is the reason for exposing errors as > public vars - rather than constants? Doesn't that impose some risk? > > For example: > >   fs.ErrNotExist = errors.New("foo") >   _, err = os.ReadFil

Re: [go-nuts] Re: couldn't print numbers ordered with goroutine

2024-04-20 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2024-04-21 at 15:06 +1200, Justin Israel wrote: > And really I wasn't even commenting on the nature of the channel. > Only the scheduling of the goroutines. Buffered or not, they would > still be random order right?  Absolutely. Your answer was spot on. The issue is the ordering of the gor

Re: [go-nuts] Re: couldn't print numbers ordered with goroutine

2024-04-20 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2024-04-20 at 18:55 -0700, Robert Solomon wrote: > channels are not queues, as Justin said They can be; buffered channels are queues. >From https://go.dev/ref/spec#Channel_types > Channels act as first-in-first-out queues. For example, if one > goroutine sends values on a channel and a s

Re: [go-nuts] why math.Pow gives different results depending on exp type

2024-04-19 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2024-04-19 at 22:51 -0700, DrGo wrote: > ``` > package main > > import ( > "fmt" > "math" > ) > > func main() { > fmt.Printf("%g\n", 1-(math.Pow(0.6, 1/13)))   //result=0 > fmt.Printf("%g\n", 1-(math.Pow(0.6, 1.0/13))) // > result=0.038532272011602364 > } > ``` 1/

Re: [go-nuts] Re: Trying to understand aversion to main package

2024-02-14 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2024-02-14 at 15:31 -0800, Jeremy French wrote: > I really think the testability issue is the biggest one.  Generally, > testing the main package iscumbersome at least.  So it's > reasonable to say, "I'm not going to test the main package, but I > will keep it so simple that it is impos

Re: [go-nuts] big int panic on text conversion

2024-02-14 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2024-02-14 at 12:24 +0100, Jan Mercl wrote: > On Wed, Feb 14, 2024 at 12:14 PM 'Dan Kortschak' via golang-nuts > wrote: > > > Given that this can happen without a race or unsafe modifications > > it > > might be worth filing a issue for. > >

Re: [go-nuts] Trying to understand aversion to main package

2024-02-14 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2024-02-14 at 03:12 -0800, Jerry Londergaard wrote: > I see quite a few modules out there where they seem to be putting in > as little into the main package as possible. Literally they will > sometimes be a few lines: > ``` > import foobar > func main() { >     os.Exit(foobar.Run()) > } > `

Re: [go-nuts] big int panic on text conversion

2024-02-14 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2024-02-14 at 02:07 -0800, Poonai wrote: > Thanks all, > > figured out the issue: > > func main() { >     a := big.NewInt(1) >     b := *a >     c := *a >     c.Sub(&c, big.NewInt(1)) >     fmt.Println(b.String()) >     fmt.Println(c.String()) >     fmt.Println(a.String()) > } > > > rep

Re: [go-nuts] big int panic on text conversion

2024-02-13 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2024-02-13 at 21:35 -0800, Poonai wrote: > big int panics during text conversion randomly  > > stack trace: > > panic: runtime error: index out of range [1] with length 1 > > goroutine 2088184 [running]: > math/big.nat.itoa({0xc01db71500, 0x1, 0x199?}, 0x0, 0xa) >         /usr/local/go/s

Re: [go-nuts] Re: need a package to read/write shell history flat file database

2024-02-10 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2024-02-10 at 21:01 -0800, Kurtis Rader wrote: > The only solution I can find that gets close to my requirements is > https://github.com/ergochat/readline, but AFAICT it does not handle > updates to the on-disk history file by concurrently executing > processes. There is also https://pkg.g

Re: [go-nuts] Incorrect "missing return" error for an edge case

2024-01-07 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2024-01-08 at 06:21 +0100, 'Axel Wagner' via golang-nuts wrote: > The "missing return" error is defined in the spec, by requiring a > function to end in a terminating statement: > https://go.dev/ref/spec#Terminating_statements > The list is necessarily not complete. So it is necessarily mor

Re: [go-nuts] Re: How to get net.Conn in rpc function in net/rpc

2023-12-28 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2023-12-28 at 13:14 -0800, 'Christian Stewart' via golang-nuts wrote: > I agree with what Brian said and would like to suggest the following > two way RPC library with multiplexing over a single connection of any > type: > > https://github.com/aperturerobotics/starpc > There is also http

Re: [go-nuts] Need help running "go get" on self hosted git server

2023-12-18 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2023-12-17 at 07:06 -0800, Brijesh Wawdhane wrote: > I added a go-import meta tag to my git server's website on the repo > page and it looks like > > https://brijesh.dev/kairos.git";> > > but when I try running "go get brijesh.dev/kairos" I get an error > saying 'go: unrecognized import p

Re: [go-nuts] Re: Is "When in doubt, use a pointer receiver" misleading advice?

2023-11-13 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2023-11-13 at 19:38 -0800, Mike Schinkel wrote: > I have been wondering for a while why the advice against mixing > pointer and value receivers, which GoLang so often flags me for > doing. https://dave.cheney.net/2015/11/18/wednesday-pop-quiz-spot-the-race -- You received this message b

Re: [go-nuts] Re: Clace: Secure web application development platform using Starlark

2023-10-31 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2023-10-31 at 02:50 -0700, Jason E. Aten wrote: > > > On Tuesday, October 31, 2023 at 3:12:13 AM UTC Dan Kortschak wrote: > > The Mozilla FAQ https://www.mozilla.org/en-US/MPL/2.0/FAQ/ appears > > to > > think it's OK. > > > > > Q13: May I combine MPL-licensed code and BSD-licensed code

Re: [go-nuts] Re: Clace: Secure web application development platform using Starlark

2023-10-30 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2023-10-30 at 23:29 -0700, TheDiveO wrote: > Unfortunatelly, "okay" hasn't been tested in court yet and especially > with HashiCorp breaking bad you surely have the deep pockets to see > this through? This is not really my problem, I was just pointing out that the authors of the license ha

Re: [go-nuts] Re: Clace: Secure web application development platform using Starlark

2023-10-30 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2023-10-30 at 18:43 -0700, Jason E. Aten wrote: > I'm surprised by that claim. I seriously doubt, from reading the > licenses, that you can legally use the Apache2 license, since > it removes the MPL requirements; which the MPL forbids you from > doing.   > The Mozilla FAQ https://www.moz

Re: [go-nuts] Can Generics match implementers of an interface?

2023-10-21 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2023-10-21 at 11:58 -0700, Mike Schinkel wrote: > Recently I was trying to write a func using generics where I wanted > to use a slice of an interface that would contain implementers of > that interface and then pass those types to a generic function, but I > ran into this error: > > type

Re: [go-nuts] Can we not invoke methods on types referring to generics?

2023-10-19 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2023-10-20 at 11:56 +0700, Nurahmadie Nurahmadie wrote: > why is there no, type coercion, as you said, that allow the new type > to be acknowledged as its underlying type? which will not be a > question if otherwise Go has mechanism to allow methods to be > attached to foreign types. There

Re: [go-nuts] Dynamic template data from yaml

2023-10-14 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2023-10-14 at 13:15 -0700, Tong Sun wrote: > Hmm... somehow I had the impression that only the exported fields can > be used in template as variables. > > Is that a wrong impression or things have changed? You are indexing into a map so so the notion of fields is not relevant. -- You re

Re: [go-nuts] Dynamic template data from yaml

2023-10-14 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2023-10-14 at 09:33 -0700, Tong Sun wrote: > Please take a look at  > https://go.dev/play/p/dTDR50dtHB0 > > I want to > > - define my template data dynamically from yaml > - and export the yaml data if they are unexported > > I.e., for the following code: > > t := template.New("")

[go-nuts] semantics of panic stack traces

2023-09-17 Thread 'Dan Kortschak' via golang-nuts
I'm trying to get my head around a panic stack trace from a user report[1]. The parameter value make very little sense to me based on what they should be from following the program logic. For example the {0x0?, 0x0, 0x1?} (a slice header len=0) in github.com/elastic/beats/v7/winlogbeat/sys/wineve

Re: [go-nuts] how to write methods for a generic Matrix[float64 constrained by Addable]?

2023-09-09 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2023-09-09 at 15:39 -0700, Jason E. Aten wrote: > New to generics... how can I write a method for a Matrix[float64] > that uses a math function that expects a float64?   I get: > > ./slurp1.go:936:18: cannot use m.At(i, j) (value of type float64 > constrained by Addable) as float64 value i

Re: [go-nuts] does gonum insist on row-major?

2023-08-26 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2023-08-26 at 07:28 -0700, Brian Candler wrote: > Could you explain the comment "all of Go is cm"? > https://go.dev/play/p/tDJiSTqsiSC > Sorry, that was a typo, should read "all of Go is rm" (what is there is inconsistent with everything else I wrote). -- You received this message becau

Re: [go-nuts] does gonum insist on row-major?

2023-08-26 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2023-08-26 at 13:45 +0100, Jason E. Aten wrote: > ah... there is documentation, it is just buried... > > https://pkg.go.dev/gonum.org/v1/gonum/mat#section-readme > > "All matrices are stored in row-major format and users should > consider this when expressing matrix arithmetic to ensure o

Re: [go-nuts] weird "index out of range" in strconv.formatBits

2023-08-18 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2023-08-17 at 23:32 -0700, metronome wrote: > > > Have you built with CGO_ENABLED=0? > Building with CGO_ENABLED=0 succeeded, does that mean the binary's > runtime behavior has nothing to do with CGO, deploying > a CGO_ENABLED=0 binary online is not an option as well, for now (We > are tryi

Re: [go-nuts] Why is foo in my go.sum file?

2023-08-18 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2023-08-18 at 16:49 +1000, Nigel Tao wrote: > The go.sum file in the golang.org/x/image repo has a line that is not > another golang.org.x/* module: > > github.com/yuin/goldmark v1.4.13/go.mod > h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= > > https://github.com/golang/image/blob/2b687

Re: [go-nuts] keyword= support for function calls

2023-08-17 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2023-08-17 at 11:34 +0200, Peter Herth wrote: > I think the omission of keyword parameters in Go is a weakness. In > many cases, keyword parameters are a simple way of creating APIs, > which depend on a lot of possible parameters, of which most are not > necessarily specified. Their omissio

Re: [go-nuts] weird "index out of range" in strconv.formatBits

2023-08-16 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2023-08-16 at 23:43 -0700, metronome wrote: > Thanks for commenting, a few supplements. > > # 1. Version of Go? > We observed the issue with both go1.20.5 and go1.18.10 on linux/amd64 > (centos) > > # 2. Context? > All panics we observed so far are from either  >                  strconv.

Re: [go-nuts] weird "index out of range" in strconv.formatBits

2023-08-16 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2023-08-16 at 20:31 -0700, metronome wrote: > Hi, > > We ran into a weird out of range issue of strconv.formatBits, hope > someone can shed a light on what could be the root cause, any comment > is highly appreciated. > > problem description: >       random out of range at code, most of t

Re: [go-nuts] [RFC] Yet another proposal for Go2 error handling

2023-07-02 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2023-07-02 at 10:41 -0700, Jeremy French wrote: > Scrolling in code is bad - a necessary evil, obviously, but evil > nonetheless.  Vertical scrolling is bad because it causes what we > were looking at to move and our eyes have to track and/or reacquire > what we were looking at.  It's obvio

Re: [go-nuts] [RFC] Yet another proposal for Go2 error handling

2023-07-01 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2023-07-01 at 22:34 -0700, Mike Schinkel wrote: > > What is the difference to if err != nil { goto } ? > > Thanks you for asking. > > If you run go fmt  on a file that contains the formatting you ask > about the line will be expanded to the 3 lines, which brings us back > to status quo:

Re: [go-nuts] fmt.Printf Go-syntax formated representation of the value

2023-04-28 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2023-04-27 at 23:02 -0700, Jérôme LAFORGE wrote: > Hello, > In my unit tests when expected is not the actual result, I like > display actual value with Go-syntax. For example: > if got != expected { > t.Errorf(" %#v", got) // []string{"blah','blah"} > } > > But it want to know if ther

Re: [go-nuts] Short Variable Declarations Are Oversold

2023-04-22 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2023-04-22 at 15:31 -0700, jlfo...@berkeley.edu wrote: > What type should I use to declare “file” in the parameter list for > myfunc()? As a new Go programmer I have to admit that I haven’t > memorized all the types used in the Go standard library. So, I have > to break off working on myfun

Re: [go-nuts] Is there a gofmt flag to avoid reformatting comments?

2023-04-19 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2023-04-19 at 14:30 -0700, Ian Lance Taylor wrote: > > If you give us more details perhaps there is some common ground > available.  In particular, a sequence of lines where each line is > indented will be treated as a code block, and not reformatted. Related, I'd like to reiterate the co

Re: [go-nuts] Avoid forcing my module users' to carry dependencies from code that live under the same repo just as examples/ debugging purposes.

2023-04-14 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2023-04-14 at 14:01 +0800, Jim Idle wrote: > You might start with this repo: > > https://github.com/golang-standards/project-layout > > This is not an 'official' standard, though it does encapsulate the > things that are standard go such as the internal directory.  > > Personally I avoid

Re: [go-nuts] Interesting "select" examples

2023-04-06 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2023-04-03 at 14:59 -0700, Skip Tavakkolian wrote: > Nice pause/resume. I'll need to remember this. > > On Mon, Apr 3, 2023 at 3:14 AM Rob Pike wrote: > > > > Here's an excerpt from a piece of concurrent code I like, an > > unpublished interactive game of life. The select near the bottom >

Re: [go-nuts] How to generalize parameters for a function

2023-03-15 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2023-03-15 at 12:55 -0400, Frank Juedes wrote: > > > Hi Dan, > Thank you very much for your answer, so that's the data structure > behind maps, very interesting. > I had actually thought about using unsafe pointers and then type- > casting, but that is how i would have done it in the C-deka

Re: [go-nuts] How to generalize parameters for a function

2023-03-15 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2023-03-14 at 19:56 -0700, Kurtis Rader wrote: > Maps are a special-case. You can't pass them "by value" in the sense > you mean because a "map" value is a very tiny structure that contains > a pointer to the actual map. The passed value is a pointer to the header, otherwise changes to map

Re: [go-nuts] overriding image.Decode image type detection

2023-03-05 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2023-03-06 at 14:38 +1100, Nigel Tao wrote: > On Sun, Feb 26, 2023 at 12:43 PM 'Dan Kortschak' via golang-nuts > wrote: > > The alternative is to > > replicate the image.Decode functionality, including registration > > which > > seems ugly. &

[go-nuts] overriding image.Decode image type detection

2023-02-25 Thread 'Dan Kortschak' via golang-nuts
I'm implementing a image renderer on an external device and want to include GIF animation support. So far this is working fine, but I've found a difficulty that comes from for image.Decode's file type detection is registered. What I have is shim type that wraps *gif.GIF but also implements image.I

Re: [go-nuts] %v display of nil map

2023-01-25 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2023-01-25 at 07:21 -0800, Andrew Athan wrote: > I'm sure I'm not the first to say this, but here's my +1: > > It seems wrong to me that golang displays nil-valued reference types > as an empty instance of the type with no indication that the > reference is nil. > > E.g. > ``` > var m map[s

Re: [go-nuts] Which tool provide's the Go playground's import handling...

2023-01-06 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2023-01-06 at 00:13 -0800, 'Mark' via golang-nuts wrote: > If I visit the Go playground and change the body of `main()` to, say, > `fmt.Println("hello", math.Abs(-5))` and then click Run, the `import > "fmt"` line is _automatically_ corrected to be `import > (\n\t"fmt"\n\t"math"\n)`. I'd li

Re: [go-nuts] More details regarding changes to time.Time JSON marshalling/unmarshalling in 1.20?

2023-01-04 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2023-01-03 at 20:50 -0800, 'Ben Brcan' via golang-nuts wrote: > Hi, I noticed this in the draft release notes for 1.20: > > The Time.MarshalJSON and Time.UnmarshalJSON methods are now more > strict about adherence to RFC 3339. > > Can we get some further details about this? Are there things

Re: [go-nuts] MATLAB filtfilt --> GOLANG

2023-01-01 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2023-01-01 at 12:24 -0800, 이석태 wrote: > Hello, Golang Team, > > I want to convert MATLAB ' filtfilt ' command to Golang. > Actually, MATLAB 'filtfilt' command was 'filter' command as a  > one dimensional signal filter. > > I am using 6 * 1 matrix coefficienct for 'filter' command. > > Is th

Re: [go-nuts] How to expoert DWARF and symbol table in a in separate file when build?

2022-12-28 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2022-12-28 at 18:14 -0800, 庞子元 wrote: > Hi All, > > For security reasons, our go cannot be compiled with information like > DWARF and symbol tables.  > > Is there a way to put this information in a separate file so that we > can link to it when we need it? > > Any tips are greatly appreciat

Re: [go-nuts] Linting

2022-12-10 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2022-12-10 at 14:44 +0100, Marcello H wrote: > golangci_lint ... > > Op za 10 dec. 2022 om 13:17 schreef Brian Candler > : > > The question remains, which linter(s) are you using? golangci_lint is not really an answer to this question since it's just a collection of linters, many of which

Re: [go-nuts] Re: Looking Backend Dev Learning Resources

2022-12-05 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2022-12-05 at 14:54 -0600, Robert Engels wrote: > Can you elaborate on that reference? At first review, it means you > are putting in lots of effort making lots of progress (anti red > queen) but that would mean the progress made did not invalidate any > of effective Go (which seems not pos

Re: [go-nuts] Re: Looking Backend Dev Learning Resources

2022-12-05 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2022-12-05 at 09:27 -0800, Tsvetomir Lazarov wrote: > How relevant is Effective Go actually, given the January 2022 update > that this document has not been updated significantly since 2009? Still relevant. This is one of the virtues of having a language that is not built on the Red Queen

Re: [go-nuts] Re: go install of forked repo

2022-12-05 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2022-12-04 at 23:47 -0800, 'Christian Stewart' via golang-nuts wrote: > I definitely fork things and use "replace" quite frequently. It *can* be used, but it is not the solution in the general case as Volker said. A replace in a library's go.mod file has no effect on consumers of that libr

Re: [go-nuts] cgo C.uint64_t compatiblity on multiple platforms?

2022-12-03 Thread 'Dan Kortschak' via golang-nuts
On Sat, 2022-12-03 at 10:51 -0800, David Stainton wrote: > Greetings, > > I think my question is something like: "how to make my usage of > C.uint64_t work on all platforms?" or "Is there something obviously > wrong with my cgo bindings that is causing this not to build on all > platforms?" > > I w

Re: [go-nuts] How to fix an awful marshal reflection hack

2022-12-01 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2022-12-01 at 00:33 -0800, 'Mark' via golang-nuts wrote: > Thanks. I've now tried that as follows: > >         fmt.Printf("@@: %T %v\n", field, field) >         kind = field.Type().Elem().Kind() >         fmt.Printf("##: %T %v\n", field, field) > > In every case the output for kind

Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-22 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2022-11-22 at 10:16 -0800, Ian Lance Taylor wrote: > On Tue, Nov 22, 2022 at 10:11 AM Robert Engels > wrote: > > > > I do not know why the mailing list is set up as the sender is the > > user. Is should always have the sender be the list email and the > > name be the user, or the sender de

Re: [go-nuts] where is GOROOT set?

2022-11-17 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2022-11-17 at 21:20 -0800, pat2...@gmail.com wrote: > pfarrell@Alien15:~/whome/sandbox/gows/src/github.com/pfarrell51/cmd$ > go test treesort_test.go This is not how go test should be invoked. You just need to do go test in the directory that you package lives in. See https://pkg.go.dev/c

Re: [go-nuts] BUGFIX-66: Algorithmic Puzzles in Go

2022-11-14 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2022-11-13 at 14:43 -0800, Lawrence Ryan wrote: > So you're suggesting that a user could write code containing a race, > have that code produce, say, a slice with the wrong length (by > interleaving the pointer and length/capacity writes), and then use > that "mixed" slice to compromise the

Re: [go-nuts] Re: Unicode variable name error

2022-11-08 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2022-11-08 at 09:17 -0800, TheDiveO wrote: > I've always wondered how to deal with exported versus unexported > identifiers in scripts like Chinese? There is an issue for this https://go.dev/issue/22188 which discusses the approaches that are currently used with a view to making it easier.

Re: [go-nuts] Parsing comments that don't start with a space

2022-11-06 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2022-11-06 at 11:55 -0800, 'Christian Stewart' via golang-nuts wrote: >  - Why does the comment not appear unless I put a space before? (in > ast CommentMap) This is explained here https://pkg.go.dev/go/ast#CommentGroup.Text > Comment directives like "//line" and "//go:noinline" are also

Re: [go-nuts] Re: go:embed question

2022-10-14 Thread 'Dan Kortschak' via golang-nuts
On Fri, 2022-10-14 at 00:17 -0700, esimov wrote: > . Now, that's not the case when you are running a package using the > following command: "go run github.com/user/package@latest" for > example Can you give an example of a real package where this doesn't work? -- You received this message becaus

Re: [go-nuts] Go routine context

2022-10-02 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2022-10-03 at 00:46 +0200, Sven Anderson wrote: > As it happens, I wrote a small package, that does that „almost“ > legally:  > https://pkg.go.dev/github.com/ansiwen/gctx There is also github.com/kortschak/goroutine for getting goroutine IDs, which can be used as the primitive for construc

Re: [go-nuts] Go routine context

2022-10-02 Thread 'Dan Kortschak' via golang-nuts
On Sun, 2022-10-02 at 06:15 -0500, Robert Engels wrote: > Again, I would like a link to the source of statement to evaluate it > in context.  https://manningbooks.medium.com/interview-with-brian-goetz-7d6c47d05d63 -- You received this message because you are subscribed to the Google Groups "gol

Re: [go-nuts] understanding interface conversions

2022-09-22 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2022-09-22 at 20:01 -0500, Robert Engels wrote: > The world figured out long ago that OO and it’s principles are a > better way to go. This is a very strong assertion (pun not intended). I heartily disagree with the claim, particularly when it comes to how OO is implemented by class-based

Re: [go-nuts] cannot convert fs.FS zip file to io.ReadSeeker (missing Seek)

2022-09-21 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2022-09-21 at 19:30 -0500, robert engels wrote: > Others have suggested passing a ByteBuffer - I don’t think that will > work because you will be missing other methods that are probably > needed (FileInfo to get the name, etc) The function that was pointed to takes an ~io.ReadSeeker (oddly

Re: [go-nuts] cannot convert fs.FS zip file to io.ReadSeeker (missing Seek)

2022-09-21 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2022-09-22 at 00:58 +0100, Rory Campbell-Lange wrote: > interface conversion: *zip.checksumReader is not io.ReadSeeker: > missing method Seek > > Advice on how to rectify this would be gratefully received. Would it be acceptable to conditionally copy the reader's contents into a buffer tha

Re: [go-nuts] How to resolve error Cannot use 'struct{ width, height float64 }{2.0, 3.0}' (type struct {...}) as the type struct {...}

2022-08-30 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2022-08-30 at 07:46 -0700, Richard Whatever wrote: > I'm developing a mvc Golang server. > The model file is as follows: >  type Object struct { ... TargetSize struct{ width, height float64 } > `json:"targetSize"` ... } > The controller file is as follows: > func (c *GetObject) Get() []mode

Re: [go-nuts] Is Go a security malware risk?

2022-08-25 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2022-08-25 at 01:47 -0700, Holloway Kean Ho wrote: > What exactly you're trying to achieve by taking a very elaborated, > crystal-clear, good-willed security-related article way out of its > context with your thread title here and agitate some of the Go > maintainers here? I don't think th

Re: [go-nuts] time.Truncate unexpected results in non-hour aligned timezones

2022-08-23 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2022-08-23 at 23:07 -0700, Mine GO BOOM wrote: > Our system recently experienced a bug because of the surprise that > sits (documented) inside of time.Truncate(): > > """ > Truncate operates on the time as an absolute duration since the zero > time; it does not operate on the presentation f

Re: [go-nuts] Is Go a security malware risk?

2022-08-22 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2022-08-22 at 06:15 -0700, 'Gopher-Insane' via golang-nuts wrote: > Hi > > So our security team has raised a concern with Go and malware. The > link that was sent to me > was https://securityboulevard.com/2021/09/behavior-based-detection-ca > n-stop-exotic-malware/.  > I reached out to Bill

Re: [go-nuts] Library for printing a struct as a compiler recognized version

2022-08-16 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2022-08-15 at 21:23 -0700, John wrote: > Thank you everyone who responded.  Gave utter a look and its pretty > decent.  I found litter a bit more developed around the circular > reference area.  But both were great suggestions and just what I was > looking for. I would be careful with lit

Re: [go-nuts] Library for printing a struct as a compiler recognized version

2022-08-15 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2022-08-15 at 07:26 -0700, John wrote: > I know we have plenty of pretty printing out there, but i'm looking > for a package that can print the Go representation of a Struct out to > screen. > > So given: > > var x := &myStruct{ >   A: "hello" > } > > someLib.Print(x) > > I get: > > &myStru

Re: [go-nuts] Preemptive interfaces in Go

2022-08-10 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2022-08-10 at 11:17 -0700, Mike Schinkel wrote: > In my experience having control over the implementation is not a > black-and-white thing, unless you are the sole developer on a > project. This also brings in the consideration of that if you have complete control over the implementation,

Re: [go-nuts] Methods of reflect pkg use mostly panic instead of return error. Why so?

2022-07-20 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2022-07-20 at 22:51 +0200, 'Axel Wagner' via golang-nuts wrote: > The reason reflect uses panic, is for convenience. It would be > inconvenient having to check an error at every reflect call. The other reason is that a panic in reflect is as close as you can get in runtime to a compile err

Re: [go-nuts] Re: duration^2

2022-07-19 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2022-07-19 at 09:24 -0700, Amnon wrote: > > time.NewTicker( time.Duration(n) * time.Second )  ok : duration > > * duration [s^2] square-seconds ? > > Yes, this bothers the inner Physicist in me too. > But you can only multiply numbers if they are of the same type... With a small amount

Re: [go-nuts] Is this a compilation optimization bug ?

2022-06-29 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2022-06-28 at 09:40 -0700, Ian Lance Taylor wrote: > Please open an issue.  Thanks. Filed https://go.dev/issue/53600. Dan -- 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,

Re: [go-nuts] Is this a compilation optimization bug ?

2022-06-28 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2022-06-27 at 23:32 -0700, iori yamada wrote: > Running the code in the link below times out, is this a bug? > Looking at the assembly, it seems that the instructions corresponding > to the if statement have been removed due to optimization. > > https://go.dev/play/p/CZX4mbyrp37 > > The fol

Re: [go-nuts] unrecognized import path "code.google.com/p/go.crypto/openpgp"

2022-06-09 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2022-06-09 at 14:21 -0700, Peter Sjolin wrote: > I attempted to use "code.google.com/p/go.crypto/openpgp" in my > project and got the following error: > $ go get code.google.com/p/go.crypto/openpgp > go: unrecognized import path "code.google.com/p/go.crypto/openpgp": > parse https://code.go

Re: [go-nuts] How to prevent default sorting of map

2022-05-30 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2022-05-30 at 08:23 -0700, Vejju Deepesh wrote: > I want know the method of preventing sorting by default and maintain > the map in the order of insertion If you want ordered return of elements and O(1) look-up, use a slice and an index map. Insertion becomes and appends and a map insertio

  1   2   3   >