Re: [go-nuts] Re: Named or unnamed struct initialisation? What is best practice?

2017-07-11 Thread Rader
I found the position of `[0]byte` in the struct matters. type bar2 struct { A int _ [0]byte } differs from type bar3 struct { _ [0]byte A int } see the full example <https://play.golang.org/p/wJkDPQ0PQ3> On Wednesday, July 12, 2017 at 10:44:04 AM UTC+8, Rader wrote: > > th

[go-nuts] Re: why I got a panic in this code?

2017-07-12 Thread Rader
"pos" is not initialized. You think you are using the *global* var "pos", but you are wrong as it's been *overwritten* by the *named return var *"pos" (defined like this (pos []float32)). On Tuesday, July 11, 2017 at 5:24:19 PM UTC+8, Fino wrote: > > https://play.golang.org/p/2Wd9xlztBr > > > p

[go-nuts] Re: genmap: Generate thread-safe, type-safe maps easily

2017-07-12 Thread Rader
I would prefer `sync.RWMutex` which allows multiple `Get` to the map. On Friday, June 16, 2017 at 1:26:04 PM UTC+8, am...@ammar.io wrote: > > https://github.com/ammario/mapgen > > > Features: > >- Supports any key/value pair supported by Go's native maps >- Allows complex operations via Lo

Re: [go-nuts] Re: Named or unnamed struct initialisation? What is best practice?

2017-07-12 Thread Rader
Tue, Jul 11, 2017, 11:34 PM Rader > > wrote: > >> I found the position of `[0]byte` in the struct matters. >> type bar2 struct { >> A int >> _ [0]byte >> } >> >> differs from >> >> type bar3 struct { >> _ [0]byte >> A

Re: [go-nuts] regexp: is there a way to match single byte ?

2018-12-30 Thread Kurtis Rader
e to a single-byte locale (e.g., "C" or "POSIX"). -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop rece

Re: [go-nuts] Statically compile and link a go program with C dependencies

2019-01-21 Thread Kurtis Rader
rs, > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit htt

Re: [go-nuts] Re: When initializing variables, copies of values are made?

2019-01-31 Thread Kurtis Rader
iate "zero" value for its type. This is behavior is meant to address one of the major flaws of C/C++ where function (i.e., stack) local vars which are not explicitly initialized have a random initial value based on the content of the stack at that juncture. -- Kurtis Rader Caretaker of t

Re: [go-nuts] Re: Go vs C speed - What am I doing wrong?

2019-02-03 Thread Kurtis Rader
ost always orders of magnitude more important than whether you have managed to shave every microsecond from its run time. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To u

Re: [go-nuts] Is it practical to auto rearrange struct fields to reduce paddings in Go?

2019-02-06 Thread Kurtis Rader
Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com

Re: [go-nuts] How to kill all open TCP connections?

2019-02-17 Thread Kurtis Rader
nvestigate what state the process is in which should explain why it can't be killed and the jail container successfully shutdown. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts&q

Re: [go-nuts] Re: How to kill all open TCP connections?

2019-02-19 Thread Kurtis Rader
t; key code. > Pretty sure by "key code" Wang meant a minimal test case that illustrates or causes the problem. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts&qu

Re: [go-nuts] How to kill all open TCP connections?

2019-02-19 Thread Kurtis Rader
y tcp" and the first result was https://forums.freebsd.org/threads/cannot-cleanly-stop-jails-after-using-graphical-applications.56778/ which describes the scenario you're observing and does not involve a program written in Go. I think you need to talk to the FreeBSD support community. --

Re: [go-nuts] How to kill all open TCP connections?

2019-02-19 Thread Kurtis Rader
app (or call whatever API that command invokes) to short-circuit the TIME_WAIT and related states but that solution is worse than the problem, IMHO. You'll either need to figure out how to shutdown a jail environment with extant TCP connections or arrange to run `tcpdrop` after your app has exi

Re: [go-nuts] Channel Feature Suggestion

2019-02-21 Thread Kurtis Rader
func worker() { > // do work > > Select { > ch <- true: > go worker() // try to handover some jobs > default: > // max goroutine limit > // do them yourself > } > > // do remaining jobs > > // make way > <- ch > ret

Re: [go-nuts] Inconsistent reporting of unused package variable initialized in init() but used elsewhere

2019-02-23 Thread Kurtis Rader
group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this

Re: [go-nuts] is it possible to run cgo -buildmode=c-shared dynamic library on main thread?

2019-02-25 Thread Kurtis Rader
run on the main thread when called from a non-main thread. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails fro

Re: [go-nuts] is it possible to run cgo -buildmode=c-shared dynamic library on main thread?

2019-02-25 Thread Kurtis Rader
n the main thread. I've worked a lot with C++ code that utilizes threads and which is loaded by a python program. But that doesn't involve anything like the Go M:N go routine to thread scheduler. There are probably subtleties in mixing the two languages that I'm not familiar with. -- Ku

Re: [go-nuts] Re: I found a very strange code that would cause deadlocks and blocking,why???

2019-02-28 Thread Kurtis Rader
world" garbage collection the answer is "no" in as much as this behavior has nothing directly to do with garbage collection. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golan

Re: [go-nuts] How can race timing inject io.EOF into bufio.NewReader(os.Stdin) ?

2019-03-08 Thread Kurtis Rader
from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group

Re: [go-nuts] Println output missing in Windows, but not Linux

2019-03-12 Thread Kurtis Rader
ved this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/opto

Re: [go-nuts] protobuf and golang

2019-03-18 Thread Kurtis Rader
regardless of whether your CPU is little or big endian. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it

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

2019-03-20 Thread Kurtis Rader
e. But thinking you can do anything about the other failure modes, especially EINTR, is mistaken. See https://lwn.net/Articles/576478/ http://austingroupbugs.net/view.php?id=529 https://sourceware.org/bugzilla/show_bug.cgi?id=14627 -- Kurtis Rader Caretaker of the exceptional canines Ju

Re: [go-nuts] Very long API call

2019-03-27 Thread Kurtis Rader
narky but your question is completely devoid of any useful information. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

Re: [go-nuts] Very long API call

2019-03-27 Thread Kurtis Rader
t particularly unusual for a HTTP POST request. Consider a service for uploading arbitrary files using HTTP rather than FTP (or scp, etc.). -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang

Re: [go-nuts] floating point question

2019-04-15 Thread Kurtis Rader
)[1]); fprintf(stdout, "%.12g %08x%08x\n", f, ((int *)&f)[0], ((int *)&f)[1]); fprintf(stdout, "%.12g %08x%08x\n", h, ((int *)&h)[0], ((int *)&h)[1]); } -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because

Re: [go-nuts] Re: fatal error: 'config.h' file not found

2019-04-16 Thread Kurtis Rader
esumptive of you to expect random strangers to respond immediately to your request for an answer. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe fr

Re: [go-nuts] is -2147483648 the same as MinInt32

2019-04-21 Thread Kurtis Rader
problem statement why didn't you just compare the value you're getting from your calculation for equality to MinInt32 to confirm they are equal? -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google

Re: [go-nuts] is -2147483648 the same as MinInt32

2019-04-21 Thread Kurtis Rader
On Sun, Apr 21, 2019 at 9:02 PM Pat Farrell wrote: > On Sunday, April 21, 2019 at 11:50:38 PM UTC-4, Kurtis Rader wrote: >> >> On Sun, Apr 21, 2019 at 8:37 PM Pat Farrell wrote: >> >>> I have a logic error in my calculation. I am getting -2147483648 in an >&g

Re: [go-nuts] Go if else syntax .. suggested replacement

2019-04-24 Thread Kurtis Rader
/deflate.c#L597-L609 For those who don't want to follow those links this is the code from the first URL above: lc_unicodeliterals = quote=='u' ? 1 : quote=='U' ? 0 : !!(ast.locale.set & AST_LC_unicodeliterals); -- Kurtis Rader Caretaker of the exceptional canine

Re: [go-nuts] Some questions about go plugin

2019-04-25 Thread Kurtis Rader
e with via a RPC (remote procedure call) mechanism. Then when you need to restart the plugin you simply kill and restart it. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts&quo

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

2019-05-03 Thread Kurtis Rader
system will invalidate the page of memory containing that var and ensure the page is zeroed before giving it to another process. But that has nothing to do with the Go GC. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to

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

2019-05-04 Thread Kurtis Rader
iscover if bugs in the program can be exploited by an adversary to exfiltrate the contents of its memory. A garbage collector is not designed to protect against such risks. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribe

Re: [go-nuts] Need help to make autocert working

2019-05-07 Thread Kurtis Rader
took me just a few minutes to setup with a cert it automatically acquired from LetsEncrypt. It's written in Go. And it already has a rich set of plugins such as ipfilter <https://github.com/pyed/ipfilter> that I contributed an enhancement to. See https://caddyserver.com/ -- Kurtis Rade

Re: [go-nuts] Need help to make autocert working

2019-05-07 Thread Kurtis Rader
It's very small and trivial to install and setup. It is also extremely efficient at serving static content (I use it with Hugo to serve static blog content). Again, don't reinvent the wheel. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this

Re: [go-nuts] Re: A question about A sync.Once implementation.

2019-05-07 Thread Kurtis Rader
ry light grey color. Which makes it hard to read on a white background. Please don't use styled text that modifies the colors on a general purpose mailing list. Not everyone is using color preferences compatible with your preferences. -- Kurtis Rader Caretaker of the exceptional canines Ju

Re: [go-nuts] How to run a go method on multiple cores ?

2019-05-08 Thread Kurtis Rader
our `*initialize_engine()` method always instantiates, and returns, a new instance of the "syslog-ng" engine then the two Go objects initialized by that call will be two independent instances of that engine. Assuming, of course, that your syslog-ng engine does not share state between dist

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

2019-05-12 Thread Kurtis Rader
ivalent to recv() with flags set to zero. You can't use it to read multiple packets with a single call. Nor can you use it to read a packet incrementally. At least on UNIX like platforms the excess bytes will be discarded. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank

Re: [go-nuts] The strange behavior of defer

2019-05-20 Thread Kurtis Rader
e a "defer" statement executes, the function value and parameters to the call are evaluated as usual and saved anew but the actual function is not invoked. To keep that from happening you need to use a lambda (or function literal): https://play.golang.org/p/9Avbf_Mwx4g -- Kurtis Rader Care

Re: [go-nuts] Re: How can stop a Read of net.Conn without closing it

2019-06-05 Thread Kurtis Rader
en the available UNIX like kernel APIs. So while I have not tested this using a program written in Go I would not expect it to work and the equivalent solution definitely does not work in other languages I use regularly. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- Y

Re: [go-nuts] Re: Proposal: disallow "fall through" to a labeled statement #32565

2019-06-12 Thread Kurtis Rader
om that caused by C's default of case blocks falling thru to the next case block if you don't explicitly break from the block. A feature that does cause lots of bugs. Fortunately the designers of Go broke from C tradition in this regard. -- Kurtis Rader Caretaker of the exceptional canin

Re: [go-nuts] Problems with Text Template

2019-06-14 Thread Kurtis Rader
endly form. On Fri, Jun 14, 2019 at 6:28 PM Yamil Bracho wrote: > Yes, I am using text/template... > > El viernes, 14 de junio de 2019, 19:07:24 (UTC-4), Burak Serdar escribió: >> >> >> Are you using html/template by any chance? >> >> If so, try text/templ

Re: [go-nuts] Re: is there a goroutine scope global veriable ?

2019-06-18 Thread Kurtis Rader
tions/31932945/does-go-have-something-like-threadlocal-from-java and https://github.com/golang/go/issues/21355 -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubsc

Re: [go-nuts] [cgo ] Export go function to C - illegal character

2019-06-23 Thread Kurtis Rader
Is it an API version number? In any event your question is really about a specific build toolchain on a specific platform. And you didn't even bother to tell us what platform you are using. I'm guessing MS Windows but we shouldn't have to make such guesses. -- Kurtis Rader Careta

Re: [go-nuts] sudo ./main command throwing error

2019-06-24 Thread Kurtis Rader
IBRARY_PATH' > > nsaboo@ubuntu:~/Documents/goworkspace/src/poc$ echo $LD_LIBRARY_PATH > /usr/local/lib/syslog-ng > nsaboo@ubuntu:~/Documents/goworkspace/src/poc$ > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subsc

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Kurtis Rader
that compiles and runs at https://play.golang.org. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from i

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Kurtis Rader
groups.com. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/ce0671c5-f2df-42d9-a7af-bdef939e6d6d%40googlegroups.com. >> >> > For more options, visit https://groups.google.com/d/optout. >> > -- > You received th

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Kurtis Rader
initialize a RNG more than once unless you are doing so to create a reproducible sequence of values. In which case you should be initializing it with a constant value rather than a pseudo-random value like `time.Now().Unix()`. -- Kurtis Rader Caretaker of the exceptional canines Junior and

Re: [go-nuts] rand seed using 'time.Now().Unix()' consequence mass common rand numbers, but using unixNano as the seed will not ,how to choose the rand's seed between 'time.Now().Unix()' and 'time.Now

2019-06-26 Thread Kurtis Rader
s create a single RNG and use it every place you need a random number. You should probably be using `rand.Seed()` and `rand.Source()` rather than `rand.NewSource()` given your fundamental misunderstanding about how RNGs work. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank

Re: [go-nuts] recover from a unexpected fault address

2019-07-01 Thread Kurtis Rader
sion on the web visit > https://groups.google.com/d/msgid/golang-nuts/7959bb0d-de87-49ae-828c-d3e02e062d7d%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/7959bb0d-de87-49ae-828c-d3e02e062d7d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > Fo

Re: [go-nuts] How to store the address of C struct on Go side in an array (cgo)

2019-07-12 Thread Kurtis Rader
for this type of issue and I always use it if possible for debugging memory management bugs in C/C++ code. Unfortunately I don't know how to enable its use with cgo or even if it is possible. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message becau

Re: [go-nuts] Tools or debug options for debugging 'Error in `bin/main': double free or corruption (fasttop)' in cgo

2019-07-14 Thread Kurtis Rader
iew this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/70001fbc-9302-4e76-a270-d18b95664423%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/70001fbc-9302-4e76-a270-d18b95664423%40googlegroups.com?utm_medium=email&utm_source=footer> > . >

Re: [go-nuts] Split a empty string will get a one element array?

2019-08-07 Thread Kurtis Rader
eceiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/19bfe1af-bf5f-4c54-9198-3d23f9bec14a%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts

Re: [go-nuts] fork/exec /bin/bash: operation not permitted

2019-08-07 Thread Kurtis Rader
google.com/d/msgid/golang-nuts/CAN4yCu-wxW6tfEcryOmkJUU6J3oVX6R3pHeOhpJFKsuReU%2BPhg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribe

Re: [go-nuts] app not compiling

2019-08-09 Thread Kurtis Rader
48cbec%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/cfe0731e-660a-4292-be55-f831f648cbec%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message beca

Re: [go-nuts] how to merge different struct to one struct

2019-08-23 Thread Kurtis Rader
reflection (assuming that approach was even viable). What exactly would be the point? If you need a data structure that can be composed at run time there are many options. Why does it need to be a Go struct? -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received t

Re: [go-nuts] Parsing go.mod

2019-09-02 Thread Kurtis Rader
type of situation you should explain why you need to parse a go.mod file. Especially since you seem to be asking something not already asked a thousand times. It is possible, perhaps likely, the reason you want to do this can be solved some other way. -- Kurtis Rader Caretaker of the exceptional c

Re: [go-nuts] What is the memory order when select on multiple channels that one is closing and the other is receiving?

2019-09-08 Thread Kurtis Rader
my argument is rigorous > No, it isn't. You need to learn a lot more about concurrency and race conditions. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. T

Re: [go-nuts] html/template escaping problem

2019-09-09 Thread Kurtis Rader
t; "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/0c93e49c-1e8b-4617-baef-0848b57fde93

Re: [go-nuts] using Go as a configuration file format

2019-09-23 Thread Kurtis Rader
arser and evaluator for the format in a different language. Which should always be possible for a config file format. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsu

Re: [go-nuts] Channels question

2019-09-29 Thread Kurtis Rader
ueues: https://golang.org/ref/spec#Channel_types. They *do not* have fan-out semantics. Only one goroutine reading the channel will receive the next value. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the G

Re: [go-nuts] Re: An old problem: lack of priority select cases

2019-10-04 Thread Kurtis Rader
d this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups

Re: [go-nuts] why not heap.Pop return nil while h.Len is 0?

2019-10-10 Thread Kurtis Rader
o view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVjycg_%2BfGJvUzXrq4FARsOz45RTPSi2Fu3HFjDvfc5bg%40mail.gmail.com > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed

Re: [go-nuts] How to invoke child 'go' process in playground?

2019-10-11 Thread Kurtis Rader
le.com/d/msgid/golang-nuts/30f33420-47d9-4fe7-8e39-980f8d5370db%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/30f33420-47d9-4fe7-8e39-980f8d5370db%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Juni

Re: [go-nuts] Auto-renew letsencrypt cert with standard library code

2019-11-05 Thread Kurtis Rader
oogle Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/dc40264f-5314-496

Re: [go-nuts] Are M always detached from P when syscall?

2019-11-15 Thread Kurtis Rader
than you seem to think. And don't forget about CPU context switches. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Is anyone aware of a blocking ring buffer implementation?

2019-11-21 Thread Kurtis Rader
tional ring buffer. Specifically with respect to when "writes" block. Am I misunderstanding something? Substituting an io.Pipe may be fine for the O.P.s specific situation but in general would not be AFAICT. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received

Re: [go-nuts] atomic.Add*() doesn't produce unique values

2019-11-29 Thread Kurtis Rader
utine and consumed by any context needing a uniq ID. That makes it easier to abstract the generation of "unique" ints so that they satisfy other constraints (e.g., they must be even, odd, prime, etc.). -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received

Re: [go-nuts] why received can be defined with/without pointer?

2017-05-07 Thread Rader Lei
if a method only defined for a pointer receiver, the compiler will add "*" before the caller silently. Why pointer receiver? Try to change the value of a member. You will know the difference. On Sunday, May 7, 2017 at 6:37:59 PM UTC+8, mhh...@gmail.com wrote: > > yes, sorry you scratched your h

Re: [go-nuts] Re: Named or unnamed struct initialisation? What is best practice?

2017-07-11 Thread Rader Lei
they both have the same size, eg. following structs bar and bar2 both take 16 bytes memory on a x64 machine. package main import ( "fmt" "unsafe" ) type bar struct { A int _ bool } type bar2 struct { A int _ [0]byte } func main() { bar := bar{} bar2 := bar2{}

Re: [go-nuts] What is the meaning of the "go" line in go.mod

2019-12-11 Thread Kurtis Rader
d). > I don't know if there is a more canonical answer in the official documentation but this seems to explain it reasonably well: https://www.reddit.com/r/golang/comments/b0b8k3/what_version_should_the_gomod_go_directive_be_set/ -- Kurtis Rader Caretaker of the exceptional canines

Re: [go-nuts] strange failure of golang.org/x/crypto/argon2.IDKey

2020-01-03 Thread Kurtis Rader
an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/e39ef554-b764-4a90-b5a1-f5b1054dfed3%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/e39ef554-b764-4a90-b5a1-f5b1054

Re: [go-nuts] channel synchronous, how to assure happens before ??

2020-01-06 Thread Kurtis Rader
the channel that would change the behavior of the program. Channel ops are what are known as memory barriers, and thus don't allow ops before or after the channel op to be reordered before or after the op. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You receive

Re: [go-nuts] How to append all new messages in a slice?

2020-01-14 Thread Kurtis Rader
he web visit > https://groups.google.com/d/msgid/golang-nuts/9211b53e-d3b2-4fdb-81a3-84bb757a585f%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/9211b53e-d3b2-4fdb-81a3-84bb757a585f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rade

Re: [go-nuts] keep just 2 decimal places in a float64

2020-01-25 Thread Kurtis Rader
m this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/96528d64-a670-45ba-ad4c-0701dcd0d78d%40googlegroups.com > <https://groups.google.com

Re: [go-nuts] Re: keep just 2 decimal places in a float64

2020-01-25 Thread Kurtis Rader
you cited is another one to remember to cite when a FAQ about floating point values occurs :-) -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe fr

Re: [go-nuts] types of slice indices and range operators

2020-02-02 Thread Kurtis Rader
use the incorrect assumption masked bugs in the code. The bugs were most often in unit tests but I found at least two bugs in the code being tested when I violated those "conventions". -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message bec

Re: [go-nuts] implicit initialization in golang declarations?

2020-02-10 Thread Kurtis Rader
of this topic. I'll leave it to others to opine whether the implicit initialization is good style or whether the explicit initialization in your second example is preferable. Having said that, I don't see any reason to prefer the explicit initialization since it is 100% equivalent to the implicit

Re: [go-nuts] How to handle EINTR from syscall.Dup2

2020-02-28 Thread Kurtis Rader
with the network or remote file server in which case retrying is unlikely to succeed. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group a

Re: [go-nuts] How to handle EINTR from syscall.Dup2

2020-02-29 Thread Kurtis Rader
your question is really what to do if close() fails with EINTR and > the answer is retry. > > The man page [1] explicitly says that Linux close(2) should *never* be > retried, not even on EINTR. > As I mentioned, there are plans to change close to return EINPROGRESS, > or even

Re: [go-nuts] How to handle EINTR from syscall.Dup2

2020-02-29 Thread Kurtis Rader
point of returning EINTR is that the close did not happen. If the close was successful then there was no point in returning an EINTR failure. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Grou

Re: [go-nuts] Connection Refused while scraping the data

2020-03-06 Thread Kurtis Rader
jobs/Engineering: dial tcp 169.44.165.69:443: > connect: connection refuse > > The web site you are accessing thinks you are executing a DDOS attack or are otherwise violating their terms of service. This has nothing to do with the Go language. You need to rate limit your requests of that

Re: [go-nuts] Issue with handler

2020-03-20 Thread Kurtis Rader
-) In other words, please post plain text or a link to play.golang.org. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop re

Re: [go-nuts] Does os.exec work ?

2020-03-25 Thread Kurtis Rader
> To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/f9b34d9d-985f-4cbf-9a92-d3d46d72cf55%40googlegroups.com > <

Re: [go-nuts] Can someone please explain http.HandlerFunc() ?

2020-04-03 Thread Kurtis Rader
pter that converts one function type into another. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it,

Re: [go-nuts] Re: Issue with go and mongodb

2020-04-08 Thread Kurtis Rader
oglegroups.com > <https://groups.google.com/d/msgid/golang-nuts/079430fd-01cb-4273-9dab-0532ae9b210c%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because yo

Re: [go-nuts] Getting this error: compile: version "go1.13.7" does not match go tool version "go1.12.10"

2020-04-09 Thread Kurtis Rader
13.7" does not match go tool version "go1.12.10" > > >From https://github.com/golang/go/issues/22814: "The error is telling you that you have a weird mix of Go versions on top of one another, or mixed up together in your $PATH." What does "go env" report? Es

Re: [go-nuts] go commands hang indefinitely

2020-04-09 Thread Kurtis Rader
quot; > GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments > -fmessage-length=0 > -fdebug-prefix-map=/var/folders/6c/h189_j9s6tdbj_kw24g2kvchsk0515/T/go-build628238008=/tmp/go-build > -gno-record-gcc-switches -fno-common" > > -- > You received this

Re: [go-nuts] Intercepting field access and method call

2020-04-11 Thread Kurtis Rader
g for a language like Python, which I love, but that isn't the Go model of behavior. This also seems like a http://xyproblem.info/ question. What is it you really want to do? Are you trying to mock something for a unit test? -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank

Re: [go-nuts] Equivalent of os.Args but on custom input

2020-04-20 Thread Kurtis Rader
https://groups.google.com/d/msgid/golang-nuts/CAKu9hcexcyMdjPaWUNd84q0Yhs_PoHCe-jczvhC04vqiU7LPwQ%40mail.gmail.com > <https://groups.google.com/d/msgid/golang-nuts/CAKu9hcexcyMdjPaWUNd84q0Yhs_PoHCe-jczvhC04vqiU7LPwQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . >

Re: [go-nuts] Is this AMQP 0.9.1 library updated?

2020-04-28 Thread Kurtis Rader
on. > Please suggest, thanks. > My recommendation is to open a GitHub issue at the link you provided. It looks like the project is active. Recently opened issues have been closed. -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you a

Re: [go-nuts] URL parsing with special characters.

2020-04-30 Thread Kurtis Rader
alid URL > escape "%ve"` > That is not a valid URL. The Python urllib.parse module explicitly ignores invalid percent encodings and treats the % in that case as a literal percent-sign. That URL should be written as `.../file%25ver3.txt`; assuming you want a literal percent-s

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Kurtis Rader
d operating system APIs meant for debugging; such as the `ptrace()` syscall. Note that the stackoverflow question you linked to is bollocks. The questioner apparently wants to read the virtual memory of other processes. Yet they accepted as correct an answer that does no such thing. The "answer

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Kurtis Rader
ntial promise to prevent of every OS >> other than MS DOS, original MacOS, and practically the threads in shared >> memory model of Smalltalk & MP Mathematica. >> >> On Thu, Apr 30, 2020 at 7:13 PM Kurtis Rader >> wrote: >> >>> On Thu, Apr 30, 2020 at 6

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Kurtis Rader
d "Cheat Engine" without providing a link to a document that explains what you mean by that term. I'm guessing (emphasis on "guessing") that you are referring to https://en.wikipedia.org/wiki/Cheat_Engine -- Kurtis Rader Caretaker of the exceptional canines Junior and Ha

Re: [go-nuts] Re: About text-based user interface for Windows and Linux

2020-05-04 Thread Kurtis Rader
ce all you want to do is download the source to review it just do "git clone https:// github.com/robaho/go-trader". And if that doesn't work you need to figure out what is wrong with your connection to the Internet. -- Kurtis Rader Caretaker of the exceptional canines Junior an

Re: [go-nuts] Re: About text-based user interface for Windows and Linux

2020-05-04 Thread Kurtis Rader
quot;go build" or something similar. My suggestion to run "git clone" was predicated on you wanting to just review the source code; not build it. If you want to be able to build it, and import it into other projects, then you need to figure out why "go get" doesn't work on you

Re: [go-nuts] handling constant of maps

2020-05-04 Thread Kurtis Rader
> > > > Since Golang doesn't support the Constant of struct, what could be your > approach? > > Any suggestion is really appreciated. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To uns

Re: [go-nuts] Failed to schedule cron job at night

2020-05-08 Thread Kurtis Rader
ght > time. > > for day time it works properly . > > my cron expression is 0 15 3 * * * means at midnight 03:15 AM daily > I don't see what this has to do with Go but the problem is your crontab spec says to run the job at 15:00 hours on the third day of each month. Remo

Re: [go-nuts] Set environment variables from command line argument

2020-05-09 Thread Kurtis Rader
nv_var1=val1 go run main.go if your shell doesn't support the POSIX shell syntax for temporary modification of the environment a command inherits? -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google

Re: [go-nuts] High Performance REST API Framework.

2020-05-09 Thread Kurtis Rader
using it rather than Apache or Nginx. It's not clear what you are looking for since "web framework" is a nebulous term. See https://caddyserver.com/docs/v2-upgrade for how the new Caddy v2 implementation makes Websocket's easier to use. -- Kurtis Rader Caretaker of the exceptio

  1   2   3   4   5   >