[go-nuts] Can anyone explain this section of the unicode/utf8 test suite?

2016-11-28 Thread Pietro Gagliardi
Not sure if this belongs here or golang-dev, but... I'm copying the unicode/utf8 and unicode/utf16 tests for my own C library that also deals with UTF-8 and UTF-16 (because why not), and there's one thing I'm confused about in the former: https://github.com/golang/go/blob/d2951740303587fc0c5d14

Re: [go-nuts] Re: Deleting the /r/golang subreddit

2016-11-24 Thread Pietro Gagliardi
> On Nov 24, 2016, at 7:42 PM, Brian Ketelsen wrote: > > https://golangnews.com/ > > who runs this? https://github.com/kennygrant seemingly? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving em

Re: [go-nuts] Windows DPAPI Golang package

2016-11-23 Thread Pietro Gagliardi
That is the .net API; the equivalent C API is https://msdn.microsoft.com/en-us/library/aa380261.aspx Looking on godoc.org and github, I don't see any pre-made packages that implement this. However, you can use golang.org/x/sys/windows to call this function yourself. https://github.com/

Re: [go-nuts] Reaching infinity

2016-11-16 Thread Pietro Gagliardi
Run() waits for the process to exit, so in reality only the third thing there is ever run. Use Start() instead. select{} blocks forever. > On Nov 16, 2016, at 5:15 PM, Michael Jones wrote: > > After your for loop, you could add: > > fmt.Println(math.Inf(0)) > > > From: on behalf of Niki

Re: [go-nuts] [ANN] (GUI) Qt binding which supports Windows / macOS / Linux / Android / iOS / Sailfish OS / Raspberry Pi

2016-11-12 Thread Pietro Gagliardi
Does Qt even expose errors itself? Back when I did Qt I never had to check myself... > On Nov 12, 2016, at 4:17 AM, Jason Stillwell wrote: > > I gave it a try using QMdiArea. It seems to work well. > > But I'm confused about where the errors go. There doesnt' seem to be a way to > check for e

Re: [go-nuts] go generate "pipelines"

2016-11-10 Thread Pietro Gagliardi
Why not just run all those generate commands in a single go generate call, such as a shell script or a go run? > On Nov 10, 2016, at 9:53 AM, Rob Pike wrote: > > Offhand: > > You would need to write the programs go generate is calling to be idempotent, > and have the second one exit quietly if

Re: [go-nuts] Why google cloud vision api cause memory issue when it is failed to detect

2016-11-10 Thread Pietro Gagliardi
And what's the code on the client side, which I assume is in Go? > On Nov 10, 2016, at 5:26 AM, nova6...@gmail.com wrote: > > try{ > byte[] imageBytes=mymultipart imagefile; > > httpTransport = GoogleNetHttpTransport.newTrustedTransport(); > JsonFactory jsonFactory = GsonFactory.getDe

Re: [go-nuts] Noob question: Pointers to interfaces

2016-11-07 Thread Pietro Gagliardi
The same explanation that applies to slices of interfaces (https://golang.org/doc/faq#convert_slice_of_interface ) applies to pointers to interfaces. You shouldn't need a pointer to interface anyway; what are you trying to do? > On Nov 7, 2

Re: [go-nuts] gopkg.in updated: snap, Let's Encrypt, etc

2016-11-02 Thread Pietro Gagliardi
> On Nov 2, 2016, at 1:09 PM, Gustavo Niemeyer wrote: > > The problem was that git from very recent distributions linked against gnutls > and did not support elliptic curve certificates. > Did something happen that made elliptic curve certificates undesirable? -- You received this message be

Re: [go-nuts] Oxymoron: language spec: ``untyped boolean value''

2016-11-02 Thread Pietro Gagliardi
It means there is no specific type name, but the resultant type must either be bool or convertible to bool: type A bool var n int var ok A n, ok = x.(int) Using bool here is not common, but you see this with int and float, etc. Untyped constants is one of the most prominent Go features. > On N

Re: [go-nuts] Function passing fails to perform type coercion to interface

2016-11-01 Thread Pietro Gagliardi
This does not work for the same reason []*MyType cannot be converted to []MyInterface or even to []interface{}: the in-memory representation of an interface is not the same as of the concrete type. See also https://golang.org/doc/faq#convert_slice_of_interface > On Nov 1, 2016, at 6:54 AM, Steve

Re: [go-nuts] bug? if true &&& true &&& false {

2016-10-31 Thread Pietro Gagliardi
(that second half was also addressed to the OP) > On Oct 31, 2016, at 5:08 PM, Pietro Gagliardi wrote: > > Not sure if you were addressing me or the OP. > > If me: Of course; that is the realization that comes once you understand how > leftmost longest matching works :) My

Re: [go-nuts] bug? if true &&& true &&& false {

2016-10-31 Thread Pietro Gagliardi
to scan and prove this for yourself if necessary. > On Oct 31, 2016, at 4:57 PM, Jan Mercl <0xj...@gmail.com> wrote: > > On Mon, Oct 31, 2016 at 9:48 PM Pietro Gagliardi <mailto:andl...@lostsig.net>> wrote: > > > In Go, as in most languages, spaces do not *have t

Re: [go-nuts] bug? if true &&& true &&& false {

2016-10-31 Thread Pietro Gagliardi
In addition, here's a few exercises. What do the following get tokenized as? &^== &&^ <<- ++= -&^ /^* > On Oct 31, 2016, at 4:48 PM, Pietro Gagliardi wrote: > > In Go, as in most languages, spaces do not *have to* delimit tokens. A token > ends when

Re: [go-nuts] CGO: Go string -> void*/length

2016-10-31 Thread Pietro Gagliardi
I was going by the example at the bottom of the OP. Use whatever type is expected by the C API, of course. > On Oct 31, 2016, at 4:41 PM, Florian Weimer wrote: > > * Pietro Gagliardi: > >> Just pass the null-terminated string and use C.int(len(goString)) as >> the le

Re: [go-nuts] bug? if true &&& true &&& false {

2016-10-31 Thread Pietro Gagliardi
In Go, as in most languages, spaces do not *have to* delimit tokens. A token ends when the leftmost longest matching token is found, and the rest is placed back in the input buffer for the next token. So &&& true 1) read & — this can be &, &=, &&, &^, or &^=, so read again

Re: [go-nuts] CGO: Go string -> void*/length

2016-10-31 Thread Pietro Gagliardi
Just pass the null-terminated string and use C.int(len(goString)) as the length. The length of a Go string is already in bytes and does not include the terminating null (since Go has none), and I assume C.CString() produces the same byte sequence without encoding conversions. > On Oct 31, 2016,

Re: [go-nuts] JSON with repeating section and Slice in struct

2016-10-30 Thread Pietro Gagliardi
You need to export the fields of tData in order for encoding/json to see them. > On Oct 30, 2016, at 6:01 AM, MaReK Olšavský wrote: > > Hello, > maybe i'm bad understand to json.Unmarshal and slices. > I've data in json: > vals := > `[{"time":"20160902","value":572736},{"time":"20160903","value

Re: [go-nuts] iconvg: a compact, binary format for simple vector graphics

2016-10-27 Thread Pietro Gagliardi
gt; > > On 27 Oct 2016 17:51, "Pietro Gagliardi" <mailto:andl...@lostsig.net>> wrote: > What part of the document are you referring to? > > On Oct 27, 2016, at 11:42 AM, roger peppe > <mailto:rogpe...@gmail.com>> wrote: > > > > On 26 October 20

Re: [go-nuts] Re: Stalking people online for thought crimes! This is what the Go project has succumbed to!

2016-10-27 Thread Pietro Gagliardi
> On Oct 27, 2016, at 11:49 AM, Andrew Gerrand wrote: > > I have done this before, and it has not gone well. People feel humiliated > when called out publicly. > > Imagine this happened in a workplace. Do you bring it up at the team meeting? > Or take them aside and mention it to them in pri

Re: [go-nuts] iconvg: a compact, binary format for simple vector graphics

2016-10-27 Thread Pietro Gagliardi
What part of the document are you referring to? > On Oct 27, 2016, at 11:42 AM, roger peppe wrote: > > On 26 October 2016 at 23:50, Nigel Tao wrote: >> On Wed, Oct 26, 2016 at 7:20 PM, roger peppe wrote: >>> This cannot be understated. A well known tool generates SVGs that the >>> Go XML parser

Re: [go-nuts] cross-compile with cgo 'permission denied'

2016-10-25 Thread Pietro Gagliardi
What part of that magic incantation was not documented? > On Oct 25, 2016, at 5:23 PM, Liam wrote: > > What I wanted was the magic incantation (documented nowhere) for linux_arm > installation: > >GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc go install > -v -a std >GO

Re: [go-nuts] Hosting godoc internally for private git server

2016-10-25 Thread Pietro Gagliardi
> already and share the knowledge how. > > On Thursday, October 20, 2016 at 12:35:10 PM UTC-5, Pietro Gagliardi > (andlabs) wrote: > You can go get golang.org/x/tools/cmd/godoc > <http://golang.org/x/tools/cmd/godoc> and run the godoc tool itself, which > will imitate

Re: [go-nuts] issue with sending JSON via HTTP

2016-10-25 Thread Pietro Gagliardi
ioutil.ReadAll() returns a []byte, which already represents the data in JSON form. You do not need to marshal it agian; in fact, you do not want to marshal it again, because then you'll get, as per encoding/json's documentation, the base64-encoded byte stream as a string, which is not right. Ins

Re: [go-nuts] golang and java, a view

2016-10-24 Thread Pietro Gagliardi
> On Oct 24, 2016, at 12:24 PM, Daniel Theophanes wrote: > > Go1.8 will support multiple result sets if the driver support it. I believe they meant being able to have multiple result sets usable at a time, which implies ditching the stream-based model for the more widely adopted "slurp it all

Re: [go-nuts] iconvg: a compact, binary format for simple vector graphics

2016-10-24 Thread Pietro Gagliardi
I wonder if there's a way to simulate elliptical gradients with only circular gradients and affine transformations, so package ui can also render these files directly using the system native vector graphics APIs. Does this also require the cairo/Quartz feature of having a circular gradient have

Re: [go-nuts] allow &int{3}, &bool{true} etc

2016-10-22 Thread Pietro Gagliardi
> On Oct 22, 2016, at 2:19 PM, Matt Harden wrote: > > and [...]int{5}[:] is also illegal (slice of unaddressable value) []int{5} will do the same thing, and I didn't know this until recently but the spec is written such that this even works with named indices: v := []int{

Re: [go-nuts] Re: A question, simple for go team

2016-10-22 Thread Pietro Gagliardi
DIscounting even garbage collector: is there any memory allocator anywhere that provides a facility to only return bytes at the start of an allocation to the manager? realloc() only lets you return bytes at the end, and most other allocators I've seen are based on that one's API... > On Oct 22,

[go-nuts] Is it possible for src/make.* to detect and warn users if their prepackaged source tree mixes 1.x and 1.y?

2016-10-21 Thread Pietro Gagliardi
This seems to be a common issue where people confuse problems building Go programs with problems building Go because they do an in-place upgrade from the prepackaged source, causing go build to mix, say, 1.5 and 1.6 files that are not compatible. https://github.com/andlabs/ui/issues/185 https:/

Re: [go-nuts] undefined: C in C.PCAP_NETMASK_UNKNOWN

2016-10-21 Thread Pietro Gagliardi
So the trigger was that there is both a pointer and a C.xxx name in the same argument list? > On Oct 21, 2016, at 10:56 AM, Ian Lance Taylor wrote: > > On Fri, Oct 21, 2016 at 7:07 AM, Pietro Gagliardi wrote: >> >> Just >> >> go get -u -v github.com/google/

Fwd: [go-nuts] Re: undefined: C in C.PCAP_NETMASK_UNKNOWN

2016-10-21 Thread Pietro Gagliardi
(Once again I hit Reply instead of Reply-All. Is there a way to make OS X Mail not be dumb about mailing lists?) > Begin forwarded message: > > From: Pietro Gagliardi > Subject: Re: [go-nuts] Re: undefined: C in C.PCAP_NETMASK_UNKNOWN > Date: October 21, 2016 at 10:06:55 AM EDT

Re: [go-nuts] Re: undefined: C in C.PCAP_NETMASK_UNKNOWN

2016-10-21 Thread Pietro Gagliardi
Regression by Go commit a16954b8a7d66169760fb60dd7f3d4e400a5e98c. Not sure what a simpler reproduction is, but I have an idea... > On Oct 21, 2016, at 7:31 AM, sergobot...@gmail.com wrote: > > +1, I have same error but with glfw, not gopacket. > Have you found any solution yet? > > On Friday, O

Re: [go-nuts] How to build my own godoc

2016-10-20 Thread Pietro Gagliardi
Download from github go-tool. Modified > ~/gopkg/src/golang.org/x/tools/godoc/static/static.go. GOPATH is ~/gopkg > > 在 2016年10月21日星期五 UTC+8上午12:50:49,Pietro Gagliardi (andlabs)写道: > Where did you download it to, what file (absolute filename) did you modify, > and what is your $GOP

[go-nuts] Should go vet catch people attempting to identify errors by inspecting err.Error()?

2016-10-20 Thread Pietro Gagliardi
It seems that something about the way the error interface is designed is not intuitive enough for some, because a number of people on the IRC channel keep coming up asking what the best way to check for a specific error is — and their first instinct is to scan the contents of the string returned

Re: [go-nuts] Hosting godoc internally for private git server

2016-10-20 Thread Pietro Gagliardi
You can go get golang.org/x/tools/cmd/godoc and run the godoc tool itself, which will imitate golang.org. This is different from godoc.org; that is harder to host locally. > On Oct 20, 2016, at 1:13 PM, Kareem Gan wrote: > > Hello. > > Is it possible to host godoc internally because we have o

Re: [go-nuts] How to build my own godoc

2016-10-20 Thread Pietro Gagliardi
Where did you download it to, what file (absolute filename) did you modify, and what is your $GOPATH? > On Oct 20, 2016, at 3:05 AM, FancyGo wrote: > > Hi all, I have download source code of godoc. But I have no idea how to build > it. Because I have modified the source code, so I don't want us

Re: [go-nuts] print pointer value to json...

2016-10-19 Thread Pietro Gagliardi
You must export the struct fields in order for package json to see them. > On Oct 19, 2016, at 8:43 PM, eric wrote: > > hi, i am newer in golang. > > i want to marshal pointer value to json. > > but, i can't. how can i do that ? > > thanks, > > > package main > > import ( > "encoding/

Re: [go-nuts] the defer list

2016-10-19 Thread Pietro Gagliardi
All right then. Good to know, thanks. > On Oct 19, 2016, at 4:50 PM, Thomas Bushnell, BSG > wrote: > > On Wed, Oct 19, 2016 at 1:47 PM Pietro Gagliardi <mailto:andl...@lostsig.net>> wrote: > Manual memory management is a part of life in the C world. defer is the >

Re: [go-nuts] the defer list

2016-10-19 Thread Pietro Gagliardi
pemaps to ensure all allocs are correctly > freed... :o( > > > > On Wednesday, October 19, 2016 at 8:41:25 PM UTC+1, Pietro Gagliardi > (andlabs) wrote: > What do you want to do with it? > >> On Oct 19, 2016, at 3:31 PM, andrew...@miracl.com wrote: >> >&

Re: [go-nuts] the defer list

2016-10-19 Thread Pietro Gagliardi
What do you want to do with it? > On Oct 19, 2016, at 3:31 PM, andrew.sm...@miracl.com wrote: > > Hi, > > This is probably a long shot, but is it possible to get a reference to the > list of functions that the 'defer' statement populates? Is it exposed and/or > is it specific? > > Andy > > -

Re: [go-nuts] switch fallthrough

2016-10-19 Thread Pietro Gagliardi
In addition, it just so happens that the break at the end situation is the most common situation for a switch statement. So all Go did was flip the requirements: instead of needing an explicit break to not fall through, have an explicit fallthrough to not break. The Go model of break by default

Re: [go-nuts] Are short variable declarations necessary?

2016-10-18 Thread Pietro Gagliardi
No, the reason for short variable declarations is to avoid having to stutter the type of variables everywhere. It's part of the reason why Go is strongly typed yet doesn't fully feel that way, and was one of the main design goals at first. Why the control statements require one, however, is som

Re: [go-nuts] simplifying freeing CString

2016-10-17 Thread Pietro Gagliardi
> On Oct 17, 2016, at 5:03 PM, andrew.sm...@miracl.com wrote: > > Hi, > > When using cgo its my understanding that strings created with C.CString must > be freed with C.free, but yet numeric types do not need to be explicitly > freed. Yes. This is because strings in C are not first class obje

Re: [go-nuts] Need help building Go

2016-10-14 Thread Pietro Gagliardi
IIRC you need to update go tool dist to tell it that flag depends on math/big; see src/cmd/dist/deps.go But if you only need math.Big flags for one project then one thing you could do is implement a wrapper type of sorts that implements flag.Value. For example, type BigIntFlag {

Re: [go-nuts] stdout to zlib and then to io.reader service

2016-10-13 Thread Pietro Gagliardi
What's the other end (the "other service") look like? > On Oct 13, 2016, at 1:43 PM, Walter Garcia wrote: > > Hello all > Im trying to test using zlib. > > In my test I need compress the Stdout from exec.Command to zlib and then send > to io.reader to use in other service > > cmd := exec.Comm

Re: [go-nuts] NullTime in SQL drivers: how to leak them to the user?

2016-10-13 Thread Pietro Gagliardi
What error do you get? Can you paste it here? In the meantime, does pq's license allow you to just copy its NullTime into your project? > On Oct 13, 2016, at 8:34 AM, Lucio wrote: > > I used > > import "github.com/lib/pq" > >... > > var t pq.NullTime > > ... > > successfully in

Fwd: [go-nuts] lxn/walk goroutine blocks

2016-10-11 Thread Pietro Gagliardi
> Begin forwarded message: > > From: Pietro Gagliardi > Subject: Re: [go-nuts] lxn/walk goroutine blocks > Date: October 11, 2016 at 7:48:04 AM EDT > To: Tamás Gulácsi > > That would mean lxn/walk is doing initialization on the init() thread, > because Windows doe

Re: [go-nuts] what's the difference between Golang and Java about interface?

2016-10-08 Thread Pietro Gagliardi
tic sugar around the fact that Java does not have > first class functions. At least not in the sense Go does. > > > On Sat, Oct 8, 2016, 17:31 Pietro Gagliardi <mailto:andl...@lostsig.net>> wrote: > In Java, if an interface contains exactly one method, and that

Re: [go-nuts] what's the difference between Golang and Java about interface?

2016-10-08 Thread Pietro Gagliardi
> On Oct 8, 2016, at 11:24 AM, Jan Mercl <0xj...@gmail.com> wrote: > > > > On Sat, Oct 8, 2016, 16:39 Pietro Gagliardi <mailto:andl...@lostsig.net>> wrote: > > > Go does not have functional interfaces or interface literals. > > I don't know

Re: [go-nuts] what's the difference between Golang and Java about interface?

2016-10-08 Thread Pietro Gagliardi
The most obvious difference is that Go doesn't have the implements keyword. All you have to do to implement an interface is implement the interface's methods, and the Go compiler will take care of the rest. This rule leads to the empty interface, interface{}. This interface requires no methods

[go-nuts] Should golang.org/x/crypto/ssh.ParsePrivateKey() be extended to parse encrypted keys?

2016-10-07 Thread Pietro Gagliardi
While waiting for some long-running automated tasks at work to complete, I passed the time by writing a simple program using github.com/pkg/sftp to automate dumping the latest backups from our backup server onto my computer for using them to test other parts of our

Fwd: [go-nuts] Correct use of Mutex

2016-10-04 Thread Pietro Gagliardi
> Begin forwarded message: > > From: Pietro Gagliardi > Subject: Re: [go-nuts] Correct use of Mutex > Date: October 3, 2016 at 4:22:34 PM EDT > To: a...@cpu.host > > Why are you locking on the map key? > >> On Oct 3, 2016, at 2:53 PM, a...@cpu.

Fwd: [go-nuts] overriding keywords or rather allowing them to be part of a struct in go?

2016-10-04 Thread Pietro Gagliardi
> Begin forwarded message: > > From: Pietro Gagliardi > Subject: Re: [go-nuts] overriding keywords or rather allowing them to be part > of a struct in go? > Date: October 4, 2016 at 12:59:54 PM EDT > To: David Luu > > Assuming the XML-RPC package uses it, the doc

Re: [go-nuts] slice: copy to zero length slice

2016-10-02 Thread Pietro Gagliardi
No, it should not operate that way. Remember that all function calls in Go pass arguments by value. A slice is actually a value somewhat analogous to type SliceOfT struct { Data*T Len int Cap int } When