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

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

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

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

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

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

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: 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

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] 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

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

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

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

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] 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

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

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

[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

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. > > I

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

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

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

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

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

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] 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

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

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) >        

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(, big.NewInt(1)) >     fmt.Println(b.String()) >     fmt.Println(c.String()) >     fmt.Println(a.String()) > } > > >

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 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. > > I thi

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

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

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

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

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

2024-04-20 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 > } > ```

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

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

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 =

<    1   2   3