Re: [go-nuts] Package splited beween 2 fiels give stange behaviour with go run

2018-02-28 Thread Viacheslav Modestov
The problem is solved. 1. Apparently go run some_file.go do not compile all files. Must use go build instead. 2. While trying different solutions and have misspeled name of func, never spot it so go build give me undefined , again, I have got even more confused. After fixing error: [go build] th

Re: [go-nuts] Package splited beween 2 fiels give stange behaviour with go run

2018-02-28 Thread Viacheslav Modestov
The problem is solved. 1. Apparently go run some_file.go do not compile all files. Must use go build instead. 2. While trying different solutions and have misspeled name of func, never spot it so go build give me undefined , again, I have got even more confused. After fixing error: [go build] th

Re: [go-nuts] w, x += i, i+i

2018-02-28 Thread Michael Jones
AssignOp across seems far better than gang increment. Better yet... Thing1 += Thing2 With things being [3]float64 or struct{ r,g,b float64} which I do constantly The dream would be: Thing1 += f*Thing2 Which is the full desire, vs: P := fb[y*stride+x] P.r += f*fragment.r P.g += f*fragment.g P.

Re: [go-nuts] Getting an unsafe.Pointer to a []byte's underlying array?

2018-02-28 Thread jordan9001
Perfect! That feels much better. Thanks. -Jordan On Wednesday, February 28, 2018 at 4:38:57 PM UTC-7, Ian Lance Taylor wrote: > > On Wed, Feb 28, 2018 at 1:58 PM, > > wrote: > > > > What is the best way to get an unsafe.Pointer to a []byte's underlying > > array? > > unsafe.Pointer(&b[0]) >

Re: [go-nuts] w, x += i, i+i

2018-02-28 Thread Ian Lance Taylor
On Wed, Feb 28, 2018 at 4:53 PM, Alex Dvoretskiy wrote: > > When I'm doing assignments to multiple variables in one line, there is a > limitation. > > > You can do it in this way: > w, x = w+i, x+i+i > > But can't in this one: > w, x += i, i+i > > > What do you think, it was done on purpose or thi

[go-nuts] w, x += i, i+i

2018-02-28 Thread Alex Dvoretskiy
Hello Golang-nuts, When I'm doing assignments to multiple variables in one line, there is a limitation. You can do it in this way: w, x = w+i, x+i+i But can't in this one: w, x += i, i+i What do you think, it was done on purpose or this is something worth for change proposal? https://play.

Re: [go-nuts] Getting an unsafe.Pointer to a []byte's underlying array?

2018-02-28 Thread Ian Lance Taylor
On Wed, Feb 28, 2018 at 1:58 PM, wrote: > > What is the best way to get an unsafe.Pointer to a []byte's underlying > array? unsafe.Pointer(&b[0]) > I have added this function to syscall/syscall_linux.go to support some of > our experiments. One of the new getsockopt calls returns a variable le

[go-nuts] Getting an unsafe.Pointer to a []byte's underlying array?

2018-02-28 Thread jordan9001
What is the best way to get an unsafe.Pointer to a []byte's underlying array? I have added this function to syscall/syscall_linux.go to support some of our experiments. One of the new getsockopt calls returns a variable length amount of data into the buffer, which has no real set size. As such,

[go-nuts] Re: Build started to fail with 1.10

2018-02-28 Thread adam.azarchs via golang-nuts
I've run into this as well. It looks somewhat related to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=314435 As the maintainers explained there, nanosleep isn't part of the c99 standard (it is part of the posix standard). When you set -std=c99, that turns off -D_GNU_SOURCE, which turns of

Re: [go-nuts] Re: JSON and Embedded Types (Aliases)

2018-02-28 Thread Kaveh Shahbazian
You are right Axel, I should be more clear on when one needs to overwrite that method with the same name as type (with the same name) (method B of type *B). Sample: https://play.golang.org/p/rg5C_5Z5NhR (compiler error) Working example using type aliases: https://play.golang.org/p/PBHBvkSPUxW

Re: [go-nuts] Re: JSON and Embedded Types (Aliases)

2018-02-28 Thread 'Axel Wagner' via golang-nuts
Can you elaborate/link to example code? Because it seems to work just fine . On Wed, Feb 28, 2018 at 6:58 PM Kaveh Shahbazian wrote: > BTW I have found an interesting usage for embedding type aliases. Assume a > type A embeds another type B that has a memb

[go-nuts] Re: Arbitrary Secondary Indexes for boltdb

2018-02-28 Thread Kaveh Shahbazian
Usage tests from boltdb added. Sample usage here . Any bug reports are most welcome! On Tuesday, February 27, 2018 at 5:29:01 PM UTC+3:30, Kaveh Shahbazian wrote: > > This package conta

Re: [go-nuts] Re: JSON and Embedded Types (Aliases)

2018-02-28 Thread Kaveh Shahbazian
BTW I have found an interesting usage for embedding type aliases. Assume a type A embeds another type B that has a member named B. That will cause a compilation error since A has two members named B. Now if a type alias be defined as type OrigB = B, then A can embed OrigB without any problems.

Re: [go-nuts] Package splited beween 2 fiels give stange behaviour with go run

2018-02-28 Thread Jan Mercl
On Wed, Feb 28, 2018 at 6:30 PM wrote: > package main splited between two files, than in file with main func, function from other file is used as argument to wrapping function. After go run main.go I have got undefined . Is it a bug, > or could it be my machine, I run it under Android on Linovo T

[go-nuts] Package splited beween 2 fiels give stange behaviour with go run

2018-02-28 Thread viacheslav . modestov
package main splited between two files, than in file with main func, function from other file is used as argument to wrapping function. After go run main.go I have got undefined . Is it a bug, or could it be my machine, I run it under Android on Linovo Tab? I ask this Question on stackoverflow.c

Re: [go-nuts] AES-GCM as stream cipher?

2018-02-28 Thread Xiaoyi Shi
Thanks! On Tuesday, February 27, 2018 at 11:51:13 PM UTC+8, Buschini Edouard wrote: > > The tag is wrapped inside of the output of seal: > - size of the tag: https://golang.org/src/crypto/cipher/gcm.go#L126 > - https://golang.org/src/crypto/cipher/gcm.go#L146 > > You have to pass the tag + enc

[go-nuts] Re: Organizing code with vgo

2018-02-28 Thread Johann Höchtl
As the question might have been to generic -- Suppose I have the following layout: package ( containing a go.mod file) \ command1\ main.go Should vgo be able to create a /vendor/ folder in a sub-directory of a module? When Dockerizing go packages which result in executable commands I think t