[go-nuts] Re: glog + vendor = "flag redefined: log_dir"?

2018-01-30 Thread jake6502
Ok, maybe I'm a bit off topic. But this also points out why I firmly believe that libraries should not add things to the default flag set in an init function. This is just one of many cases where that can cause problems. @Library developers - please, please consider supplying the user with an

[go-nuts] Re: making common declarations for several packages?

2018-02-03 Thread jake6502
Referencing a type from another package must specify what package it comes from. Try: var a *common.Any Also, I would avoid using the term "alias" here. Type aliasing in go is totally different from defining a new type, which is what you do here. Type aliasing takes the form: type T1 = T2

[go-nuts] Re: printing a struct fields that implements an error interface

2018-02-18 Thread jake6502
There may be another way, but this is one way to print the struct fields: https://play.golang.org/p/sGZMBGG7r79 See line 17. On Sunday, February 18, 2018 at 8:57:02 AM UTC-5, Diego Medina wrote: > > using %#v > > as in > > https://play.golang.org/p/VVqUVsfzx6e > > > > log.Printf("Hello, playg

[go-nuts] Re: Experience report on coming to Go from a C perspective

2018-02-22 Thread jake6502
Have you considered using the new type alias feature introduced in 1.9? Line so: https://play.golang.org/p/6HK8qcuh9UU This would allow you to change the type of the map in a singe place (the type alias) and all the *{}* or *make *would adapt appropriately. Disclaimer: I am not espousing this

[go-nuts] Re: What major API change really is?

2018-03-10 Thread jake6502
This is one of those topics on which everyone has and opinion and no two people will agree 100%. I will say that "Go by your gut" is probably bad general advice. It works well for folks that have a lot of experience, and have done significant reading and research on the topic. But "going with y

[go-nuts] Re: Struct confusion... what am I missing?

2018-03-12 Thread jake6502
I have not run this. But based on your comments, jsonvals is a slice. So you would presumably need to check the length then access a specific item in the slice like this: fmt.Printf("\n%+v\n", jsonvals[0].ID) Hope that helps. On Monday, March 12, 2018 at 12:01:33 PM UTC-4, asyncp...@gmail.com

[go-nuts] Re: Struct confusion... what am I missing?

2018-03-12 Thread jake6502
Ok, so I looked at the https://github.com/tidwall/gjson/blob/master/gjson.go code, and see that the jsonvals slice is a slice of: type Result struct { // Type is the json type Type Type // Raw is the raw json Raw string // Str is the json string Str string // Num is the json number Num f

[go-nuts] Re: confusing a lock demo about https://golang.org/ref/mem#tmp_8

2018-03-13 Thread jake6502
I would like to point out that the example code you refer to is meant to illustrate a specific behavior of locks. It is *not* necessarily intended to be an example of good style. As a "new gopher" I would avoid this idiom. If you did use this, some significant commenting would be needed. Also,

[go-nuts] Re: go build doesn't propagate options that disable optimizations

2018-03-16 Thread jake6502
For completeness, this is documented in the 1.10 release notes. See the second paragraph of this section: https://golang.org/doc/go1.10#build. On Thursday, March 15, 2018 at 3:16:37 PM UTC-4, matthe...@gmail.com wrote: > > This looks like it changed between 1.9.4 and 1.10. > > Here’s the document

[go-nuts] Re: Long running task in select case

2018-03-17 Thread jake6502
On Saturday, March 17, 2018 at 10:37:48 AM UTC-4, matthe...@gmail.com wrote: > > I think the second example alternative given (playground link above) has a >> data race? > > > I’m not surprised that the race detector sees something (a read can happen > during a write of the checked bool) but I

[go-nuts] Re: About a channel detail, bug, defect, or intended?

2018-03-24 Thread jake6502
There may not be any guarantee that the channel will always be full, but in practice your code always produces 100 results for me. Both in the playground , and on my machine (go version go1.10 windows/amd64). With or without the Sleep commented out. Am I

[go-nuts] Re: Scheduler discrepancy between Linux and OS X with Gosched()

2018-04-03 Thread jake6502
For what it is worth, when I run your new code (without channels) on windows it takes consistently 1 second. On Linux it takes variably between 400ms and 1.5 seconds. Both running go 1.10. But, on my systems, this seems to be actually measuring time.Sleep(). Removing the call to spin() and the

Re: [go-nuts] sync.Cond implementation

2018-04-16 Thread jake6502
On Monday, April 16, 2018 at 7:08:27 AM UTC-4, Jesper Louis Andersen wrote: > > On Sat, Apr 14, 2018 at 7:02 PM Penguin Enormous > wrote: > >> But looking at your answer, I see that you may imply certain race >> conditions are allowed. Could you explain a bit more on that? Aren't race >> conditi

Re: [go-nuts] Extension for type assertion of interface array

2018-04-19 Thread jake6502
Yes, to use the functions above you will need to copy the slices of landSpaceto slices of the respective interface types. But I you do not need to do any type assertions. Like this: https://play.golang.org/p/eFTUqpImyPc package main import ( "fmt" ) type landSpace struct{} func (*landSpa

[go-nuts] Re: On Accepting Interfaces and Structs

2018-04-23 Thread jake6502
My gut feeling is that there is an elegant way to achieve what you want. Unfortunately, I am having trouble following the code you are describing, and more importantly, what you are actually trying to accomplish. Perhaps it is my failing. If you would post a more complete example, showing the

[go-nuts] Re: On Accepting Interfaces and Structs

2018-04-26 Thread jake6502
The example gives me a better understanding of what you are doing, though still not much understanding as to *why *you are doing it this way. Usually, if I feel that code has a "smell" in Go, there is a way to rethink the basic design resulting more "natural" code. But without a full understand

[go-nuts] Re: An issue with the select statement.

2018-05-11 Thread jake6502
As others on this thread have pointed out, this use case does not actually require select where the cases are checked in order. However, for completeness, if you need to check two channels, and they must be checked in order, then use two select statements with defaults: for { select { c

[go-nuts] Re: Freeing memory of a cgo library

2018-05-25 Thread jake6502
Looks like you are on windows. I have worked a lot with windows, C/C++ and go, but never actually built a go dll. But, since no one else has picked this up, maybe I can help. 1. I'm not sure what "the cgo" library means here? Do you have this: cpp<->go(dll)<->c(cgo)? Or something else. 2. Ho

[go-nuts] Re: Freeing memory of a cgo library

2018-05-26 Thread jake6502
FYI, the standard way around this is to expose a "free" method from your DLL for memory allocated by the DLL. The other way is to require that users of the DLL supply the memory in advance to functions needing it. These two methods are the ones used by the Windows libraries themselves. Pretty s

[go-nuts] Re: Counting semaphore vs Workerpool

2018-05-26 Thread jake6502
So, it looks to me like 1 million URLS will spin up 1 million goroutines. That seems unnecessary, and likely to be a problem. I usually default to the simplest model, unless there is a reason to do otherwise. IMHO, here that would be to spin up as many goroutines as you want to be working at on

Re: [go-nuts] stdatomic.h, cgo, and sync/atomic

2018-08-02 Thread jake6502
On Wednesday, August 1, 2018 at 10:17:38 AM UTC-4, Ian Lance Taylor wrote: > > [...] > That said, the exact semantics of the sync/atomic operations are not > written down (that is https://golang.org/issue/5045). > I really love go, but this is one thing that has annoyed me for years. This issu

[go-nuts] Re: What is rationale behind slices cannot be compared to each other with == ?

2018-08-02 Thread jake6502
A previous discussion of this was quite long (89 posts) - maybe start there: https://groups.google.com/d/msg/golang-nuts/ajXzEM6lqJI/wbTPh2TmAwAJ On Thursday, August 2, 2018 at 1:21:15 PM UTC-4, Andrey Tcherepanov wrote: > > The following code does not compile. What was *rationale* behind slices

[go-nuts] Re: How should I avoid - literal copies lock value from

2018-08-11 Thread jake6502
I don't see anything fundamentally wrong with using a *sync.Mutex as long as users always use New(). It allows Set to be passed by value, which is nice. But if you keep the mutex as a non pointer, then you probably want to pass a slice of set pointers: func (set *Set) Diff(sets []*Set) *Set Th

[go-nuts] Re: Examples testing with two newline, but only one newline

2018-08-13 Thread jake6502
Looks like a bug to me. I would suggest you open an issue. It is not clear to me what the intended behavior is. It is documented that examples strip some white space when comparing output. So it may be intentional that multiple white space lines are removed from the expected output. In that cas

[go-nuts] Re: `go test -c` skips init from main while `go test` doesn't

2018-08-14 Thread jake6502
I am unable to reproduce using a small test app on either Windows or Ubuntu, using go 1.10.3. In all cases the init() function in main is run when the test binary is run. Perhaps you could provide a minimal reproducible example? On Monday, August 13, 2018 at 8:21:30 PM UTC-4, Gert wrote: > > Hi

[go-nuts] Re: Go modules and semver question

2018-08-15 Thread jake6502
The initial premise was that the API and "Behavior" have not changed. What this means for the literal API is pretty clear - that public function signatures and such are unchanged. "Behavior" is a bit more tricky and subjective. If you define "behavior" is the strictest possible sense, then ther

[go-nuts] Re: Decoding the buffer to a struct sent from C program

2018-08-16 Thread jake6502
Perhaps someone can spot the error just by looking at your code. But a couple of tips that will help others help you. 1. Specify what exactly the "failure" is. What output do you get? 2. Include the log output for a sample run. 3. Print, and include a sample value of "data" (the binary data from

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-23 Thread jake6502
First off, I don't know how you are posting your code samples, but they are unreadable in my Firefox and Chrome on windows. Second, I would point out that the system you use for converting a "string" to the buffer will fail if there are any non-ascii characters. Third, OT, but I wonder why pc

[go-nuts] Re: Ioctl Syscall with go and c

2018-08-24 Thread jake6502
Probably unrelated to your problem, but IIUC, the syscall package is "deprecated", or "frozen". According to the syscall documentation : > *This package is locked down. Code outside the standard Go repository > should be migrated to use the corresponding package

Re: [go-nuts] Re: Ioctl Syscall with go and c

2018-08-26 Thread jake6502
I was aware that your parameters would not fit the Ioctl functions. As Ian pointed out, you would need to use *golang.org/x/sys/unix/Syscall() *and friends. On Sunday, August 26, 2018 at 10:00:11 AM UTC-4, sbez...@cisco.com wrote: > > Hi Jake, > > > > Ioctl implementation in unix package

[go-nuts] Re: What is the proper way to delete a key which holding a pointer in a map

2018-08-27 Thread jake6502
Just to be clear, the memory used by the values *are *freed. In your example, those are the Person structs. It is only the internal memory used by the map that is not freed. See https://play.golang.org/p/fWOIbvjFjyB. In that test, the "internal" memory that is not freed is about 14 bytes per en

[go-nuts] Re: Regarding string immutablity

2018-08-28 Thread jake6502
I think Jan answered the question asked. But, do you have some specific concern that prompted the question? Is it about security, or memory usage, or just curiosity? On Tuesday, August 28, 2018 at 10:55:27 AM UTC-4, Jay Sharma wrote: > > Hi All, > > I went through documentation and many post. Ev

[go-nuts] Re: Does fmt.Print* automatically render an error string in as struct (play link)

2018-08-29 Thread jake6502
> > I can't find anything saying as such From https://golang.org/pkg/fmt/ : "*4. If an operand implements the error interface, the Error method will be invoked to convert the object to a string, which will then be formatted as required by the verb (if any).*" As mentioned in another repl

[go-nuts] Re: Go’s runtime vs virtual machine

2018-09-04 Thread jake6502
There are a lot of differences, and for the answer to be complete, you would need to specify which language you wanted to compare it to. But on a really simple level, thwd's answer is more or less correct. A VM language is usually compiled into an instruction set for that VM. The VM then provid

Re: [go-nuts] A thought on contracts

2018-09-10 Thread jake6502
Personally, I'm not afraid of writing contracts manually. I suspect that in the vast majority of the cases the contract will be clear and pretty trivial. In fact, I think it could be a productive part of the design process to consider what your generic function minimally needs and write the co

[go-nuts] Re: Generics - Why contracts?

2018-09-12 Thread jake6502
Some of the reasons for contracts have been covered by others in this thread already. But somehow one of the biggest has not. Contracts make it possible to change the implementation of a generic function in a published package. Without a contract it would be super easy for a seemingly simple ch

[go-nuts] Re: What can i transport in a channel?

2018-10-02 Thread jake6502
To expand on what Tamás said ... There is really nothing that is not safe to transport in a channel. But there are some considerations. For example if you transport an *http.**Response* then you will be making a copy on the way in and out of the channel. So that *may *not be safe, but it has n

[go-nuts] Re: array indexed by derived type?

2018-10-07 Thread jake6502
I'm gonna say no. On Saturday, October 6, 2018 at 5:07:33 PM UTC-4, Steve Roth wrote: > > Is there a way to declare an array (or slice) that is indexed by a type > derived from int, rather than indexed by int? My intent is to have the > compiler complain if I index the array/slice with a generi

Re: [go-nuts] interface array and ... operator

2018-10-24 Thread jake6502
That is correct. The relevant part of https://golang.org/ref/spec#Passing_arguments_to_..._parameters is where it says: " respective parameter passing rules apply". This links to https://golang.org/ref/spec#Passing_arguments_to_

Re: [go-nuts] interface array and ... operator

2018-10-25 Thread jake6502
Yes. I was completely mistaken in my post. Apologies. On Wednesday, October 24, 2018 at 12:14:36 PM UTC-4, robert engels wrote: > > I quote > > So in the OP's example https://play.golang.org/p/59bpr8TCIge, the > function A() is assigning a []string to the variadic ...[]interface{}. > Since stri

Re: [go-nuts] interface array and ... operator

2018-10-25 Thread jake6502
Oops. Please ignore my entire post. Misunderstood completely. On Wednesday, October 24, 2018 at 11:55:18 AM UTC-4, Jake Montgomery wrote: > > That is correct. The relevant part of > https://golang.org/ref/spec#Passing_arguments_to_..._parameters is where > it says: " respective parameter passin

Re: [go-nuts] interface array and ... operator

2018-10-25 Thread jake6502
In my defense, neither A() nor B() complies in the actual example given. If you comment out A() you will see that B() then fails to compile. If B() is fixed by replacing "i = append(i, s)" with "i = append(i, sa)", then it succeeds. I believe that is due to the clause I referenced in my mistak

Re: [go-nuts] Correct way to solve slice of interface type problem

2018-10-31 Thread jake6502
It is highly likely that when go2 comes out, with generics, it will be trivial to write a ToInterfaceSlice() function that takes a slice of any type T and returns a []interface{}. On Tuesday, October 30, 2018 at 8:35:39 PM UTC-4, Justin Israel wrote: > > > > On Wed, Oct 31, 2018 at 1:32 PM robe

[go-nuts] Re: Why can't I see the whole stack trace of goroutine

2018-11-08 Thread jake6502
I would point out that this *is *the whole stack trace *of the goroutine*. In fact, the actual stack trace is just the first line, since the goroutine in question is only one function deep. If you are breaking into your program after the leaking has started, then the function that created the g

[go-nuts] Re: What are the reasonable reasons to use pointers?

2019-01-01 Thread jake6502
What Cris said is one reason. That is, if you need the function being called to be able to change the value, then use a pointer. If you pass a value instead of a pointer, then changes made by the function being called are not visible to the caller. (The situation is more complicated, but that i

[go-nuts] Re: C++ 11 to Golang convertor

2019-01-03 Thread jake6502
There are so, so many ways to go about porting functionality from one language to another. I hope you have seriously considered why you want to make such a port. The answer to that will likely, in part, drive your strategy. In addition the nature and size of the code base, and your timeline, wi

[go-nuts] Re: C++ 11 to Golang convertor

2019-01-04 Thread jake6502
On Thursday, January 3, 2019 at 5:46:39 PM UTC-5, Eric Raymond wrote: > > On Thursday, January 3, 2019 at 12:11:06 PM UTC-5, Jake Montgomery wrote: >> >> I would note that any tool that ports from C++, or even C, to Go is going >> to produce ugly, unmaintainable, and non-idiomatic code, at best. >

Re: [go-nuts] Re: How to make the first character in a string lowercase?

2019-01-07 Thread jake6502
I believe he is demostrating an optimization for strings that are already in the correct form. On Monday, January 7, 2019 at 1:45:50 PM UTC-5, robert engels wrote: > > Huh? Isn’t your code calling the exact same method ? > > On Jan 7, 2019, at 12:22 PM, peterGo > > wrote: > > Nikolai, > > "What

[go-nuts] Re: What exactly is a method set?

2019-01-20 Thread jake6502
On Sunday, January 20, 2019 at 7:56:39 AM UTC-5, 伊藤和也 wrote: > > Yes I did. Can I say a method set is the one which associates an interface > with methods? > Almost. The method set *of an interface* is the set of methods in the interface. But other types, aside from interfaces, also have method

[go-nuts] Re: [ANN] goey - Declarative, cross-platform GUIs

2019-01-29 Thread jake6502
This looks quite interesting for the types of simple apps I'm building right now. However, I have discovered a couple of bugs. I don't see any way to report them on bitbucket. Are you taking bug reports, and if so, what is the best way to communicate them? Are you taking outside pull requests

Re: [go-nuts] lock for assigning to different elements of an array

2019-02-02 Thread jake6502
Always a good read on why that is still a problem: Benign Data Races: What Could Possibly Go Wrong? It is not specific to go, but mostly applies to any language, and is stuff all developers should k

[go-nuts] Re: Alternative of defer?

2019-02-09 Thread jake6502
Other have provided some options. Another option is to use a sentinel value and check. It is less than ideal for many reasons, but in some cases is still the best option. In your case it might be to use nil: var m sync.Mutex lock := &m lock.Lock() defer func() {if lock != nil {lock.Unlock()}}() i

[go-nuts] Re: url.parse issue if the first character of a url is a number

2019-02-12 Thread jake6502
I can not speak directly to Go's version, but according to the IETF standards, a domain name can not start with a digit. So they are in fact malformed. On Sunday, February 10, 2019 at 9:23:54 PM UTC-5, Nathan Xu wrote: > > What I said is the url content without http/https . > > On Sunday, Febr

[go-nuts] Re: Resolving methods on pointer types

2019-02-24 Thread jake6502
On Sunday, February 24, 2019 at 4:31:10 PM UTC-5, Deomid Ryabkov wrote: > > Why can't Go resolve methods declared on the pointer receiver of the > destination type? > Because that is not how the language was designed. (I'm too busy to look up the spec here, but it is in there.) > > consider:

[go-nuts] Re: Resolving methods on pointer types

2019-02-24 Thread jake6502
Maybe I'm misunderstanding, but the important thing is that foo never be copied. In your example, it is, in fact, *not *copied. See https://play.golang.org/p/U5EsDZSO3ce. Note that Foo is copied, but both f2 and f3 contain the same foo pointer, so the foo was never copied or moved. When embeddi

Re: [go-nuts] finding a way to convert "map[string]map[string]Somthing" into "map[string]interface{}"

2019-03-02 Thread jake6502
There have been multiple long discussions about converting []foo to []interface{} in this group. It is not possible. Most of the discussions apply just as well to your case. If you really need a "generic" function that does this, and can't convert as suggested by Louki, then you could use refl

[go-nuts] Re: Go 1.12 installer on Windows 7 (x64) problem

2019-03-04 Thread jake6502
I have seen posts, unrelated to Go, about installers not recognizing Windows 7 SP1 as being installed. You did a screenshot of the update history, but you should also check that it is listed under Computer->Properties->Windows edition. See here

[go-nuts] Re: why slice[len:len] okay, but slice[len] fail?

2019-03-08 Thread jake6502
The other answers to your original question are reasonable, and probably helpful. But I would also like to point out the definitive, though maybe less helpful answer to both your original question, and this new one. You see that behavior because the language specification says you should. Read

[go-nuts] Re: Go playground to support none-standard modules

2019-03-10 Thread jake6502
You can setup and run your own playground with https://github.com/golang/playground. I have not done it myself, but you could probably use that to do what you propose. On Saturday, March 9, 2019 at 9:50:15 PM UTC-5, Tong Sun wrote: > > I know Go playground does not support none-standard modul

[go-nuts] Re: How to retain environment in SSH

2019-03-11 Thread jake6502
Perhaps someone will magically understand your problem. But in general I would say that you should post more information if you want a good chance of a useful reply. Some tips: Please never post screenshots unless there is an overwhelming reason to do so. This is not one of those cases. Instead

[go-nuts] Re: gdb go optimized out

2019-03-14 Thread jake6502
First off. Please don't use a giant font in this group. It adds no valuable information, and makes it seem like you are yelling at the reader. I use delve not gdb, so I can not speak directly to that. I use -gcflags="-N -l", and so far it has always produced

[go-nuts] Re: gdb go optimized out

2019-03-15 Thread jake6502
First off, we are always happy to have new users in the group. But one more bit of etiquette - Please don't post screenshots of text. Instead copy paste the text into the message. I like to use fixed width font, or put it in a code block. See the recent discussion at https://groups.google.com/d

[go-nuts] Re: panic at fmt.Printlb

2019-03-18 Thread jake6502
Can't say for sure without seeing additional code. But it looks like you have a race condition. It appears that the fmt.Println() is trying to print the map at the same time that you are modifying it. Your locks may prevent ForEachRemov() and FindAndRemove() from accessing the map at the same

Re: [go-nuts] Re: Deferring a close that can fail

2019-03-21 Thread jake6502
Two things to note about this. First, if the "everything else" deferred to might include a return statement, then this could result in the same "silent failure" behavior. Secondly - use this pattern with great caution. It is critical to confirm that a double close on ifDB is explicitly allowed

[go-nuts] Re: Launching a windows app from command line with paths in arguments problem

2019-03-21 Thread jake6502
It is likely that the spaces before the command line arguments is confusing the Chrome parser. Try removing them for every item in Args, and it may work. On a style note, I would use: AppCommand:= `C:\Users\User\AppData\Local\Google\Chrome\Application\chrome.exe` instead of: AppCommand:= "C

[go-nuts] Re: Need Help- Suddenly my unit test stop working

2019-03-25 Thread jake6502
First off, there is something really wrong with your post. Colors make it almost unreadable. Please stick to non-colored (black) text, and for output text please paste text directly, or use the code block feature provided by the google groups website. Have you looked at the file "C:\Users\Gini

[go-nuts] Re: rand.Rand.Seed() vs rand.NewSource()

2019-03-27 Thread jake6502
Following up on Ian's post. It is generally a good idea to go to the playground and make a minimal working "program" to demonstrate your question before posting. In doing so you would have discovered that the zero value of a rand.Rand can not be used, and will panic.

[go-nuts] Re: [ANN] another attempt at desktop ui

2019-03-29 Thread jake6502
No mention of what platforms it supports. You may want to add that to the docs also. On Friday, March 29, 2019 at 5:46:29 AM UTC-4, Johann Freymuth wrote: > > Over the last few months I've tried to write a desktop GUI library that > takes a slightly different approach to traditional GUI librari

[go-nuts] Re: Confusing Behavior When Compiling an Assignment Using a Map

2019-03-29 Thread jake6502
Yes, that is expected. The right hand side of the assignment is `b[1].code`. That is a single value. The "magic" that allows a two value return from a map lookup does not carry through to more complex expressions that use the value from that lookup. It would get confusing really fast if it did.

[go-nuts] Re: Using Closures to Generate Code On the Fly

2019-04-04 Thread jake6502
Looking at https://git.parallelcoin.io/loki/gists/src/commit/d6cabfd0933d0cda731217c371e0295db331ebb1/tailrecursion-generic.md

[go-nuts] Re: gcwaiting=1 will causes block all the goroutines?

2019-04-10 Thread jake6502
As Ian said, your question is not completely clear. I think you are Saying that "I got scheduled!" prints 3 times, then the program appears to "hangs" on the runtime.GC() call. To start with, it is usually helpful to create a *minimal *program when dealing with questions like this. Your program

[go-nuts] Re: gcwaiting=1 will causes block all the goroutines?

2019-04-11 Thread jake6502
On Wednesday, April 10, 2019 at 10:44:38 PM UTC-4, mount...@gmail.com wrote: > > Thank you very much for your meticulous reply. I basically understand the > scheduling mechanism, but I still don’t understand the third paragraph. > > It is "It is also important to note that the behavior of runtime

[go-nuts] Re: Is there a way to force to pass some function or error check when Debugging?

2019-04-24 Thread jake6502
On Tuesday, April 23, 2019 at 1:43:52 AM UTC-4, hui zhang wrote: > > I am debugging a linux server program in local mac machine. > some code related to environment check , such as check mount point etc. > > I want to pass this check , how ? > >- I try it set return error var to nil. but it

[go-nuts] Re: Go : Philosophy

2017-09-19 Thread jake6502
You might find Go Proverbs and the related video by Rob Pike interesting. On Monday, June 28, 2010 at 9:43:48 AM UTC-4, Mayuresh Kathe wrote: > > Like the UNIX philosophy (below); > Write programs that do one thing and do it well. > Write programs to

[go-nuts] Re: interface conversion fails: backends.Client is *mock.client, not *mock.client

2017-10-21 Thread jake6502
Just a thought, but you are playing some complicated games with symlinks. This includes a cycle, where *vendor/src/github.com/bndw/pick/vendor *points back at itself. I suspect that this could be the problem. If I flatten everything out, replacing the links with actual files, and essentially re

[go-nuts] Re: Golang goroutine slow down when adding concurrency

2017-10-27 Thread jake6502
You could run pprof to get a full breakdown. But just looking at your code, it occurs to me that you have goroutines that do pretty much no actual computation. It is basically testing the concurrent performance of *append()*. Without looking at pprof, I can not say for sure where the bottlenec

[go-nuts] Re: %T question

2017-11-08 Thread jake6502
Constants in Go do not automatically have a type. From the language specification Constants section: An untyped constant has a *default type* which is the type to which the constant is implicitly converted in contexts where a typed value is required, for

[go-nuts] Re: How to optimize?

2017-11-16 Thread jake6502
It is not entirely clear what you are trying to accomplish. I suspect effective optimization would require rethinking or refining your algorithm. In the benchmarks you are comparing apples to oranges. BenchmarkByteIndexPointeur searches for a 10 byte pattern in a 56 byte slice. On amd64 at lea

[go-nuts] Re: My trouble of local package referencing

2017-11-18 Thread jake6502
In a large, multi developer, project I worked on we used gb . It was a "large executable" style project, with may local sub packages that were intended to provide code organization, not to be reused by other projects. In addition to vendoring support, using gb

[go-nuts] Does uintptr count as a refence?

2017-11-26 Thread jake6502
The core question is does a *uintptr *derived from a pointer to an object count as a reference as far as GC is concerned? For example (https://play.golang.org/p/tA6Fsl1cAI): package main import "unsafe" import "fmt" type LibArray uintptr func LibFunc(p LibArray) { fmt.Println(*(*uint16)(un

Re: [go-nuts] Does uintptr count as a refence?

2017-11-26 Thread jake6502
Thanks. That is clear: *A uintptr is an integer, not a reference. Converting a Pointer to a uintptr creates an integer value with no pointer semantics. Even if a uintptr holds the address of some object, the garbage collector will not update that uintptr's value if the object moves, nor will t

[go-nuts] Re: Calculation of the combinations between an unlimited number of slices

2017-12-06 Thread jake6502
On Monday, December 4, 2017 at 2:56:19 PM UTC-5, Fred wrote: > > it seems that making a copy of the temp var, replacing : > > temp = append(temp, c1) > > by : > > temp = append(temp, append([]int{}, c1...)) > > helps, but still unclear for me why the problem was only visible on slice > 4... > >

[go-nuts] Re: go test/flag.NewFlagSet bug?

2017-12-13 Thread jake6502
I'm not sure how you expect the *nfs=true* case to work. The "-data=x" flag will be passed to test binary, as described in the documentation. But the test binary is not just your test code, it also contains the testing framework, which must run some variant of *flag.Parse()* in order to parse

[go-nuts] Re: Use golang to call the win API

2017-12-15 Thread jake6502
I have not called a Windows API from go before, so there may be other problems with your code. But looking at WlanEnumInterfaces documentation the last parameter is *not *a pointer to a pointer to a WLAN_INTERFAC

Re: [go-nuts] How to get nice html from godoc?

2017-12-16 Thread jake6502
I suspected it was something like that. I can muddle through, but HTML, and all that is not really my wheelhouse. Can you give me any more details? - Where can I find the correct "bundled css/js" files? - Where do I put them relative to the HTML file? - Do I need to modify the HTML f

Re: [go-nuts] How to get nice html from godoc?

2017-12-17 Thread jake6502
Thanks Justin I will give it a try. (It certainly would be nice if "*godoc -html"* could be useful without having to modify the html.) On Saturday, December 16, 2017 at 6:41:07 PM UTC-5, Justin Israel wrote: > > > > On Sun, Dec 17, 2017 at 5:47 AM > wrote: > >> I suspected it was something lik

[go-nuts] Re: question about golang concurrency

2018-01-08 Thread jake6502
Your use of the sync.Mutex seems sound. At first glance, I see no concurrency problems. I would suggest running the program with the -race flag. If you make memoryCache a package, then perhaps a concurrent test that can be run with -race would also be good. In that case you may also want to co

Re: [go-nuts] Using reflect to call functions on struct members

2018-01-19 Thread jake6502
I think this 40 second snippet of a talk by Rob Pike is apropos. It is not specific to your case, but speaks of reflection in general. On Thursday, January 18, 2018 at 5:20:26 PM UTC-5, Boone Severson wrote: > > Ok, asked a

[go-nuts] Re: "Try Go" in golang.org stopped working properly?

2018-01-27 Thread jake6502
I see the same thing. Changing even one character fixes the problem. Even just adding white space to the code. If I copy the example from https://golang.org/ to the playground exactly ( https://play.golang.org/p/-MKUWeDBml7 ) it also prints nothing. Strange On Saturday, January 27, 2018 at 5:

[go-nuts] Re: Async process state snapshotting in Golang

2018-01-27 Thread jake6502
A couple of comments. This is probably obvious, but I wanted to point out that matthe...'s code would require *all *access to the map to be synchronized using the mutex. It's a simple and effective solution. One downside to his code is that it holds the lock for the duration of the Copy(). Thi

[go-nuts] Re: Parsing Raw Syslog messages

2019-04-25 Thread jake6502
This group works on a longer timeframe. It is not uncommon for it to take a day or two to get a good response. Bumping your post 8 hours later is definitely considered bad etiquette here. On Thursday, April 25, 2019 at 4:57:04 AM UTC-4, Nitish Saboo wrote: > > Hi, > > I want to parse raw syslog

Re: [go-nuts] Is it possible to simplify this snippet?

2019-05-01 Thread jake6502
On Wednesday, May 1, 2019 at 8:41:46 AM UTC-4, Jan Mercl wrote: > > On Wed, May 1, 2019 at 2:37 PM гусь > > wrote: > > > > if rl.IsKeyDown(rl.KeyA) { > > p.Rect.X -= 1 > > } > > if rl.IsKeyDown(rl.KeyD) { > > p.Rect.X += 1 > > } > > if rl.IsKeyDown(rl.KeyW) { > > p.Rect.Y -= 1 > > } >

Re: [go-nuts] What happens to global vars when main() ends ?

2019-05-04 Thread jake6502
On Friday, May 3, 2019 at 9:44:05 PM UTC-4, lgo...@gmail.com wrote: > > I'm currently working on a specialized encryption system where the keys > are global... > More importantly, I've been unable to locate any decent on-line docs > describing exactly how Go GC works from a functional programming

[go-nuts] Re: guarantees on net.Conn and net.UDPConn Read

2019-05-13 Thread jake6502
On Thursday, May 9, 2019 at 2:54:17 AM UTC-4, kortschak wrote: > > The Conn and UDPConn Read methods look like io.Reader Read methods, but > there is no explicit claim that Conn is an io.Reader. Are the Read > methods of these two types identical in behaviour to io.Reader? > I can not say defi

[go-nuts] Re: net.InterfaceAddrs() error and returned addr slice

2019-05-16 Thread jake6502
On Wednesday, May 15, 2019 at 5:00:26 PM UTC-4, Vasiliy Tolstov wrote: > > Hi! I have error from net.InterfaceAddrs() like route ip+net: no such > network interface > i think that error happened because i have docker running that > creates/deletes interfaces in my system. > My question is - d

[go-nuts] Re: pprof - Trouble getting any data from pprof.StartCPUProfile()

2019-05-21 Thread jake6502
On Tuesday, May 21, 2019 at 12:54:32 PM UTC-4, Russtopia wrote: > > Hi all, > > I've tried running some of my Go code using CPU Profiling enabled as > described at > > https://blog.golang.org/profiling-go-programs > > and > > https://golang.org/pkg/runtime/pprof/#StartCPUProfile > > .. I'm

[go-nuts] Re: A good indicator of code quality

2019-06-07 Thread jake6502
On Thursday, June 6, 2019 at 3:58:19 PM UTC-4, Carl wrote: > > I'd like to know what people are using to measure the quality of their Go > code bases and why. Specifically, I'm asking if: > >1. There is a way to score a code base on quality that works with >idiomatic Go >2. Use this m

[go-nuts] Re: global var available in different files (same package)

2019-06-07 Thread jake6502
On Thursday, June 6, 2019 at 3:07:22 PM UTC-4, Natxo Asenjo wrote: > > hi, > > I'd like to define a couple of global variables in a small cli app. The > app has a few files but it's not large. > > What I'd like is to use cli flags to define options, and those options > should be available for a

[go-nuts] Re: global var available in different files (same package)

2019-06-07 Thread jake6502
On Friday, June 7, 2019 at 2:12:22 PM UTC-4, Natxo Asenjo wrote: > > > > On Friday, June 7, 2019 at 6:07:09 PM UTC+2, jake...@gmail.com wrote: >> >> >> >> It is unclear what the problem is. Global variables will be accessible >> from any file that is part of package "main". As you said, you cou

Re: [go-nuts] Pointer Method Receiver

2019-06-17 Thread jake6502
On Sunday, June 16, 2019 at 5:29:49 PM UTC-4, andrey mirtchovski wrote: > > Hi Ali, > > I understand your desire to provide useful information about Go in > blog posts. This is commendable. However let's try to keep this list > for technical issues and keep empty posts containing just a link t

  1   2   >