[go-nuts] Re: Profiling the `go` tool itself?

2024-10-25 Thread jake...@gmail.com
May be related to this gonuts post . As of go 1.19 I (and others) get slow builds on Windows, apparently because of excessive file reads on every build. I was getting 2,000 standard library files read, in their entirety, to b

[go-nuts] Re: How to have panic messages show in a PowerShell console

2024-03-01 Thread jake...@gmail.com
FWIW, in a very simple test on Windows 10 in a powershell console, running a go executable built with go1.19 prints the panic just like in a regular cmd console. On Wednesday, February 28, 2024 at 3:20:55 PM UTC-5 Thom BENTLEY wrote: > Hi All, > > OS: Windows 10 > GoLang: go1.6.3 windows/386

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-24 Thread jake...@gmail.com
What is really fantastical is that a==b prints false, even though the pointers are actually the same. I am guessing some sort of optimization effect is at play here. https://go.dev/play/p/Dsqeh_aAXKT type Foo struct { } func main() { a := &Foo{} b := &Foo{} fmt.Printf("%t\n", *a == *b) fmt.P

[go-nuts] Re: GO language best practice document

2023-09-13 Thread jake...@gmail.com
In addition to the style guide, I have found https://github.com/golang/go/wiki/CodeReviewComments to have some interesting insights. On Friday, September 8, 2023 at 9:05:12 AM UTC-4 Alexandre Roy wrote: > Hi, > > I want to start a new web application using GO with AWS Lambda, but first > I wan

[go-nuts] Re: slog's use of runtime.Callers() with a skip

2023-08-11 Thread jake...@gmail.com
As far as I can tell, skip works even in the face of inlined functions, at least when used with runtime.CallersFrames(). It would be surprising to me if it did not. Do you have any evidence to the contrary? On Friday, August 4, 2023 at 9:51:34 AM UTC-4 sh...@tigera.io wrote: > I was looking at

[go-nuts] Re: Where are closure storing the captured variables ?

2023-07-06 Thread jake...@gmail.com
In addition to Axel's useful info, whenever you are interested in what escapes to the 'heap', it can be helpful to build with escape analyses output. Try using "go build -gcflags=-m". On Wednesday, July 5, 2023 at 8:35:52 PM UTC-4 chris...@meessen.net wrote: > Hello, > > Closure need space t

[go-nuts] Re: 'go run hello.go' taking ~30 seconds on windows

2023-06-23 Thread jake...@gmail.com
This may be related. I have always had a significant delay when building Go programs on Windows. It mostly happens the first time I build, if I have not built recently. A normal build of a simple program is about 3 seconds of wall clock time, whereas it can take over 20 seconds when it is being

[go-nuts] Re: Pointer constraint to generics

2023-04-15 Thread jake...@gmail.com
What About: func PointerOrError[T *Q, Q any](s C.StatusOr ) (t T, err error) Seems to compile: https://go.dev/play/p/n4I-XkONj-O?v=gotip On Saturday, April 15, 2023 at 6:28:39 AM UTC-4 Jan wrote: > hi, > > This is a variation for a previous topic >

[go-nuts] Re: Ask about Golang Behavior

2023-03-20 Thread jake...@gmail.com
You have: fmt.Println("AFTER:", newMessage.Biawaks == nil, cap(message.Biawaks)) Did you mean: fmt.Println("AFTER:", newMessage.Biawaks == nil, cap( newMessage.Biawaks)) If so, then On Monday, March 20, 2023 at 11:44:54 AM UTC-4 febriananda pramudita wrote: > I was playing with protobuf marshal

[go-nuts] Re: catching an internal/poll error?

2023-02-19 Thread jake...@gmail.com
You might want to dig a bit more. The error that generated that string would not be an ErrFileClosing. It appears that it originated with an ErrFileClosing, but by the time it gets to you it has been wrapped more than once as it percolated up the layers of code. On Sunday, February 19, 2023 at

[go-nuts] Re: memory issues

2023-02-09 Thread jake...@gmail.com
What Marcello said! But also, the message mentions bad use of Unsafe.Pointer. You might want to look at uses in your app, and even third party libraries. See the documentation: https://pkg.go.dev/unsafe#Pointer - The rules must be followed to the letter! Are you using cgo? It also has very s

[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] Creating and Linking to Shared Library Version of Go Runtime?

2023-01-29 Thread jake...@gmail.com
This is pretty OT, and I am no expert, but the overwhelming consensus on the inter-tubes seems to be that *reading *from an SSD causes no 'wear' whatsoever. It is only writes and deletes that age an SSD. So this use case should not impact SSD life. But it is an interesting endeavor on its own.

[go-nuts] Re: dont know how to use library in go

2023-01-21 Thread jake...@gmail.com
It sounds to me like you are trying to write linux code to load a .so file. Not something I have done in a while, but since no one else has offered any help, I will give you a few pointers. I believe that syscall.LoadDLL is for Windows only, so that code *will not work* at all in linux. You

[go-nuts] Re: marshalling array of bson.M

2023-01-15 Thread jake...@gmail.com
You will probably get more help if you provide the relevant details, such as which bson package you are using. And provide an *example *that shows what you have tried that produces the error. A playground link using the "share" button is the preferred way to include examp

Re: [go-nuts] How does the go compiler treat initialized string variables?

2022-11-02 Thread jake...@gmail.com
Just to add a tidbit to what Jan said. The key here is that strings (type string) in Go are immutable, whereas strings ("char *" based types) in C are not. That is why the same string can be used again and again without ever needing to be copied, and why they can live in the text segment. On T

[go-nuts] Re: Atomic pointers to arrays and sequenced-before guarantees for array elements

2022-10-30 Thread jake...@gmail.com
I would like to give you a definitive answer, but the same question comes up in https://groups.google.com/g/golang-nuts/c/Gze1TRtdLdc/ and there is much disagreement and no clear resolution. (The initial question is not exactly yours, but if I understand correctly, the discussion quickly gets s

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

2022-10-16 Thread jake...@gmail.com
What makes you think that go run github.com/esimov/caire/cmd/caire@latest is not embedding properly? On my system it seems like it works fine, and the file gets embedded. I'm using go 1.19 on windows. Perhaps you could give a more detailed example of what you are doing (actual commands) and wha

[go-nuts] Re: maps.Keys() does not work when keys are of type language.Tag

2022-10-06 Thread jake...@gmail.com
It appears to be because, deep down, the language.Tag struct contains an interface. While interfaces are "comparable", in that you can use == & !=, apparently they do not implement the 'comparable ' constraint. I'm not sure why this decision was made, th

[go-nuts] Re: the difference between type and type address in struct

2022-08-28 Thread jake...@gmail.com
The terminology we would generally use is '*dog' is a pointer, not a "type address". The difference really has nothing to do with structs, but is the difference between a value and a pointer to a value. If you understand pointers in general, then this more complicated case will make sense. I su

[go-nuts] Re: Excelize

2022-08-17 Thread jake...@gmail.com
I am not familiar with that package. However, if you are referring to github.com/360entsecgroup-skylar/excelize, you can search the issues there on github, and there is some discussion of "secondary axis", which may be what you are referring to. Spoiler, it looks like it is not implemented ...

Re: [go-nuts] About Go 1.19 memory model clarificaitons on atomic operations.

2022-08-15 Thread jake...@gmail.com
On Monday, August 15, 2022 at 5:20:58 AM UTC-4 ma...@changkun.de wrote: > > Any other reading, to me, is trying to find an ambiguity for the sole > sake of finding an ambiguity. > > A reader does not have to be motivated to find ambiguity. If the > sentence can be interpreted with different mea

Re: [go-nuts] Elementary Question About Calling Functions in Different Packages

2022-06-10 Thread jake...@gmail.com
> > So, I'll probably have to keep using multiple packages if I can somehow > figure out how to solve > the package import cycle problem. > The most common solution is to factor out the aspects which cause the cycle > into a third package that one or both of the current packages imports. In >

[go-nuts] Re: How to use thrifter.ToJSON() function

2022-06-09 Thread jake...@gmail.com
>From your first question, it appears that you have never used Go before. I would start with the intro tutorial: A Tour of Go . Other resources and tutorials on the official documentation page might also be helpful. I would also note that the thrift-i

[go-nuts] Re: How to call function from struct in slice?

2022-06-08 Thread jake...@gmail.com
Your playground example was still not runnable. I have fixed it so it runs: https://go.dev/play/p/I57OftEerLY Now that we have a working example, what precisely is the problem you are having? On Saturday, June 4, 2022 at 2:56:43 PM UTC-4 Little Ant wrote: > Thank you Jake, > > I have n

[go-nuts] Re: How to call function from struct in slice?

2022-06-04 Thread jake...@gmail.com
I find your example code confusing, and it *appears* to have multiple syntax errors, which make it impossible to compile. If you could post a complete "working" example to the playground you would probably get a better response. On Thursday, June 2, 2022 at 8:17:04 AM UTC-4 Jay wrote: > > > I

[go-nuts] Re: GO program's memory footprint is confusing

2022-05-05 Thread jake...@gmail.com
Since no one has responded with concrete ideas, I'll throw out two suggestions. They may seem obvious. First have you tries the latest version of Go? and do you get the same results? Second have you run the experiment with a small binaries not from Go? I would suggest something that does all

[go-nuts] Re: Add comparisons to all types

2022-05-04 Thread jake...@gmail.com
On Wednesday, May 4, 2022 at 12:34:10 PM UTC-4 jake...@gmail.com wrote: > For a discussion of this issue as it relates to slices you might find this > thread worth reading through: > https://groups.google.com/g/golang-nuts/c/ajXzEM6lqJI/m/BmSu1m9PAgAJ > > That was 2016, but not

[go-nuts] Re: Add comparisons to all types

2022-05-04 Thread jake...@gmail.com
For a discussion of this issue as it relates to slices you might find this thread worth reading through: https://groups.google.com/g/golang-nuts/c/ajXzEM6lqJI/m/BmSu1m9PAgAJ That was 2016, but not much has really changed since then on this issue. On Monday, May 2, 2022 at 10:43:53 PM UTC-4 wil

Re: [go-nuts] Re: Windows Binaries and stdout

2022-04-29 Thread jake...@gmail.com
This is really a Windows issue, and not related to Go. According to this very old post: https://stackoverflow.com/questions/493536/can-one-executable-be-both-a-console-and-gui-application it is technically possible to do that, but the technique has flaws, foibles and limitations. This sound

Re: [go-nuts] all goroutines are asleep - deadlock!

2022-03-25 Thread jake...@gmail.com
The WaitGroup Documentation says " A WaitGroup must not be copied after first use.". You are passing around and calling choppingActivity by value, so it is being copied after Add() is called, and again each call to choppingAction() and choppingSimulation().

[go-nuts] Re: What goes wrong when embedding goroutines inside a for loop?

2022-02-17 Thread jake...@gmail.com
I think this explains it pretty well: Common Mistakes: Using goroutines on loop iterator variables On Thursday, February 17, 2022 at 11:45:39 AM UTC-5 yan.z...@gmail.com wrote: > package main > impor

Re: [go-nuts] Strange cases of type definitions that use "[]", Go 1.17 and 1.18beta2

2022-02-13 Thread jake...@gmail.com
On Friday, February 11, 2022 at 10:02:42 AM UTC-5 kziem...@gmail.com wrote: > I'm seriously lost here. Code below works in both Go 1.17 and Go 1.18beta2 > > > package main > > > > import "fmt" > > > > type someInterface[3] interface { > > SomeMethod() > > } > > > > func main() { > >

[go-nuts] Re: DataRace with slice, should i fix it or ignore it?

2022-02-10 Thread jake...@gmail.com
On Wednesday, February 9, 2022 at 9:14:52 AM UTC-5 peterGo wrote: > Pelen Li, > > Always fix your data races. You should consider the results of data races > as undefined. > > Dmitry Vyukov, who implemented the Go race detector, once wrote an > interesting article with the title: "Benign data r

Re: [go-nuts] Re: Do you have a minimal runnable go code that contain all key words in go?

2021-12-08 Thread jake...@gmail.com
Runs fine for me with one tiny change: https://go.dev/play/p/VRZKDFGzUcG On Tuesday, December 7, 2021 at 7:21:31 PM UTC-5 Rob 'Commander' Pike wrote: > Oh, it needs to be runnable. Never mind. > > -rob > > On Wed, Dec 8, 2021 at 11:19 AM Rob Pike wrote: > > > > It's easy to fold a few things tog

Re: [go-nuts] Which error handling pattern do you prefer?

2021-11-13 Thread jake...@gmail.com
On Friday, November 12, 2021 at 6:29:46 PM UTC-5 michael...@gmail.com wrote: > FWIW (which may not be much) I've settled on explicitly naming my return > values in the function declaration. If the function returns include an > error, I name always name it err. The general pattern is > > func fo

[go-nuts] Re: Why Doesn't "len()" Work With Structs?

2021-10-25 Thread jake...@gmail.com
On Sunday, October 24, 2021 at 7:44:40 PM UTC-4 jlfo...@berkeley.edu wrote: > Thanks for the replies. > > I had been trying to translate the trick from C into Go where you can find > how many structures are in an initialized array of structures > by dividing the size of the array by the size of o

[go-nuts] Re: Trouble with pgx package

2021-10-02 Thread jake...@gmail.com
If you want to know what the error is, I suggest you print it. That will give you more information. It will also help anyone trying to help you. Also, I notice that you *probably *have "defer conn.Close(context.Background())" in the wrong place.* I don't use pgx*, but the normal paradigm is to

Re: [go-nuts] How to check whether a variable is unreachable?

2021-09-23 Thread jake...@gmail.com
I'm pretty sure new example is not valid Go code to begin with. You violate the rules on converting from uintptr to unsafe.Pointer. If you read the rules at https://pkg.go.dev/unsafe#Pointer, a unitptr can not *generally *be converted to an unsafe.Pointer. Since this code is not valid, the quest

Re: [go-nuts] Re: slices grow at 25% after 1024 but why 1024?

2021-09-05 Thread jake...@gmail.com
You are 100% correct. I missed that value. oops On Sunday, September 5, 2021 at 10:16:08 AM UTC-4 arn...@gmail.com wrote: > > > On Sun, 5 Sep 2021, 14:59 jake...@gmail.com, wrote: > [...] > >> In the example given (https://play.golang.org/p/RJbEkmFsPKM >>

Re: [go-nuts] Re: slices grow at 25% after 1024 but why 1024?

2021-09-05 Thread jake...@gmail.com
Like Brian, I think part of he problem is possibly a miscommunication based on "monotonically increasing". The term means that each point is greater than, *or equal to*, the previous one. https://en.wikipedia.org/wiki/Monotonic_function. In other words, it never decreases. In the example given

[go-nuts] Re: Function to escape and unscape string

2021-09-05 Thread jake...@gmail.com
On Sunday, September 5, 2021 at 12:56:07 AM UTC-4 tapi...@gmail.com wrote: > This is a known problem: https://github.com/golang/go/issues/8618 > I looks the root cause is reflect.TypeOf and ValueOf make the values > referenced by the arguments escape, though often this is over-cautious. > I thin

Re: [go-nuts] Function to escape and unscape string

2021-08-29 Thread jake...@gmail.com
https://pkg.go.dev/strconv#Unquote seems to be what you are describing. Perhaps you could explain *how *it fails to do what you want. Maybe a playground example? On Sunday, August 29, 2021 at 3:53:02 PM UTC-4 nadashin wrote: > > > fmt.Printf has a format specifier,

[go-nuts] Re: Makefiles for Go Programs

2021-08-23 Thread jake...@gmail.com
On Sunday, August 22, 2021 at 11:11:23 PM UTC-4 jlfo...@berkeley.edu wrote: > > I've noticed that few, if any, Go programs use Makefiles. Is that because > the overhead of using make is greater than the overhead of just always > compiling and linking everything? > Go had built in build caching

[go-nuts] Re: Whats wrong with my channel

2021-08-19 Thread jake...@gmail.com
Jan is correct, and you should probably use a sync.WaitGroup to keep your main() alive. But even if you do that, you have a bigger problem. You channel is unbuffered. That means that `d <- a` will block until someone reads from d. Since `factorial` is the only goroutine that uses d, that line w

[go-nuts] Re: how golang stores variables in the computer’s memory?

2021-08-18 Thread jake...@gmail.com
It will also help you look knowledgeable if you refer to the language as Go, never `golang`. The name of the language is just 'Go'. In my experience the term golang should only be used when you need to clarify for a search engine. I don't usually bother correct people on this issue, but given

[go-nuts] Re: What does io.Closer.Close do?

2021-08-10 Thread jake...@gmail.com
Just to clarify, the statement " Close will return an error if it has already been called" on os.File.Close is explicitly not the behavior guaranteed by io.Closer , which specifically states: " The behavior of Close after the fi

Re: [go-nuts] use delve to debug golang with 'next' will skip some step

2021-07-27 Thread jake...@gmail.com
Was the code built with optimizations disabled? On Tuesday, July 27, 2021 at 1:57:17 PM UTC-4 林 子鹏 wrote: > When I use delve to debug this project(dlv debug t.go): > > //t.gopackage main > import ( > "fmt" > "os" > "reflect" > "unsafe" > ) > func main() { > s1 := make([]uint8

[go-nuts] Re: A peculiar sort problem

2021-07-27 Thread jake...@gmail.com
Personally I would be careful about assuming that was the only sorting difference. Unless you have checked every Unicode character, there could be other hidden 'special cases'. If it *really *mattered, personally, I would dig into the .NET library source code and see what algorithm or system cal

[go-nuts] Re: Out of memory using golang.org/x/tools/go/packages

2021-07-21 Thread jake...@gmail.com
The first thing I would do is remove the call to litter, and see if that solved the issue. That would tell you immediately if the problem was the litter package or the packages package. I have so specific knowledge, but it is not impossible to imagine that you are simply trying to print somethi

[go-nuts] Re: How to Optimize A Golang Application Which Has More Than 100 Million Objects at Peak?

2021-07-18 Thread jake...@gmail.com
Two other replies have mentioned Sync.Pool. I agree that Sync.Pool is a valuable tool. However, for the benefit of any beginning gophers who may read this thread, I wanted to point out that, in a situation like yours, I would want to try to reduce heap allocation in other ways first. Not that

[go-nuts] Re: how to create array of structures instances for the nested structures

2021-07-14 Thread jake...@gmail.com
Some ways to do it: https://play.golang.org/p/sg08Buv-E3- Note that arrays are rarely used in Go. When in doubt, default to using a slice. I provided slice examples as well. If you want to initialize a very large array or slice to a value other than the zero value, you could also use a loop.

Re: [External] Re: [go-nuts] build debug golang

2021-07-10 Thread jake...@gmail.com
Thanks Ian. Makes sense now. I was scratching my brain to figure out possible ways that lack of optimization could cause actual failures.The Go team does an amazing job. On Friday, July 9, 2021 at 11:02:59 PM UTC-4 Ian Lance Taylor wrote: > On Fri, Jul 9, 2021 at 8:33 AM jake...@gmail.

Re: [External] Re: [go-nuts] build debug golang

2021-07-09 Thread jake...@gmail.com
On Thursday, July 8, 2021 at 11:45:19 PM UTC-4 Ian Lance Taylor wrote: > On Thu, Jul 8, 2021 at 8:41 PM 董⼀峰 wrote: > > > > Thanks for replying. > > So golang only supports debugging optimized golang runtime? > > Well, Go requires that the runtime package be built with optimization > (when us

[go-nuts] Re: How to pause/restart timer in a benchmark loop?

2021-07-07 Thread jake...@gmail.com
It would be helpful to give more information as to why you say "This doesn't work"? But, I'm guessing that you are not seeing a decline in times when using StartTimer/StopTimer. It is likely that is because the copy function is fast, and frequent calls to StartTimer/StopTimer involve some erro

[go-nuts] Re: about golang defer?

2021-06-28 Thread jake...@gmail.com
I can't help you with your specific question, but two procedural points. First, while such a question is welcome in this group (golang-nuts), you may reach an audience better able to answer it on the golang-dev group, since it deals with the internal det

[go-nuts] Re: Upgrade to Go1.16 from Go1.14 broke my query

2021-06-26 Thread jake...@gmail.com
Is it possible that the version of the library you are using also changed when you changed versions of Go? Have you tried building again, on the same machine, using Go 1.14 to make sure that the only difference is the Go language version? On Thursday, June 24, 2021 at 11:14:30 AM UTC-4 hugh@

Re: [go-nuts] Golang language specification Document: Composite Literals example is not understandable

2021-06-23 Thread jake...@gmail.com
t; meant, which might help explain why you never came across it before. > > Smile. > > -rob > > > On Wed, Jun 23, 2021 at 7:07 AM jake...@gmail.com > wrote: > >> I'm surprised that I have never come across this as a way to create a >> slice with an

[go-nuts] Re: Why does one string concatenation escape, but the other not?

2021-06-23 Thread jake...@gmail.com
It does not answer your question, but possibly provides more clues: https://play.golang.org/p/s9Xnpcx8Mys package main func main() { var a = "b" x := a + a // does not escape x = a + a // does not escape for i := 0; i < 1; i++ { x = a + a // a + a escapes to heap

[go-nuts] Re: WinVerifyTrust WTD_STATEACTION_VERIFY wrong value

2021-06-23 Thread jake...@gmail.com
I would encourage you to file an issue (https://github.com/golang/go/issues), as this seems likely to be a bug. On Tuesday, June 22, 2021 at 8:52:58 PM UTC-4 fedegar...@gmail.com wrote: > Hi all, > I've been struggling a lot to replicate a C++ code that uses > *WinVerifyTrustEx* function in go

Re: [go-nuts] Golang language specification Document: Composite Literals example is not understandable

2021-06-22 Thread jake...@gmail.com
I'm surprised that I have never come across this as a way to create a slice with an initial length: x := []int{100:0} On Tuesday, June 22, 2021 at 12:43:17 PM UTC-4 axel.wa...@googlemail.com wrote: > Oh and also: > > Likewise, I think this only works for array literals; I don’t think >> (thou

Re: [go-nuts] unexpected stuck in sync.(*Pool).Get()

2021-06-22 Thread jake...@gmail.com
Sorry, now I am completely confused. So, you have about 500,000 *processes *running this agent on each machine, >> and each process has around 7,000 gorouines? Is that correct? >> > > Yes, that's exactly what I mean. > but then you say: "Only one process per machine". Is there a language ba

Re: [go-nuts] unexpected stuck in sync.(*Pool).Get()

2021-06-21 Thread jake...@gmail.com
Could you clarify something? You say: " We have about half a million agents running on each of our machines" in your initial message. I thought maybe it was a language thing, and you meant 500,000 goroutines. But then you said: "There are 7000 goroutines total" So, you have about 500,000 *process

Re: [go-nuts] Re: vendoring related question/issue

2021-06-18 Thread jake...@gmail.com
I don't use vendor, so I'm just thinking here. If I understand correctly, a "//go:embed" statement will cause the the target file to be included in the vendor. If that is the case, then perhaps you could create a vendored_files.go file that embeds all the files you want vendored, then add a bui

[go-nuts] Re: Question about container/heap

2021-06-14 Thread jake...@gmail.com
On Sunday, June 13, 2021 at 2:35:42 PM UTC-4 Brian Candler wrote: > On Sunday, 13 June 2021 at 16:09:48 UTC+1 kee...@gmail.com wrote: > >> For my heap, I never had to Push or Pop, I only had to initialize the >> heap and repeatedly "Fix" the top element of the heap. As it turns out the >> Init

[go-nuts] Re: Are receiver copies atomic?

2021-06-08 Thread jake...@gmail.com
I'm not 100% sure what you mean by "copy made atomically" means in this context. But if you mean is calling a value receiver method safe for concurrently, then the answer is no. In fact it can be the source of subtle races. Take for example this simple program (https://play.golang.org/p/Wk5LHx

[go-nuts] Re: Surprising benchmark result

2021-06-07 Thread jake...@gmail.com
FWIW I do not get the same result: goos: windows goarch: amd64 cpu: AMD Phenom(tm) II X4 830 Processor BenchmarkFilter3-4599912 1902 ns/op 0 B/op 0 allocs/op BenchmarkFilter4-4569143 2118 ns/op 0 B/op 0 alloc

Re: [go-nuts] Knowing from documentation whether an interface is holding a pointer or a struct?

2021-06-06 Thread jake...@gmail.com
On Sunday, June 6, 2021 at 9:33:31 AM UTC-4 ren...@ix.netcom.com wrote: > For example, the fact that this code is broken is not intuitively obvious > for any reader. It requires way too much scrutiny IMO. > > https://play.golang.org/p/-f73t_Pm7ur > I would like to note that your example goes a

[go-nuts] Re: embedding files in tests

2021-06-01 Thread jake...@gmail.com
I would strongly assume that the file is only embedded in the test binary. In fact it is hard to imagine a design where it would not be that way. If you really want to make sure, you could easily build two, identical binaries, that differ only in that a very large file is embedded in the test f

Re: [go-nuts] Syscalls that take structs with embedded pointers

2021-05-14 Thread jake...@gmail.com
On Friday, May 14, 2021 at 10:28:24 AM UTC-4 Michael Pratt wrote: > Go has a non-moving GC [1], so that is not an issue. > It is my understanding that the go team has always explicitly maintained the 'right' to change the GC to allow moving memory. Or to allow another implementation of the Go

[go-nuts] Re: Where is the display profile from x/net/idna defined

2021-04-05 Thread jake...@gmail.com
I'm guessing you want to know where the behavior is documented? That I do not know. But in case you literally want to know where it is defied, look at : https://github.com/golang/net/blob/0fccb6fa2b5ce302a9da5afc2513d351bd175889/idna/idna10.0.0.go#L265 On Sunday, April 4, 2021 at 9:03:10 AM UT

[go-nuts] Re: what is a minimal setup for compiling go programs in module mode?

2021-03-24 Thread jake...@gmail.com
> I believe I can't use replace? I'm glad the vendoring solution is what you want. But IIUC what you are trying to do, then there is no reason you can not use replace. For example: require gergrly/otherpackage v0.0.0 replace gergrly/otherpackage => ../otherpackage This works for me. You could

Re: [go-nuts] How to search standard libarary?

2021-03-17 Thread jake...@gmail.com
On Tuesday, March 16, 2021 at 11:59:31 AM UTC-4 Jan Mercl wrote: > Entering `rename site:golang.org/pkg` in Chrome > seems to work well, for example. > > (But I'm not using this kind of search so there might be some issues > I'm not aware of.) > > I'm unclear what you a

Re: [go-nuts] Searching recursively in GOLANG

2021-03-17 Thread jake...@gmail.com
You could also achieve this using the regexp package. But, in this case, it would probably be overkill. On Tuesday, March 16, 2021 at 2:55:29 AM UTC-4 Sharan Guhan wrote: > Thanks for the tip! I just wanted to make sure, I am not missing some > basic API out there.. Will code this up :-) > >

Re: [go-nuts] How to search standard libarary?

2021-03-16 Thread jake...@gmail.com
On Tuesday, March 16, 2021 at 11:31:51 AM UTC-4 eli...@gmail.com wrote: > I really like devdocs.io for this > > You type "Go" and TAB, and then it will only autocomplete in the Go stdlib. > Thanks, that seems to do what I want. It seems like a real oversight that there is no search on the offic

[go-nuts] Re: How to search standard libarary?

2021-03-16 Thread jake...@gmail.com
On Tuesday, March 16, 2021 at 11:28:06 AM UTC-4 Carla Pfaff wrote: > On Tuesday, 16 March 2021 at 15:09:25 UTC+1 jake...@gmail.com wrote: > >> Any suggestions? > > > You can use this: https://cs.opensource.google/go > While that may be useful in its own way, it is not

[go-nuts] How to search standard libarary?

2021-03-16 Thread jake...@gmail.com
For years now, when I needed to casually lookup a standard library function I would use the search on the website. Like https://golang.org/search?q=Rename. This no longer works, and the search box on the Go website and "Package Documentation" page is now gone. Has this moved somewhere else? H

[go-nuts] Re: No generic, part -2

2021-03-13 Thread jake...@gmail.com
ng-nuts/c/LEEuJPOg0oo/m/uGjSw4VGBgAJ>. [I will no longer be following this thread] - Jake On Friday, March 12, 2021 at 10:30:49 AM UTC-5 alex-coder wrote: > Hello again, > I apologize for being so intrusive. > Where it is possible to read about the evaluations of labor and complexit

Re: [go-nuts] What does `go install path/to/main.go` do with GO111MODULE=on?

2021-03-10 Thread jake...@gmail.com
What version of Go are you using? On Wednesday, March 10, 2021 at 6:20:50 PM UTC-5 mattm...@gmail.com wrote: > Thanks for the message! Unfortunately, > > GOBIN=$GOPATH/bin go install ./cmd/app/main.go > > Doesn't change anything. Actually I'm realizing that even without go > modules but with $G

[go-nuts] Re: Windows Event logs

2021-03-10 Thread jake...@gmail.com
I can't help directly, but since no one else has responded, maybe this will help. The windows API call OpenEventLogW() would be the first step. Looking on Github for examples of Go code that makes this call ( https://github.com/search?p=2&q=OpenEventLogW+language%3AGo&type=Code), you may be ab

[go-nuts] Re: how can I solve it 2 decimal places float32 with fmt.Println()

2021-03-04 Thread jake...@gmail.com
Can you tell us what the problem is that you want to solve? The code3 seems to run just fine. On Thursday, March 4, 2021 at 11:31:57 AM UTC-5 Tareq Ibna wrote: > package main > import "fmt" > > func main(){ > > //I want to solve this peoblen with fmt.Println() please help. > > > var a,

[go-nuts] Re: normal mode and starve mode of sync.Mutex and runtime mutex?

2021-01-31 Thread jake...@gmail.com
What makes you think it does not? Have you looked at Mutex.lockSlow()? I have not really worked through the algorithm, but the comments do mention starvation mode. On Sunday, January 31, 2021 at 10:15:23 AM UTC-5 cuiw...@gmail.com wrote: > why mutex in runtime do not need starve mode? -- You

[go-nuts] Re: Options other than pointers, regarding code duplication

2021-01-28 Thread jake...@gmail.com
Perhaps providing some code could be helpful. That way we can better understand what the issues are. Minimally the function signatures you have now, and the signature of common function you are calling inside them, as well as the definitions of any types being passes. Of course, the full code

[go-nuts] Re: Quick question about the generics alternatives that have been considered

2021-01-20 Thread jake...@gmail.com
If I understand correctly, this question is specifically addressed by the design draft: https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#why-not-put-type-parameters-on-packages On Wednesday, January 20, 2021 at 10:22:19 AM UTC-5 atd...@gmail.com wrote:

[go-nuts] Re: Waitgroup problem

2021-01-16 Thread jake...@gmail.com
There may be other problems as well, but the WaitGroup.Add documentation says: " If a WaitGroup is reused to wait for several independent sets of events, new Add calls must happen after all previous Wait calls have *returned*." You have a race condit

[go-nuts] Re: The GitHub Vet Project

2020-12-30 Thread jake...@gmail.com
On Tuesday, December 29, 2020 at 1:21:04 PM UTC-5 k.alex...@gmail.com wrote: > I'd like to solicit some input from the community regarding a decision > that could reduce the effort required in crowdsourcing. > > After thinking carefully about the loopclosure vet check >

[go-nuts] Re: How to set the "godebug" environment variable from the go file?

2020-12-16 Thread jake...@gmail.com
Could you explain in more detail why you want to always run with cgocheck=0. That seems ill advised at first glance. I'm not sure what that has to do with "I want to disable some controls." On Wednesday, December 16, 2020 at 11:50:04 AM UTC-5 Sean wrote: > hi all, > i have a project I have to w

[go-nuts] Re: Purpose of pattern in muxEntry

2020-12-15 Thread jake...@gmail.com
I have no special knowledge of the code, but it looks like the reason is so that ServeMux.es, which is a []muxEntry, can be searched. See the latter half of `func (mux *ServeMux) match() ` for example. That said, it may be possible t

[go-nuts] Re: Good books to learn Golang deeply?

2020-12-14 Thread jake...@gmail.com
Two previous posts on this topic: https://groups.google.com/g/golang-nuts/c/chxehZ29uOQ/m/0DeZBJiMCAAJ https://groups.google.com/g/golang-nuts/c/hU_cLsp1r70/m/NvIcU-KcCAAJ You might also find some interesting ideas in: https://groups.google.com/g/golang-nuts/search?q=subject%3Alearn On Monday, De

[go-nuts] Re: iterate over Interface

2020-12-11 Thread jake...@gmail.com
I'm genuinely confused about what you are trying to accomplish. In the code you posted you don't iterate over anything. Also, the variables d and f in your code are completely redundant. You could remove the 4 lines and simply ` fmt.Println("Output", pslice )`, and get the same result. So, perha

[go-nuts] Re: Garbage Collector triggering when deleting an object

2020-11-24 Thread jake...@gmail.com
On Monday, November 23, 2020 at 6:31:50 AM UTC-5 tokers wrote: > Are there any documents? > https://golang.org/pkg/runtime/#SetFinalizer -- 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] Re: Local variable escapes to heap

2020-11-21 Thread jake...@gmail.com
For me, the example you gave of sorty is a strong argument against adding go:local. If I understand correctly, using go:local, if a variable marked this way actually does escape it would cause undefined behavior, possibly in unrelated code. This is the type of bug that is very, very hard to find

Re: [go-nuts] detecting cyclic references

2020-11-10 Thread jake...@gmail.com
FYI, that does detect the simple case of l[0] = l, but not more complicated circular cases like l[1] = l[1:] On Tuesday, November 10, 2020 at 2:38:26 AM UTC-5 axel.wa...@googlemail.com wrote: > If the slice is empty, it doesn't reference anything. > If it is not empty, &x[0] can be used to iden

[go-nuts] Re: use same for/range code on a hash map but it has different result

2020-11-10 Thread jake...@gmail.com
I'm not sure what strange way you decided to show your code, but in my Firefox browser all I see is two empty boxes. Please use fixed width *plain text* for all code in this group. Thanks. On Tuesday, November 10, 2020 at 9:12:54 AM UTC-5 Kilos wrote: > when I run the same code like this > ht

Re: [go-nuts] Trying to call powershell script from Go

2020-10-28 Thread jake...@gmail.com
2:18:25 PM UTC-4 mua...@gmail.com wrote: > Hi Jake, > > The code I posted is the runnable go program just missing the powershell > script which is a separate file. Maybe I'm miss understanding? Is there > something else I can provide to help you understand further? > &

Re: [go-nuts] Trying to call powershell script from Go

2020-10-27 Thread jake...@gmail.com
It might help if you posted an actual runnable program, that you have personally run, and the full output. On Tuesday, October 27, 2020 at 1:26:53 PM UTC-4 mua...@gmail.com wrote: > Hi Marvin, > > If I add script.ps1 in double quotes and try to run, it tells me cmdName > declared but no used.

Re: [go-nuts] Re: Proposal to add Index operator methods

2020-10-04 Thread jake...@gmail.com
On Sunday, October 4, 2020 at 4:50:10 PM UTC-4 kortschak wrote: > On Sun, 2020-10-04 at 09:06 -0700, jake...@gmail.com wrote: > > I stopped reading at the " Show example code before and after the > > change " because many of the examples of "before the change" c

[go-nuts] Re: Proposal to add Index operator methods

2020-10-04 Thread jake...@gmail.com
I stopped reading at the " Show example code before and after the change " because many of the examples of "before the change" code seem to be invalid in go, and the others do not do what you seem to imply they do. Am I misinterpreting this section in some way? On Sunday, October 4, 2020 at 1

[go-nuts] Re: Proper way of mocking interfaces in unit tests - the golang way

2020-10-03 Thread jake...@gmail.com
On Saturday, October 3, 2020 at 6:00:10 AM UTC-4 krish...@gmail.com wrote: > Hey, > > Thanks for both the explanations. They really make sense to me. > > I referred to the following link and thought assertions are against go > best practices => https://golang.org/doc/faq#testing_framework. >

Re: [go-nuts] Windows Write Call Error when Writing to Network mapped Folder.

2020-09-23 Thread jake...@gmail.com
On Wednesday, September 23, 2020 at 1:26:10 PM UTC-4 helhadad wrote: > Thanks Ian, > The root cause of this issue is not the hard drive, it is something with > overlapped offset and high offset values, need to be set to 0 to have a > smooth APPEND to the file. > I need to use /x/sys/windows pac

  1   2   3   >