Re: [go-nuts] [ANN] oksvg and rasterx; SVG 2.0 path compliant renderer and rasterizer

2018-04-24 Thread andrey mirtchovski
> I’d have thought the case would be the same with the AGPL. https://opensource.google.com/docs/using/agpl-policy/ -- 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 t

Re: [go-nuts] Why does the parallel version of a program runs slower?

2018-04-16 Thread andrey mirtchovski
In short, your concurrency is too fine-grained. Adding concurrency primitives requires locking which is expensive, and creating a lot of goroutines does consume resources, even if we consider it relatively cheap. If you slice the problem slightly differently it can be made faster: one goroutine pe

Re: [go-nuts] Re: latest go examples

2018-04-13 Thread andrey mirtchovski
If you're looking for general examples of modern Go, perhaps the JustForFunc series will be of interest: https://www.youtube.com/channel/UC_BzFbxG2za3bp5NRRRXJSw On Fri, Apr 13, 2018 at 10:28 AM, JM wrote: > thanks. I run a software engineering team so I've been less hands-on lately > and want t

Re: [go-nuts] latest go examples

2018-04-13 Thread andrey mirtchovski
Due to Go's compatibility promise most example code written since Go 1.0 should still be relevant, will compile, and will run. Libraries have grown since 1.0 as our understanding of how to write Go code improves (context.Context is one such innovation), but the examples in the documentation are kep

Re: [go-nuts] Did you try to handle http gzip requests?

2018-04-12 Thread andrey mirtchovski
but when it reaches: > > body, err := ioutil.ReadAll(reader) > > if the reader is gzip.Reader - it throws an error: "unexpected EOF" > > > > On Thu, Apr 12, 2018 at 10:45 PM andrey mirtchovski > wrote: >> >> from the panic you can see that you're

Re: [go-nuts] Did you try to handle http gzip requests?

2018-04-12 Thread andrey mirtchovski
from the panic you can see that you're passing to ReadAll a valid interface (non-nil type pointer) however the interface contains a nil object (nil value pointer): io/ioutil.ReadAll(0x14ce020, 0x0, 0x0, 0x1a, 0xc420069cb0, 0x1, 0x1) to understand why there are more arguments than you expect in th

Re: [go-nuts] [NEWBIE] what means importing a file versus a directory?

2018-04-11 Thread andrey mirtchovski
> ah, it's all (i think) clear now. so, based on what i see under > ${GOROOT}/src/hash, i could do any or all of the following: > > import "hash" > import "hash/adler32" > import "hash/crc32" > import "hash/crc64" > import "hash/fnv" note that you don't need to import "hash" unless you

Re: [go-nuts] Is there a memory leak on Rob Pike's demo codes?

2018-04-04 Thread andrey mirtchovski
The easiest way to avoid this is to make the channel buffered with enough room to consume all responses. Only the first one will be read, but the rest will be garbage collected. c := make(chan Result, len(replicas)) should be enough. On Wed, Apr 4, 2018 at 4:20 AM, wilby yang wrote: > I am new

Re: [go-nuts] API fixes for sync.Mutex and friends?

2018-04-02 Thread andrey mirtchovski
this is https://github.com/golang/go/issues/8005, i believe. On Mon, Apr 2, 2018 at 5:37 PM, Andrew Pennebaker wrote: > Some Go types like sync.Mutex have a subtle API issue, where the objects > really shouldn't be copied or passed around into different function calls, > e.g. to a goroutine worke

Re: [go-nuts] Re: asn1: tags don't match

2018-04-01 Thread andrey mirtchovski
Thanks for your help. I think I understood the problem I was having. In the original code (not the example in this email) things that would normally go to a CHOICE field were marshalled into a RawValue, which then got switched on RawValue.Tag to decide where to go (it's part of the protocol, unrela

[go-nuts] asn1: tags don't match

2018-03-31 Thread andrey mirtchovski
I have a piece of valid asn.1 that i'm not able to properly parse with Go's encoding/asn.1. I have distilled the example down to: https://play.golang.org/p/YQCVxhEKnJx the asn1 code, which i generated with asn1c, is parseable by asn1c and lapo.it: http://lapo.it/asn1js/#A010A106800101810102A20680

Re: [go-nuts] Listing of names on https://golang.org/pkg/

2018-03-29 Thread andrey mirtchovski
Is this what you're referring to? It's on tip.golang.org (don't see it on golang.org): https://i.imgur.com/vrPD0UC.png for me the order does not change, but that can be an artefact of caching. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Known unknown escape sequence in Go

2018-03-22 Thread andrey mirtchovski
the backslash character means something within double quotes. either escape it ("\S" becomes "\\S") or use backquotes (`\S`) On Thu, Mar 22, 2018 at 4:33 PM, Tong Sun wrote: > I'm trying with simple Perl character class regular expression, which should > be supported by Go (link). > > However, I'

[go-nuts] Unexpected output on playground

2018-03-14 Thread andrey mirtchovski
wanted: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1090432] got: ** Signal 11 from untrusted code: pc=6559000898c0 is this just an idiosyncrasy of the playground, or am I breaking something? -- You rece

Re: [go-nuts] tcp net.Conn deadlocks when message size increased

2018-03-09 Thread andrey mirtchovski
it deadlocks because you're not reading all the data. Read() may return "up to len(p)", but not necessarily the whole thing. the reader should loop until it reads all available bytes in your case you know how many bytes you are going to write beforehand. if you do not ignore the first value return

Re: [go-nuts] why is the "1" in the code demoed in Go spec deduced as a "float64" value instead of an "int" value?

2018-03-07 Thread andrey mirtchovski
the answer is hidden in the spec, i believe (it's not easy to parse, so i suggest reading the whole thing): "The right operand in a shift expression must have unsigned integer type or be an untyped constant representableby a value of type uint. If the left operand of a non-constant shift expressio

Re: [go-nuts] Pass by value in struct not yielding expected result

2018-03-06 Thread andrey mirtchovski
maybe this will give you a hint: https://play.golang.org/p/ANIjc3tCdwp maps are reference types, but they still get passed by value. if you pass a nil map around, the old value you passed will not magically start pointing to a new map once you instantiate it elsewhere. -- You received this messa

Re: [go-nuts] osx 10.12 all.bash weirdness with os/signal tests

2018-03-05 Thread andrey mirtchovski
Thanks. This will give me a chance to check the new GitHub PR process: https://github.com/golang/go/pull/24255 On Mon, Mar 5, 2018 at 11:40 AM, Ian Lance Taylor wrote: > On Mon, Mar 5, 2018 at 10:10 AM, andrey mirtchovski > wrote: >> >> I finally found some time to work on

Re: [go-nuts] Re: Need help to figure out how to convert user.Current() to string.

2018-03-05 Thread andrey mirtchovski
> var testuser string = string(user.Username) you don't need the conversion. user.Username is already a string. -- 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

Re: [go-nuts] Need help to figure out how to convert user.Current() to string.

2018-03-05 Thread andrey mirtchovski
You have a variable of type *user.User. The documentation (https://golang.org/pkg/os/user/#User) says there is a field on that type called "Username". To get the username of a user you should therefore use username.Username (but that's too stuttery, perhaps "u, err := user.Current()" and then use u

Re: [go-nuts] osx 10.12 all.bash weirdness with os/signal tests

2018-03-05 Thread andrey mirtchovski
On Tue, Feb 6, 2018 at 4:20 PM, Ian Lance Taylor wrote: > On Tue, Feb 6, 2018 at 2:54 PM, andrey mirtchovski > wrote: >> $ go test -c os/signal >> $ ./signal.test >> PASS >> $ go tool dist test -v >> >> # Testing packages. >> # go tool dist test

Re: [go-nuts] Memory copy on return statement (copy elision)

2018-03-04 Thread andrey mirtchovski
Use 'go build -gcflags="-m"' to see what inlining actions the compiler takes. more here: https://github.com/golang/go/wiki/CompilerOptimizations#escape-analysis-and-inlining for example this https://play.golang.org/p/QyAauePKbn- will result in: $ go build -gcflags='-m' t.go # command-line-argumen

Re: [go-nuts] copy is not very essential function? It can always be simulated by append?

2018-03-01 Thread andrey mirtchovski
> I don't know that. append was not in Go 1.0? Go the language was opened to the world on Nov 10, 2009. Go 1.0 was released 28 March 2012. Append appeared on Oct 27, 2010: https://github.com/golang/go/commit/d8b5d039cd1bec151cc325973ff32bd34ebb0456 -- You received this message because you are s

Re: [go-nuts] vgo and enterprise GitHub servers

2018-02-22 Thread andrey mirtchovski
can you create an issue for this? we're also suffering from the same internally. please make it about GitHub Enterprise, as that is what they call it :) On Thu, Feb 22, 2018 at 5:16 PM, Richard Wilkes wrote: > Is it expected that vgo should work with enterprise GitHub servers at this > point in t

Re: [go-nuts] Float multiplication bug?

2018-02-22 Thread andrey mirtchovski
sorry, i just realized that i said 'area' but meant 'height' in my previous email. On Thu, Feb 22, 2018 at 2:09 PM, andrey mirtchovski wrote: > in the first Printf "area" is truncated. try %.40f to see the real > value, which is more like: > >

Re: [go-nuts] Float multiplication bug?

2018-02-22 Thread andrey mirtchovski
in the first Printf "area" is truncated. try %.40f to see the real value, which is more like: 262256.4523014638689346611499786376953125 plugging that in as h2 will result in 39709429597.0098280725069344043731689453125 (according to wolfram alpha) On Thu, Feb 22, 2018 at 1:32 PM, wrote: > >

Re: [go-nuts] Re: Any plans to add ASN.1 PER support?

2018-02-19 Thread andrey mirtchovski
didn't reply to list, sorry: > https://github.com/chemikadze/asn1go i gave it a try. it's a good start (we use asn1c heavily, asn1go is a good match for our use case) but there seems to be a lot missing. including a license. i created an issue for that. it failed to parse our asn.1 on some techn

Re: [go-nuts] context.Context and worker pools

2018-02-17 Thread andrey mirtchovski
t; >> I did something like this here: >> >> https://github.com/brunoga/workerpool >> >> I do not store the context anywhere, I pass it to my Start() method and it >> passes it down to any place I need it. >> >> >> On Fri, Feb 16, 2018 at 1:05 PM

[go-nuts] context.Context and worker pools

2018-02-16 Thread andrey mirtchovski
While trying to retrofit context.Context within a worker-pool-patterned package, where work is sent down a channel to be picked up by number of worker goroutines. I'm running against the mantra of "Do not store Contexts inside a struct type". For example, I want to put a timeout on the amount of

Re: [go-nuts] Go on MIPS32

2018-02-15 Thread andrey mirtchovski
just bump the clock rate to 3ghz and you'll reduce the cgo call cost to reasonable values :D On Thu, Feb 15, 2018 at 11:29 AM, Dave Cheney wrote: > cgo is not go. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this

Re: [go-nuts] ported cgo project to windows, how to vary the #cgo LDFLAGS used per OS?

2018-02-15 Thread andrey mirtchovski
#cgo darwin LDFLAGS:-framework Security -framework Foundation -framework SystemConfiguration #cgo linux LDFLAGS:-L${SRCDIR}/../../lib -lxml2 etc. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving e

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread andrey mirtchovski
If you mix dynamic libraries with static ones in the same folder the -L -l trick won't work. a workaround is to softlink the .a files to a separate folder so that the linker doesn't see the .so/.dylib files. On Fri, Feb 9, 2018 at 12:11 PM, Jason E. Aten wrote: >> Note that the _ALLOW environment

Re: [go-nuts] how to link cgo libraries in go1.9.4 ?

2018-02-09 Thread andrey mirtchovski
Please add your comments to this issue: https://github.com/golang/go/issues/23749 There are already a couple of reports for that particular usage pattern, one of which is mine. For now you have the option to do: #cgo LDFLAGS: -L${SRCDIR}/../../../LuaJIT/LuaJIT/src -lluajit -lm -ldl There are othe

Re: [go-nuts] osx 10.12 all.bash weirdness with os/signal tests

2018-02-06 Thread andrey mirtchovski
$ go test -c os/signal $ ./signal.test PASS $ go tool dist test -v # Testing packages. # go tool dist test -run=^go_test:archive/tar$ [...] ok net/url (cached) ok os 0.677s ok os/exec 1.414s --- FAIL: TestTerminalSignal (5.01s) signal_cgo_test.go:138: "PS1='prompt> '\r\n" signal_cgo_test.go

[go-nuts] osx 10.12 all.bash weirdness with os/signal tests

2018-02-06 Thread andrey mirtchovski
I'm trying to understand why os/signal tests fail on my 10.12 macbook pro at tip: $ ./all.bash [...] ok net/textproto (cached) ok net/url (cached) ok os 0.678s ok os/exec 1.185s --- FAIL: TestTerminalSignal (5.01s) signal_cgo_test.go:138: "PS1='prompt> '\r\n" signal_cgo_test.go:163: timed out

Re: [go-nuts] SIGSEGV with cgo

2018-01-30 Thread andrey mirtchovski
on the Go side you have an array of bytes, on the C side you are passing a pointer to an array of shorts (16-bits) -- 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

[go-nuts] asn1 struct tagging

2018-01-30 Thread andrey mirtchovski
in the spec i have something defined as: Inner ::= [10] IMPLICIT SEQUENCE { one INTEGER, two INTEGER } Outer :== [11] IMPLICIT SEQUENCE { one Inner, two INTEGER ... } what are my options for tagging the "Inner" struct? do I need to specify the tag (10) in each instan

Re: [go-nuts] where is an online version of older versions like 1.8 1.6 golang pkg doc ?

2018-01-19 Thread andrey mirtchovski
Having an option to link to old docs on golang.org (say golang.org/pkg/something?tag=1.6.0) will result in people linking to that option, crawlers storing that option, search engines pointing to that option, and articles, help information and whatever else online pinning themselves to that option.

Re: [go-nuts] Go Compiler How Work?!

2017-12-15 Thread andrey mirtchovski
> so go compiler generate what?! https://golang.org/cmd/compile/ Compile, typically invoked as “go tool compile,” compiles a single Go package comprising the files named on the command line. It then writes a single object file named for the basename of the first source file with a .o suffix. The

Re: [go-nuts] Go Compiler How Work?!

2017-12-15 Thread andrey mirtchovski
> Last Version of Go Compiler doing Generate `ASM Code` and next Linker... and > make final binary output file for they platform? The modern Go compilers (https://golang.org/cmd/compile/, gccgo) do not generate "ASM Code" unless an appropriate flag is presented to them. For the "compile" tool (go

Re: [go-nuts] Go Compiler How Work?!

2017-12-15 Thread andrey mirtchovski
> Why not Use?! The Go team felt LLVM was too large and slow to meet their performance goals. -- 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+unsubsc

Re: [go-nuts] Elphaba Chess

2017-12-08 Thread andrey mirtchovski
> FireFox actually uses Yahoo --- not Google --- so if Google did make a > donation to Mozilla, they got nothing in return. > You're not supposed to expect something in return when you make a donation > to a non-profit --- donations are not supposed to be a business deal. this is highly offtopic,

Re: [go-nuts] corrupt stack?

2017-12-04 Thread andrey mirtchovski
Erik, any chance you're hitting this? https://github.com/golang/go/issues/20427 Related article discussing bad ram: https://marcan.st/2017/12/debugging-an-evil-go-runtime-bug/ On Mon, Dec 4, 2017, 5:35 PM 'Keith Randall' via golang-nuts < golang-nuts@googlegroups.com> wrote: > package main > >

Re: [go-nuts] Re: Elphaba Chess

2017-12-01 Thread andrey mirtchovski
> Recently I encountered a crash in the latest stable version of Go that > blocked my development and was root caused to a mistake in how pointers are > handled as map keys by the runtime. can you share this bug? perhaps by making it more visible we can, as a team, solve any nascent dependancies o

Re: [go-nuts] Simple exec.Command() program

2017-11-12 Thread andrey mirtchovski
">" is a special character interpreted by your shell. On Sun, Nov 12, 2017 at 8:35 PM, wrote: > package main > > import( > "fmt" > "os/exec" > ) > > func main () > cmd := exec.Command("ls", ">", "/dev/null") > output, err := cmd.CombinedOutput() > if err != nil { > fmt.Println(fmt.Sprint(err) +

Re: [go-nuts] Efficient to copy Hash?

2017-11-12 Thread andrey mirtchovski
> Is there anything in the Go docs that indicates that? https://tip.golang.org/pkg/hash/#Hash (from https://go-review.googlesource.com/c/go/+/66710) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receivi

Re: [go-nuts] Re: Go predicts the end of the universe

2017-11-11 Thread andrey mirtchovski
> > Seems time is on our side. > yes it is. -- 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] Why is there a difference between floating-point multiplication with literals vs. variables in Go?

2017-11-09 Thread andrey mirtchovski
It's in the spec under constants: arithmetic has arbitrary precision. When you restrict to a floating point type by assigning to a variable you also restrict the precision of the result. On Thu, Nov 9, 2017, 4:35 PM wrote: > Why are the following unequal in Go? Is this a bug, or is it by design?

Re: [go-nuts] Sanitising a UTF-8 string

2017-10-22 Thread andrey mirtchovski
See the section "For statements with range clause" in the spec: https://golang.org/ref/spec#For_statements "For a string value, the "range" clause iterates over the Unicode code points in the string starting at byte index 0. On successive iterations, the index value will be the index of the first

Re: [go-nuts] Cgo profiles and ExternalCode

2017-10-12 Thread andrey mirtchovski
Thanks, this helped and worked right off the bat. -- 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, visi

[go-nuts] Cgo profiles and ExternalCode

2017-10-12 Thread andrey mirtchovski
Is there any way, an option or an argument, that would allow me to unwind the stack on the CGO side of a profile better? Right now I'm looking at stacks that unwind only the top function, see example. This happens on both linux and macOS. My other option is to link gperftools into the go binary, b

Re: [go-nuts] Go tour translation in Bulgarian

2017-09-24 Thread andrey mirtchovski
I don't have answers to your questions, but wanted to say "kudos" for the translation! andrey On Sun, Sep 24, 2017 at 8:40 AM, Krasimir Berov wrote: > > Hello all, > Some time ago I started translating "A tour of Go" to Bulgarian - "Разходка > в Go". > The source code is here: https://github.com

Re: [go-nuts] Bug: gofmt 1.9 can't handle go 1.9 code

2017-08-29 Thread andrey mirtchovski
> Have you tried with gofmt 1.9 locally before posting? of course. that is what i showed in the original post: $ go version go version go1.9 darwin/amd64 $ gofmt t.go package main import ( "fmt" ) type myint = int func main() { var ii myint = 5 fmt.Println("Hello, playground#", ii)

Re: [go-nuts] Bug: gofmt 1.9 can't handle go 1.9 code

2017-08-29 Thread andrey mirtchovski
occam's razor: most likely the playground is running an old gofmt. $ gofmt t.go package main import ( "fmt" ) type myint = int func main() { var ii myint = 5 fmt.Println("Hello, playground#", ii) } $ ~/go1.4/bin/gofmt t.go t.go:7:12: expected type, found '=' ... On Tue, Aug 29, 201

Re: [go-nuts] Convert grid of colors to SVG

2017-08-25 Thread andrey mirtchovski
;t look carefully enough? > > On Friday, August 25, 2017 at 12:32:25 PM UTC-4, andrey mirtchovski wrote: >> >> There's svgo: https://github.com/ajstarks/svgo >> >> When in doubt, put your code out there :) >> > -- > You received this message beca

Re: [go-nuts] Convert grid of colors to SVG

2017-08-25 Thread andrey mirtchovski
There's svgo: https://github.com/ajstarks/svgo When in doubt, put your code out there :) On Fri, Aug 25, 2017 at 9:37 AM, wrote: > I've been experimenting with Go recently, having been more of a Python > programmer. > As an exercise, I've written a Go program that creates simple SVG xml based >

Re: [go-nuts] Initializing Go Struct Literals

2017-08-22 Thread andrey mirtchovski
It's not immediately obvious what you're trying to do, but here's one possible solution: https://play.golang.org/p/wrrDlvDISq On Tue, Aug 22, 2017 at 8:38 AM, Tong Sun wrote: > Hi, > > How to initialize a go struct like the following? > > type Server struct { > Namestring > ID int32 >

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-25 Thread andrey mirtchovski
t. Makes sense >> now. Learned a lot too... >> >> Thank you very much I really appreciate it... It already took me more than >> a week. My first time working on this. I do not know how long it would have >> taken me without your help. >> >> Thanks a lo

Re: [go-nuts] Offline Go Documentation Tools

2017-07-24 Thread andrey mirtchovski
> What do you use to read documentation when you are offline? godoc -http=:6060 -- 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...@googlegro

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-18 Thread andrey mirtchovski
the example you have given is incomplete, but the most likely reason you're not being successful is that you are not setting correctly headers for multipart/mixed mime types. i've created a full working example here, hopefully this helps: https://play.golang.org/p/xVqUDN7OGt for more info on mult

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-15 Thread andrey mirtchovski
the code below which gzips and attaches a file to an email io.Writer has worked for me for close to 5 years. it's not idiomatic go code so don't use it verbatim, only as an example. the boundary is something random the client chooses. i use a sha256 baked into the client. the same for every attach

Re: [go-nuts] does Go memory model guarantee this program always prints 1?

2017-07-06 Thread andrey mirtchovski
> Then how about this? No. -- 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 https://groups.googl

Re: [go-nuts] Passing []byte from golang to char * C.

2017-06-14 Thread andrey mirtchovski
can you show us a complete example with a stub C function? in particular the conversion to (*C.char) from unsafe.Pointer(&data[0]) should work. compare the first four bits at that address with the first four bits you're receiving on the C side. they should be identical. e.g.: https://play.golang.or

Re: [go-nuts] CGO: __DARWIN_NULL weirdness

2017-06-11 Thread andrey mirtchovski
I found it: I had a typo writing "C.nil" instead of "nil". thanks for your help! On Sun, Jun 11, 2017 at 9:31 PM, Ian Lance Taylor wrote: > On Sun, Jun 11, 2017 at 7:56 PM, andrey mirtchovski > wrote: >> >> I have a piece of cgo code which doesn't do m

[go-nuts] CGO: __DARWIN_NULL weirdness

2017-06-11 Thread andrey mirtchovski
I have a piece of cgo code which doesn't do much, but links a lot of libraries in. As far as I can tell all my includes are there and they shouldn't stomp on each other (they don't when compiled in C), however with cgo I get the following weirdness: $ go build # mypkg Undefined symbols for archite

Re: [go-nuts] Re: When appending to arrays, gmp.Int values change for large number arrays

2017-05-14 Thread andrey mirtchovski
+ all > the pointer with the finalizer set on it is no longer referenced and the > finalizer is eligible to be run when the next GC occurs. should this constitute an error that requires a panic, or is this not panic-ing due to unsafe/cgo being in use? -- You received this message because you a

Re: [go-nuts] Load dylib without using cgo on macOS?

2017-05-14 Thread andrey mirtchovski
macOS wants to do absolutely everything through their own dylib. it's a way of keeping control of their ecosystem. they've gone to the extent of disallowing you to compile statically linked binaries with their libc. windows is a much more convenient beast in that respect. On Sun, May 14, 2017 at 4

Re: [go-nuts] LinkedList implementation

2017-05-13 Thread andrey mirtchovski
Perhaps looking at the history of the implementation will shed some light: https://github.com/golang/go/commit/01389b966ed81fad6e5fac3e98fe46e162645659 On Sat, May 13, 2017 at 6:28 AM, Keith Brown wrote: > I am learning basic data structures and I chose golang since it provide C > like pointer

Re: [go-nuts] Re: "Selling" Go to Management

2017-05-02 Thread andrey mirtchovski
On Tue, May 2, 2017 at 10:39 AM, wrote: > - Hey, boss, I want to show a novelty. It's called AUTOMOBILE. > - Go ahead. > - It can carry you to any place you want. > - My horse can carry me to any place I want as well. So what? > - No, I mean, an automobile is much more confortable. > - Have you r

Re: [go-nuts] Large GC pauses with large map

2017-04-21 Thread andrey mirtchovski
> amazing, Thank you for that detailed breakdown! when one does something for a long time and understands the system well they develop an intuition for where the problems may lie. this is true in every profession... -- You received this message because you are subscribed to the Google Groups "g

Re: [go-nuts] Introspecting a built Go application - how?

2017-04-21 Thread andrey mirtchovski
as a first approximation, if you have debug symbols for everything, you can use 'nm' and filter out the Go dependencies which normally do not start with underscore: $ nm `which go` | awk '{print $3}' | sed -n '/^_/p' [snip] __cgo_62033c69288a_Cfunc_CFDataGetBytePtr __cgo_62033c69288a_Cfunc_CFDataG

Re: [go-nuts] Why sort.IsSorted implemented with decrement?

2017-04-20 Thread andrey mirtchovski
> 297 for i := n - 1; i > 0; i-- { "i > 0" is cheaper than "i < n" on some processors :) On Thu, Apr 20, 2017 at 3:14 AM, wrote: > Hi > > At the moment it is implemented as > >295func IsSorted(data Interface) bool { >296n := data.Len() >297fo

Re: [go-nuts] C union type to go native types

2017-04-18 Thread andrey mirtchovski
I usually create a separate struct for each part of the union and provide interface methods for un/marshalling. It is more work, but I find it to be much cleaner in the end: once those are created the union doesn't "leak" into the go code. On Tue, Apr 18, 2017 at 8:41 AM, Vasiliy Tolstov wrote: >

Re: [go-nuts] go get and private repositories (GH:E)

2017-03-21 Thread andrey mirtchovski
o.git: unrecognized import path "g...@github.com:user/foo.git" (https fetch: Get https://g...@github.com:user/foo.git?go-get=1: invalid URL port "user") On Tue, Mar 21, 2017 at 9:52 AM, Jan Mercl <0xj...@gmail.com> wrote: > > On Tue, Mar 21, 2017 at 4:44 PM andrey mirtc

[go-nuts] go get and private repositories (GH:E)

2017-03-21 Thread andrey mirtchovski
i'm trying to clone a repo from github enterprise. i've followed the instructions i could find and set up the following gitconfig: [url "git@1.2.3.4:"] insteadOf = ssh://git@1.2.3.4/ however i can't get past the vanity import check, instead getting: unrecognized import path "git@1.2.3.4:/use

Re: [go-nuts] Golang Interview Areas

2017-03-05 Thread andrey mirtchovski
the first question i usually ask is "what's the name of the gopher" :) On Sun, Mar 5, 2017 at 10:50 AM, Nyah Check wrote: > Hi Gophers, > > I am an entry SE and I'm to interview someone to join our Golang Backend > team. I've told them I'm not experienced enough and they refused. Can anyone > ple

Re: [go-nuts] flag: possible issue with intValue.Set

2017-02-21 Thread andrey mirtchovski
You can try binary.Size but you'll also run into the same problem: int's size is platform specific (binary.Size returns -1 for ints). As the go faq states "For portability, code that relies on a particular size of value should use an explicitly sized type, like int64." -- You received this messag

Re: [go-nuts] is this race condition normal?

2017-02-18 Thread andrey mirtchovski
If I may add: undetected race conditions are also a problem. -- 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 op

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread andrey mirtchovski
> Maybe you could use “notwithstanding". It’s an ignored token in the default > Go compiler, and a weak pointer is one that allows an object to be freed > notwithstanding any weak references to it… these are gone now: https://twitter.com/rob_pike/status/808784925402898432 -- You received this

Re: [go-nuts] how to get a pprof cpu profile written to disk?

2017-02-07 Thread andrey mirtchovski
your program never completes, pprof.StopCPUProfile() has no chance of being called. On Tue, Feb 7, 2017 at 2:55 PM, Jason E. Aten wrote: > How does one reliably obtain a cpu profile written to file? I tried > following the instructions in runtime/pprof.go, but the profile file is most > always e

Re: [go-nuts] Go Fonts: request for feedback

2017-02-03 Thread andrey mirtchovski
I think the original asked for what exactly is bugging you about the font, not a general statement that somebody somewhere doesn't like it with a link to a broad discussion on the subject of programming fonts. Do you have anything that bothers you about them, maybe in relationship with the list of

Re: [go-nuts] more cases for a operation means less possibility to get selected?

2017-01-26 Thread andrey mirtchovski
I bet you get wildly differing results with each run. That's an indicator that your sample size is not statistically relevant (there's randomness introduced both in the select, as well as in the OS and Go schedulers). Increase the iterations until your results stabilize, then you'll see what the r

Re: [go-nuts] Problems drawing on frames of an animated gif

2017-01-21 Thread andrey mirtchovski
has ruined the frames. I'll try another gif tomorrow. > > On Saturday, 21 January 2017 16:57:15 UTC, andrey mirtchovski wrote: >> >> I see only a single frame in your source file. I ran your program on >> another gif and got the expected result: >> >> http://i.img

Re: [go-nuts] Problems drawing on frames of an animated gif

2017-01-21 Thread andrey mirtchovski
I see only a single frame in your source file. I ran your program on another gif and got the expected result: http://i.imgur.com/HOnlU1q.gif http://i.imgur.com/GnSUHQ1.gif On Sat, Jan 21, 2017 at 8:54 AM, kalekold via golang-nuts wrote: > Hi, > > I'm trying to draw some text on an animated gif a

Re: [go-nuts] Simple(?) timer program behaves erratically on ARM (and playground), but totally fine on x86 Ubuntu

2017-01-11 Thread andrey mirtchovski
it would've been sufficient to print out "currDur" and see that it goes negative after a while On Wed, Jan 11, 2017 at 12:57 PM, Art Mellor wrote: > Thanks! I never would have found that. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > T

Re: [go-nuts] Simple(?) timer program behaves erratically on ARM (and playground), but totally fine on x86 Ubuntu

2017-01-11 Thread andrey mirtchovski
You've hit the problem already but resolved it the wrong way in your code on line 23. The compiler didn't allow you to multiply an int by time.Duration (int64) but unfortunately you resolved to convert the time.Duration to an int instead of the other way around. On 32-bit architectures ints are not

Re: [go-nuts] Re: error message with Go fonts

2017-01-10 Thread andrey mirtchovski
> Sorry, I don't understand what you mean by the textual Plan 9 font file. do $ 9p read 'font/Go Mono/11/font' instead. the second line should point to the glyph file for runes 0x0 to 0xff, something like: 0x 0x00ff x.bit -- You received this message because you are subscribed to the Go

Re: [go-nuts] Google Grumpy (Python->Go)

2017-01-04 Thread andrey mirtchovski
> It’s also about 2x slower than the original Python. All of this indirection > is necessary to preserve the dynamic semantics of Python. Basically it’s > taking the calls into the runtime that a Python interpreter would make, and > writing them out one after another. this single-thread slowdow

Re: [go-nuts] Re: Gomobile: Getting errors when trying to build reverse example

2016-12-26 Thread andrey mirtchovski
I am attaching a simple reproduction of the package name crash (using reverse.go). There is no need to modify the android manifest file for this to trigger. The error I see is given below. I'm also attaching a proposed fix for the renaming clash which works for my case. I can submit it as a CL or

Re: [go-nuts] Re: Gomobile: Getting errors when trying to build reverse example

2016-12-25 Thread andrey mirtchovski
here is the diff for reproducing the JNI issue (I sent the previous email without it). my guess is that "context" needs to be resolved to the java side for this to work: $ git diff . diff --git a/example/reverse/reverse/reverse.go b/example/reverse/reverse/reverse.go index c4c3377..4ccf1e7 100644

Re: [go-nuts] Re: Gomobile: Getting errors when trying to build reverse example

2016-12-25 Thread andrey mirtchovski
Elias Naur wrote: > Hi, > > Can I persuade you to send a complete example that demonstrates the > package name clash problem and one that demonstrates the runtime JNI crash? > Thanks. > > - elias > > > On Saturday, December 24, 2016 at 11:27:56 PM UTC+1, andrey mirt

Re: [go-nuts] Re: Gomobile: Getting errors when trying to build reverse example

2016-12-24 Thread andrey mirtchovski
Apologies for the digression. > This suggests that you still have multiple `app` imports without each > having a unique name. Double check your imports in all source files being > compiled. > I have renamed both imports to something else and ensured there is nothing importing or using "app", how

Re: [go-nuts] Re: Gomobile: Getting errors when trying to build reverse example

2016-12-24 Thread andrey mirtchovski
> I haven't used these bindings but wouldn't you rename the v7 import as > > sapp "Java/android/support/v7/app" > > and then import > > "Java/android/app" > I'm still struggling with this. In my case I need v7.app as well as android.app and android.app.Service, so my imports are (as per your sugg

Re: [go-nuts] Modern Garbage Collection Article

2016-12-19 Thread andrey mirtchovski
My apologies to the original author, but the "state of the art" of modern garbage collectors is not acceptable if it means this: "To run dex in process, the Gradle daemon needs a larger heap. It currently has 1024 MB. For faster builds, increase the maximum heap size for the Gradle dae

[go-nuts] gomobile: support/v7/app vs app

2016-12-18 Thread andrey mirtchovski
The main activity in the reverse example uses a support/v7/app.AppCompatActivity (as it should), however if I want to add an app.Service service to the android app gomobile encounters duplicate import errors: gomobile_bind/go_appmain.go:20: app redeclared as imported package name If I attempt

[go-nuts] Re: gomobile: Intent.setClassName(String, String) called from Go?

2016-12-18 Thread andrey mirtchovski
Nevermind, found the missing piece with a bit more documentation-reading: SetClassName_Ljava_lang_String_2Ljava_lang_String_2 -- 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, s

[go-nuts] gomobile: Intent.setClassName(String, String) called from Go?

2016-12-18 Thread andrey mirtchovski
I'm trying to create a long-running service from Go by calling startService with an intent. I can't see how to create an intent with a Class from Go, so I want to do the second best thing, use setClassName*: intent := Intent.New() intent.SetClassName("package", "service") context.Start

Re: [go-nuts] go install seems to do a lot of rebuilding in a container

2016-12-07 Thread andrey mirtchovski
it's also possible that you need to do "go build -i" just in case your dependencies are outdated. i had the same issue today with a windows piece of code that rebuilt sqlite3 every time. On Wed, Dec 7, 2016 at 2:57 PM, Dave Cheney wrote: > Docker add, or whatever is pushing files into your conta

Re: [go-nuts] Re: latest gomobile arm64-only?

2016-12-05 Thread andrey mirtchovski
Thanks, this works perfectly! On Mon, Dec 5, 2016 at 3:33 AM, Elias Naur wrote: > > On Monday, December 5, 2016 at 7:44:23 AM UTC+1, andrey mirtchovski wrote: >> >> I'm having issues with the latest gomobile + reverse java bindings. I >> have a piece of code that li

[go-nuts] latest gomobile arm64-only?

2016-12-04 Thread andrey mirtchovski
I'm having issues with the latest gomobile + reverse java bindings. I have a piece of code that linked with a C library via CGO. Previously (around 6 months ago) everything appeared file: cross compile library with NDK toolchain (gcc), link against go code with cgo, run "gomobile bind -target=andro

<    1   2   3   >