[go-nuts] Re: Allocating lots (e.g. a million) objects on the heap

2020-07-21 Thread jake...@gmail.com
Do the data structures contain pointers? If not, I seem to strongly recall that the GC does not have to scan slices when the objects contain no pointers. Perhaps someone with in-depth knowledge of the GC can confirm or refute that. If that is the case, then large slices should not be a burden o

[go-nuts] Re: Generics and parentheses

2020-07-25 Thread jake...@gmail.com
Presumably the instantiation of generic types and functions will be a lot more common than the declarations. How does your proposal handle those? (FWIW, I'm fine with square brackets, or really anything other than parens.) On Monday, July 20, 2020 at 12:42:13 PM UTC-4 Geoff Speicher wrote: > Th

[go-nuts] Re: minimum linux kernel version that can run latest golang

2020-07-25 Thread jake...@gmail.com
See the list in https://golang.org/doc/install On Saturday, July 25, 2020 at 1:31:07 AM UTC-4 cuiw...@gmail.com wrote: > what is the minimum version of linux kernel that can run golang? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubsc

Re: [go-nuts] import a file

2020-07-29 Thread jake...@gmail.com
On Tuesday, July 28, 2020 at 11:21:38 PM UTC-4 Kurtis Rader wrote: > See https://golang.org/ref/spec#Import_declarations. By default importing > a package requires using the package name to refer to any symbols it > exports; e.g., "jsonstuff.Prices". You can do "import . jsonstuff" to allow > a

Re: [go-nuts] builtin function definitions

2020-07-30 Thread jake...@gmail.com
The good news is that Go is simpler than many other languages, with fewer constructs, concepts and corner cases. So after using it for a while, you will rarely bump into anything "new". Reading the language spec is great, and I have done it myself a couple of times. But, depending on your level

[go-nuts] Re: Newbie question about type-casts

2020-08-02 Thread jake...@gmail.com
There is probably a better way, but lets start with a clear definition of the problem. Your post says you want to "round *down*" but the variable 'bet' is the result of a divide by 4, rounded *up*. Which do you actually want to do? On Sunday, August 2, 2020 at 5:09:45 PM UTC-4 traxp...@gmail.co

[go-nuts] Re: Is there a gui library for Go, like Gtk+ or similar, which can be used to build statically linked executables ?

2020-08-02 Thread jake...@gmail.com
There is currently no 'clear choice' for GUI in go. It will depend on you needs. Some to look into: https://bitbucket.org/rj/goey/src/master/ https://gioui.org/ https://github.com/andlabs/ui https://github.com/goki/gi https://github.com/lxn/walk On Sunday, August 2, 2020 at 11:53:32 AM UTC-4 Ser

[go-nuts] Re: How to fast transpose byte matrix [][]byte in Golang assembly

2020-08-05 Thread jake...@gmail.com
Not a direct answer, but one simple improvement you could do is to allocate all the rows together, then break them up by slicing. So instead of your: T := make([][]byte, n) for i := 0; i < n; i++ { T[i] = make([]byte, m) } Do something like: T := make([][]byte, n) Q

[go-nuts] Re: [ generics ] Added constraint type inference to the design draft

2020-08-13 Thread jake...@gmail.com
Am I correct in thinking this has NOT been added to the go2go playground yet? When I try the example it fails: https://go2goplay.golang.org/p/TiMsP2K_3DS Or am I making some stupid mistake? On Wednesday, August 12, 2020 at 10:31:51 PM UTC-4 Ian Lance Taylor wrote: > I just added a new section t

[go-nuts] Re: Go Benchmarks And Escape Analysis

2020-08-13 Thread jake...@gmail.com
0.00429 ns/op seems suspiciously low. I suspect that there could be a problem with your benchmark. Could you post the code. ( On this mailing list please just send code as plain text or as a link to the Go playground.) On Thursday, August 13, 2020 at 9:18:52 PM UTC-4 Patrick wrote: > I'm new

[go-nuts] Re: Windows 'Access is denied' for os.Remove after exec.Output()

2020-08-14 Thread jake...@gmail.com
This works fine for me on Windows 10. What is "my.exe" doing? Do you have third party antivirus software? If so, try turning it off. They are notorious for causing this kind of problem. On Friday, August 14, 2020 at 5:02:36 AM UTC-4 atakanc...@gmail.com wrote: > Hello dear fellow gophers, >

[go-nuts] Re: Windows 'Access is denied' for os.Remove after exec.Output()

2020-08-14 Thread jake...@gmail.com
k on the folder, so we > should do some time.Sleep before the os.Remove, so that Windows can release > the lock. > > Thank you both for replying. > > 14 Ağustos 2020 Cuma tarihinde saat 16:21:17 UTC+3 itibarıyla > jake...@gmail.com şunları yazdı: > >> This works f

Re: [go-nuts] map without default values

2020-08-15 Thread jake...@gmail.com
On Friday, August 14, 2020 at 2:52:20 PM UTC-4 Joe Marty wrote: > >> If I know that a value exists, or am fine using the zero value (again, >> that's the majority of my personal use-cases for maps at least), having to >> use a statement just to discard the extra bool is annoying. >> > > Rig

[go-nuts] [generics] Constraint type inference not working

2020-08-16 Thread jake...@gmail.com
When I try the example from the "Constraint type inference" section of the Draft Design: https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#constraint-type-inference it does not seem to actually work: https://go2goplay.golang.org/p/pfq3QV6gdgf What am

[go-nuts] Re: What does "ex-wait-release" mean?

2020-08-17 Thread jake...@gmail.com
See https://groups.google.com/g/golang-dev/c/qtxOW0x4Rrw/m/WqepX5V6AQAJ on the golang-dev forum. It mean that it was wait-release but the tree is now open for development. On Monday, August 17, 2020 at 3:23:55 AM UTC-4 lziq...@gmail.com wrote: > Some of my CLs are tagged with this, and I don't

Re: [go-nuts] Memory synchronization by channel operations and mutexes

2020-08-17 Thread jake...@gmail.com
On Monday, August 17, 2020 at 11:19:16 AM UTC-4 b.ca...@pobox.com wrote: > On Monday, 17 August 2020 11:54:55 UTC+1, leo.b...@npo-data.nl wrote: >> >> E.g. A co-worker pointed out that you can avoid sync.Mutex by using this >> construct: >> >> if !atomic.CompareAndSwapInt32(&s.myLock, 0,

Re: [go-nuts] [generics] Constraint type inference not working

2020-08-18 Thread jake...@gmail.com
Submitted https://github.com/golang/go/issues/40859 On Tuesday, August 18, 2020 at 12:59:21 AM UTC-4 Ian Lance Taylor wrote: > On Sun, Aug 16, 2020 at 7:42 AM jake...@gmail.com > wrote: > > > > When I try the example from the "Constraint type inference" section of

[go-nuts] Re: Mysterious RSS memory spike

2020-08-24 Thread jake...@gmail.com
If it helps any, I do not see this in Windows 10. After 5,000 iterations the "low memory" mark, as reported by windows, is still just 1,101MB. On Monday, August 24, 2020 at 5:05:00 AM UTC-4 vlad...@varank.in wrote: > Hey, > > I haven't looked deep but I recall there had been a note about runtim

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

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

[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

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

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] Trying to call powershell script from Go

2020-10-28 Thread jake...@gmail.com
gt; On Tuesday, October 27, 2020 at 8:48:54 PM UTC+3 jake...@gmail.com wrote: > >> 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: &g

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

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

[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

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

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: No generic, part -2

2021-03-13 Thread jake...@gmail.com
This thread seems like it has devolved into a rehashing of the recent Generics, please go away! thread . This seems unfair to the original poster, who asked a simple , respectful, question in good faith, and seems to be satis

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

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

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

[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

[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

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

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

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

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

[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

[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

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

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

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

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.

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

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

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

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

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

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

[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

[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

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

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

[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] 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: 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] 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().

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

[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

[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: 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: 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: How to call function from struct in slice?

2022-06-08 Thread jake...@gmail.com
> https://go.dev/play/p/38sL3P-BSDr > > > > On Sunday, June 5, 2022 at 12:04:54 AM UTC+8 jake...@gmail.com wrote: > >> 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 >

[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

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 >

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

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

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

  1   2   >