Re: [go-nuts] protobuf and golang

2019-03-19 Thread Ian Denhardt
This might be more directly what you're after: https://kaitai.io/ Though disclaimer, I haven't used it myself. Quoting Wojciech S. Czarnecki (2019-03-19 20:25:08) > On Mon, 18 Mar 2019 09:59:59 -0700 (PDT) > R Srinivasan wrote: > > > my intial attempts to define the data structures have hit

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

2019-03-19 Thread Shulhan
On Tue, 19 Mar 2019 16:57:51 -0700 (PDT) David Collier-Brown wrote: > It's a known bad thing to defer a close for anything buffered, as > discussed at > https://www.joeshaw.org/dont-defer-close-on-writable-files/ but some > constructs lack a Sync() call. > > For example, I have code like >

Re: [go-nuts] Go command support for "make"

2019-03-19 Thread Sam Whited
On Wed, Mar 20, 2019, at 05:05, Lucio wrote: > What I just realised is that my Makefile/mkfile-foo isn't sufficient > to *do something* with such information, but at this point I'm willing > to cross that bridge when I come to it. For now, having a "go status > infernal/package", say, even if it pr

[go-nuts] Go command support for "make"

2019-03-19 Thread Lucio
I'm hoping this already has an answer, rather than require additional features. I also don't expect this to be a popular request, but I do consider its merits as greater than the disadvantages, so here goes. Efforts to eliminate the use of the Unix "make" command by producing a vastly more mode

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

2019-03-19 Thread Marko Ristin-Kaufmann
Hi Dave, Separate logic makes sure I have passed the point at which the data is > committed before I commit my reading of input, so eventually the data will > be reread and rewritten. > I don't understand fully what you mean here. Maybe you could write a snippet of pseudo-code to illustrate the s

Re: [go-nuts] I am starting Golang and I am looking for a example to Login, Logout, Signup..

2019-03-19 Thread Marcin Romaszewicz
I build these kinds of things for a living, and sadly, there isn't very much in pure Go that I'm aware of to do this. I have a bunch of Go code which I use to do this, but sadly, I can't share it yet, as I'm working on getting approval to open source it. The quickest way might be to put a SAML or

Re: [go-nuts] protobuf and golang

2019-03-19 Thread Wojciech S. Czarnecki
On Mon, 18 Mar 2019 09:59:59 -0700 (PDT) R Srinivasan wrote: > my intial attempts to define the data structures have hit a roadblock - > support for data types such as uint16, int16, uint8, int8. Is this an > inherent protobuf limitation or am i overlooking something. Yep. Protobuf is an excha

[go-nuts] Deferring a close that can fail

2019-03-19 Thread David Collier-Brown
It's a known bad thing to defer a close for anything buffered, as discussed at https://www.joeshaw.org/dont-defer-close-on-writable-files/ but some constructs lack a Sync() call. For example, I have code like ifDB, message, err := OpenInflux(server, debug) if err != nil {

[go-nuts] I am starting Golang and I am looking for a example to Login, Logout, Signup..

2019-03-19 Thread henriknafo
Let me first tell you I am new to Golang. I am looking for the code of an example web application with a simple Login, Logout, Signup page (With or without social network login). I tried google and nothing conclusive came out. Obviously I need something to protect against CSRF, hashed password,

[go-nuts] Re: How do you retrieve certs from the Windows Local Machine cert store with Go?

2019-03-19 Thread Sam
Thanks, Krzysztof. I think the wrapper must be the problem. I tried calling syscall.GetLastError() but that came back as empty, too. On Tuesday, March 19, 2019 at 3:22:35 PM UTC-7, Krzysztof Kowalczyk wrote: > > To get the real error, you probably need to call GetLastError() ( > https://docs.micr

[go-nuts] Re: How do you retrieve certs from the Windows Local Machine cert store with Go?

2019-03-19 Thread Krzysztof Kowalczyk
To get the real error, you probably need to call GetLastError() ( https://docs.microsoft.com/en-us/windows/desktop/api/wincrypt/nf-wincrypt-certopenstore#return-value ). In principle, Go code should behave the same as C++ code, but syscall.CertOpenStore is a wrapper which doesn't seem to use Get

[go-nuts] Re: How do you retrieve certs from the Windows Local Machine cert store with Go?

2019-03-19 Thread Sam
It turns out that the call I mentioned will indeed retrieve the Local Machine Personal Cert Store but you must run as Administrator on Windows to do so. Otherwise, the store is not found and no error is returned even though it is an access denied error (when run as C/C++). On Tuesday, March 19,

Re: [go-nuts] Removing Go's nacl port

2019-03-19 Thread Brad Fitzpatrick
Thanks. I left a comment about present on https://github.com/golang/go/issues/30439#issuecomment-474542939 On Tue, Mar 19, 2019 at 11:33 AM Dan Kortschak wrote: > I use it for present to allow students to run code as part of lecture > material. > > Dan > > On Tue, 2019-03-19 at 11:22 -0700, Brad

[go-nuts] Re: How do you retrieve certs from the Windows Local Machine cert store with Go?

2019-03-19 Thread Sam
I'd like to add that I have tried this but the store handle returned is zero store, err := syscall.CertOpenStore( windows.CERT_STORE_PROV_SYSTEM_W, 0, 0, windows.CERT_SYSTEM_STORE_LOCAL_MACHINE, uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr("MY" On Tuesday, March 19, 2019 at 11:34:02 AM

[go-nuts] How do you retrieve certs from the Windows Local Machine cert store with Go?

2019-03-19 Thread Sam
It seems like I should be able to use this: store, err := syscall.CertOpenStore(syscall.CERT_STORE_PROV_MEMORY, 0, 0, windows.CERT_SYSTEM_STORE_LOCAL_MACHINE, uintptr(unsafe.Pointer(my))) but I think I am having trouble with the last argument. I only receive the CRYPT_E_NOT_FOUND error. I have

Re: [go-nuts] Removing Go's nacl port

2019-03-19 Thread Dan Kortschak
I use it for present to allow students to run code as part of lecture material. Dan On Tue, 2019-03-19 at 11:22 -0700, Brad Fitzpatrick wrote: > We plan to remove Go's Native Client (nacl) port, probably in Go > 1.14. > (It's probably too soon to remove it in Go 1.13) > > Is anybody using it? If

[go-nuts] Removing Go's nacl port

2019-03-19 Thread Brad Fitzpatrick
We plan to remove Go's Native Client (nacl) port, probably in Go 1.14. (It's probably too soon to remove it in Go 1.13) Is anybody using it? If so, how? We currently use it for the playground (at play.golang.org) but the plan is to move that to run linux/amd64 binaries under gvisor. We suspect w

Re: [go-nuts] C# nameof equivalent

2019-03-19 Thread Ian Lance Taylor
On Tue, Mar 19, 2019 at 6:18 AM saurabh singh wrote: > > Yes. I am looking for a compile time operator. > Does the community think it makes sense to start a new formal proposal? Sorry for misunderstanding that this is a purely compile time operation. I don't personally see why this is worth a

Re: [go-nuts] why the XOR between*(*[]uintptr)(unsafe.Pointer(&dst)) is fast then []byte

2019-03-19 Thread Michael Jones
Good point On Tue, Mar 19, 2019 at 6:15 AM roger peppe wrote: > On Tue, 19 Mar 2019 at 07:32, Michael Jones > wrote: > >> Ok, at my computer now so time for a longer answer. >> >> What you want is this: >> https://play.golang.org/p/QirBtj523Wu >> > > I think that's wrong too, as the byte slices

Re: [go-nuts] C# nameof equivalent

2019-03-19 Thread saurabh singh
Yes. I am looking for a compile time operator. Does the community think it makes sense to start a new formal proposal? On Tue, Mar 19, 2019, 6:33 PM Robert Engels wrote: > I think nameof is a compile time operation (constant generation) not > runtime. > > I’ve never used it but the ops reques

Re: [go-nuts] why the XOR between*(*[]uintptr)(unsafe.Pointer(&dst)) is fast then []byte

2019-03-19 Thread roger peppe
On Tue, 19 Mar 2019 at 07:32, Michael Jones wrote: > Ok, at my computer now so time for a longer answer. > > What you want is this: > https://play.golang.org/p/QirBtj523Wu > I think that's wrong too, as the byte slices might not be word aligned, so on some architectures, that code will panic due

Re: [go-nuts] C# nameof equivalent

2019-03-19 Thread Robert Engels
I think nameof is a compile time operation (constant generation) not runtime. I’ve never used it but the ops request seems reasonable. Go 2.0 proposal I guess. > On Mar 19, 2019, at 7:53 AM, Ian Lance Taylor wrote: > >> On Tue, Mar 19, 2019 at 5:19 AM saurabh singh wrote: >> >> Is there a

Re: [go-nuts] C# nameof equivalent

2019-03-19 Thread Carlos Alberto Costa Beppler
C# nameof operator is evaluated at compile time. Go does not have this operator, but it would be an nice addition. On Tuesday, March 19, 2019 at 9:53:45 AM UTC-3, Ian Lance Taylor wrote: > > On Tue, Mar 19, 2019 at 5:19 AM saurabh singh > wrote: > > > > Is there an alternative for nameof in go

Re: [go-nuts] C# nameof equivalent

2019-03-19 Thread Ian Lance Taylor
On Tue, Mar 19, 2019 at 5:19 AM saurabh singh wrote: > > Is there an alternative for nameof in golang. > I don't want reflection magic. > Use case is to avoid log messages, validation etc to go out of sync with code > changes: > > func foo(correctParamName string) (interface{}, error){ > if

[go-nuts] -buildmode=shared -linkshared and main: panic?

2019-03-19 Thread Dan Kortschak
I am trying to build an lgo docker image for Go1.10 (working up to Go1.12 with this), but I am finding that the process fails with the following panic. lgo invokes go install with -buildmode=shared -linkshared and I suspect this is the cause of the problem. Is this a known issue? thanks Dan pan

[go-nuts] C# nameof equivalent

2019-03-19 Thread saurabh singh
Is there an alternative for nameof in golang. I don't want reflection magic. Use case is to avoid log messages, validation etc to go out of sync with code changes: func foo(correctParamName string) (interface{}, er

[go-nuts] Re: Persistence of value, or Safely close what you expected

2019-03-19 Thread Henry
Note that you don't need to clean up a channel. The GC will automatically free the channel when there is no more reference to it. The only reason to close a channel is to send a signal to the other goroutines that you are done and there is no more data to send. Other than that, you don't need to

[go-nuts] Re: why the XOR between*(*[]uintptr)(unsafe.Pointer(&dst)) is fast then []byte

2019-03-19 Thread zhou yu
found the answer with the help of author os repo, disassemble the code, fast use XORQ, the safe one use XORL but actually xor byte by byte. the fast convert the oprand to uintptr. so it can use XOR 4/8 byte one time 在 2019年3月19日星期二 UTC+8上午10:36:21,zhou yu写道: > > *Why the XOR between*(*[]uintptr)

Re: [go-nuts] why the XOR between*(*[]uintptr)(unsafe.Pointer(&dst)) is fast then []byte

2019-03-19 Thread zhou yu
thanks for you review. i just want to figure out why the fastXOR is fast then the safe one, so I cut out the source, maybe this cause the demo is not rebust like it in the repo, and if did have some mistake maybe you can pr the https://github.com/templexxx/xor. 在 2019年3月19日星期二 UTC+8下午3:32:52,M

Re: [go-nuts] why the XOR between*(*[]uintptr)(unsafe.Pointer(&dst)) is fast then []byte

2019-03-19 Thread Michael Jones
Ok, at my computer now so time for a longer answer. What you want is this: https://play.golang.org/p/QirBtj523Wu Now, what's wrong with the code you sent? Quite a few things actually. Maybe you should start with the code shared above and then work through what it is doing, then compare that with