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.

[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] 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] 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] 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

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] 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] 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] 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

[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] 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

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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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

[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] 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'

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

[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] 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

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] 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] [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] 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] 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] 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] 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] 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] [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] float accuracy when calculating Fibonacci numbers

2018-04-30 Thread andrey mirtchovski
every time float accuracy is mentioned i think of this: http://0.30004.com/ -- 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...@g

Re: [go-nuts] float accuracy when calculating Fibonacci numbers

2018-04-30 Thread andrey mirtchovski
> math.Pow does not give as precise answers as the C++ std lib. math pow doesn't just multiply X by itself Y times, it uses a different algorithm: https://golang.org/src/math/pow.go#L40 it would perhaps make sense to quantify the error margins that this algorithm introduces. not sure what c++ s

[go-nuts] panic: runtime: unknown pc

2018-05-03 Thread andrey mirtchovski
I believe I've never encountered this nor seen anyone mention this error before. It occurred while fuzzing a C library that we interface with: PC=0x7fffbafc847c m=0 sigcode=0 goroutine 0 [idle]: runtime: unknown pc 0x7fffbafc847c stack: frame={sp:0x7fff5fbff088, fp:0x0} stack=[0x7fff5fb80888,0x7f

Re: [go-nuts] panic: runtime: unknown pc

2018-05-04 Thread andrey mirtchovski
It is unfortunately not reproducible. I got 2 crashes out of 500 million executions. I've updated to tip and have not seen it since. On Fri, May 4, 2018 at 12:14 PM, Ian Lance Taylor wrote: > On Thu, May 3, 2018 at 11:39 PM, andrey mirtchovski > wrote: >> >> I believe

Re: [go-nuts] C.malloc of Go type?

2018-05-19 Thread andrey mirtchovski
also useful if you're dealing with blobs of C memory: https://utcc.utoronto.ca/~cks/space/blog/programming/GoCGoCompatibleStructs On Sat, May 19, 2018 at 3:03 PM, Jan Mercl <0xj...@gmail.com> wrote: > > On Sat, May 19, 2018 at 10:42 PM Max > wrote: > > > The question is: is it allowed to take t

Re: [go-nuts] Limit goroutine resource usage?

2018-08-15 Thread andrey mirtchovski
it seems from your suggested solutions that you're concerned about cpu usage. does the goroutine communicate with anything? you can limit its resources by feeding it less data (via a limiter goroutine) or by editing it itself do less work (via editing the code)? there is nothing inherently needed f

Re: [go-nuts] Re: function's argument default value

2018-08-23 Thread andrey mirtchovski
> You're right but I think developers of Go can think about that because its > benefits are obvious. can you please enumerate those benefits? many gophers are not convinced they are obvious. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To un

Re: [go-nuts] Run a method with nil pointer

2018-09-03 Thread andrey mirtchovski
Plenty of previous discussions on the subject. Here's an example from 2012: https://groups.google.com/d/msg/golang-nuts/wcrZ3P1zeAk/KaR68a8rROEJ I don't think reasoning has changed. On Mon, Sep 3, 2018 at 10:38 PM Dat Huynh wrote: > > Just a question. > > Why does Go allow to call a method with

Re: [go-nuts] Re: Go’s runtime vs virtual machine

2018-09-04 Thread andrey mirtchovski
> most languages offer programs at least some operating system like services > via a runtime service layer > -> in C, this was initially "crt0" the thin c runtime > -> in Go, the service layer is richer, offering thread management and > goroutine multiplexing, garbage collection, and more. > > th

Re: [go-nuts] Interaction of signals with defer

2018-09-18 Thread andrey mirtchovski
> It's a plausible mistake from any old Unix hand, I think. anecdotally, i ran into this very same issue yesterday when trying to instrument a 1.10 go program that allocated (but never used) more than 512 gigabytes of memory. i put in the memprofile saving code as a deferred closure in main and hi

Re: [go-nuts] Interaction of signals with defer

2018-09-18 Thread andrey mirtchovski
you're talking about https://github.com/pkg/profile, presumably. while i did find that fairly quickly and it appears to be very useful, it wasn't immediately obvious that it would solve my particular issue. unfortunately we're also averse to importing third-party packages without additional vetting

Re: [go-nuts] Interaction of signals with defer

2018-09-18 Thread andrey mirtchovski
On 19 Sep 2018, at 12:23, andrey mirtchovski wrote: > > > > you're talking about https://github.com/pkg/profile, presumably. while > > i did find that fairly quickly and it appears to be very useful, it > > wasn't immediately obvious that it would solve my p

[go-nuts] The benefits and costs of writing a POSIX kernel in a high-level language

2018-10-08 Thread andrey mirtchovski
I do not think this has been shared yet, please accept my apologies if this is a repeat. https://www.usenix.org/conference/osdi18/presentation/cutler The paper contributes Biscuit, a kernel written in Go that implements enough of POSIX (virtual memory, mmap, TCP/IP sockets, a logging file system,

Re: [go-nuts] Go fonts for linux (plan9port) acme?

2018-10-13 Thread andrey mirtchovski
on mac (and I suppose linux too) you can use fontsrv to extract the plan 9 font files as acme sees them. on my mac I did: $ fontsrv -m font $ acme -f font/GoMono/12a/font here are screenshots of GoRegular and GoMono in 12a: https://imgur.com/a/7xnGrmx I will send you privately a tar of GoMono/1

Re: [go-nuts] Re: Understanding the doc (why can't I?)

2018-10-15 Thread andrey mirtchovski
> Well, ok. But I would call “Shuffle” a misleading misnomer, because until the > user defines a shuffler function (which perversely might not, or might fail > to, shuffle anything), it does not shuffle anything. how would you implement shuffle in golang so that it's not a misleading misnomer? i

Re: [go-nuts] Understanding the doc (why can't I?)

2018-10-15 Thread andrey mirtchovski
> May be it ought to be called FYShuffle? then we'ld have to rename it if we switched the algorithm (which has happened once for sort.Sort already). that's not what go is about :) maybe you're advocating for implementing a Shuffle interface, which brings us round about to where we are right now :

Re: [go-nuts] Understanding the doc (why can't I?)

2018-10-15 Thread andrey mirtchovski
> Unlikely :-) > > The following is much less obscure. > > func Shuffle(slice inteface{}) > > & might have more more sense. e.g. > > var cards []card > ... > rand.Shuffle(cards) you've now restricted Shuffle to "shuffling" only slices. and it has to examine interface{}

Re: [go-nuts] Go language should become an ANSI and ISO standard.

2018-10-18 Thread andrey mirtchovski
> JavaScript needs a standard - there are many implementations and browsers. > For the moment, there is only one Go, and I like that. one go, but two reference implementation. any other implementation is expected to conscribe to the spec. -- You received this message because you are subscribed

Re: [go-nuts] Re: invalid months and years in time package

2018-10-23 Thread andrey mirtchovski
as https://golang.org/pkg/time/#Date says: The month, day, hour, min, sec, and nsec values may be outside their usual ranges and will be normalized during the conversion. For example, October 32 converts to November 1. On Tue, Oct 23, 2018 at 3:12 PM wrote: > > If you check the source code for th

Re: [go-nuts] Memory limits

2018-11-16 Thread andrey mirtchovski
The 512GB heap limit was removed in go 1.11. Here's the commit that did it, it has some additional information: https://github.com/golang/go/commit/2b415549b813ba36caafa34fc34d72e47ee8335c -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsub

Re: [go-nuts] Append array to slice of slice behavior puzzles me

2018-11-21 Thread andrey mirtchovski
this is a case of a variable being reused during a range loop. essentially k[:] is optimized to something resembling &k (a pointer to the memory location of the backing array) which is appended as such to the [][]int variable. the next iteration it is the same variable in memory, however it's point

Re: [go-nuts] C++ 11 to Golang convertor

2019-01-06 Thread andrey mirtchovski
> It would sure help if Go had sum types. Has there been any discussion > of adding these? one of many, but has links to others: https://github.com/golang/go/issues/19412 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this g

Re: [go-nuts] Re: What are the reasonable reasons to use pointers?

2019-01-11 Thread andrey mirtchovski
Incidentally, here's Hoare's proposal for records (structs), and pointers (references) for Algol 60: https://archive.computerhistory.org/resources/text/algol/algol_bulletin/A21/P36.HTM as with most things Hoare has produced, it is very well written and presents a very good justification for the e

[go-nuts] Re: [golang-dev] Re: [security] Go 1.11.5 and Go 1.10.8 are released

2019-01-23 Thread andrey mirtchovski
sorry to be a bother, but are you publishing new archives? will you publish new hashes for the archives with the commands executed thusly? On Wed, Jan 23, 2019 at 5:12 PM Julie Qiu wrote: > > Hello gophers, > > Due to an issue with the release tooling (https://golang.org/issue/29906), > go1.11.5

[go-nuts] Re: [golang-dev] Re: [security] Go 1.11.5 and Go 1.10.8 are released

2019-01-23 Thread andrey mirtchovski
o change the contents of > already published archives. > > Julie > > On Wed, Jan 23, 2019 at 8:00 PM andrey mirtchovski > wrote: >> >> sorry to be a bother, but are you publishing new archives? will you >> publish new hashes for the archives with the commands exe

Re: [go-nuts] Modules. A "new" system.

2019-02-05 Thread andrey mirtchovski
cray was optimized for throughput, after all ;) -- 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

Re: [go-nuts] go mod verify fails for github.com/docker/docker and github.com/hashicorp/go-rootcerts

2019-02-18 Thread andrey mirtchovski
There was a change to how go mod treats softlinks in repositories which changed the hash generated for some packages (we found out the issue via git.apache.org/thrift.git). If the repo contains softlinks and you generated your go.mod file before Go 1.11.3 (Go 1.11.2 still exhibited the bug) then th

Re: [go-nuts] Visual Studio Code oddity with Go

2019-02-21 Thread andrey mirtchovski
reposting my private comment from a day ago for those searching for answers: try "command-shift-p" or ctrl-shift-p depending on your operating system, to bring the "all commands" pop-up. there you should be able to find "Go: Install/Update tools". click on the checkboxes. hit enter. On Wed, Feb 2

Re: [go-nuts] Visual Studio Code oddity with Go

2019-02-21 Thread andrey mirtchovski
> I tried the solution posted by Andrey (Thank you!) and it still does the > popup thing. Oh well, it's a minor distraction, click update and it goes > away. If you go to the OUTPUT tab does it give you an error message? or does it say "things successfully installed"? -- You received this mes

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

2019-02-23 Thread andrey mirtchovski
in https://play.golang.org/p/5P5vcebYkGj you're shadowing s by creating a new variable via := this is a common go interview question :) On Sat, Feb 23, 2019 at 9:34 PM wrote: > > Hello, > > It's likely that I'm misinterpreting the language spec. It's also easy to > circumvent by assigning the o

Re: [go-nuts] What's the max amount of RAM a Go program can allocate on 64-bit Windows?

2019-03-05 Thread andrey mirtchovski
There used to be a 512GB heap limit which was removed in Go 1.11. Currently there should be no heap limit. For additional information see: https://github.com/golang/go/commit/2b415549b813ba36caafa34fc34d72e47ee8335c On Tue, Mar 5, 2019 at 2:08 PM wrote: > > I've seen various figures from older v

Re: [go-nuts] what does p stand for in io.Reader.Read argument

2019-04-06 Thread andrey mirtchovski
It may help to note that in the earliest references to the Read interface in the history of the language it accepted a *[]byte, hence 'p' may indeed stand for pointer. https://github.com/golang/go/commit/7c9e2c2b6c2e0aa3090dbd5183809e1b2f53359b#diff-bf734f53a84f388bf39699d291b06b1d -- You receiv

Re: [go-nuts] Interaction between Modules and GOPATH

2019-04-17 Thread andrey mirtchovski
> This is all fine and good until the project is fetched with a go get command, > which dumps everything directly into GOPATH, thereby preventing it from > fetching dependencies. If you are fetching it with "go get" then that's presumably because it's a dependency required by another package or

Re: [go-nuts] Interaction between Modules and GOPATH

2019-04-17 Thread andrey mirtchovski
> So do *not* use go get when manually cloning the project then I take it? That is correct. For most developers it would be one or more repositories that contain many modules, not all of which would be go-gettable anyway. Also note that "go get" in module mode (outside of GOPATH) will unpackage w

Re: [go-nuts] how to get file's current offset

2019-04-18 Thread andrey mirtchovski
offset, err := f.Seek(0, os.SEEK_CUR) On Thu, Apr 18, 2019 at 8:50 AM wrote: > > I want to know file's current read offset after open a file, but I can not > found related API. > > > > > > f, err := os.Open("/tmp/") > if err != nil{ > panic(err) > } > > ... // some read opera

Re: [go-nuts] how to get file's current offset

2019-04-18 Thread andrey mirtchovski
> offset, err := f.Seek(0, io.SeekCurrent) my code has been written so long ago i didn't even notice os.SEEK_CUR is deprecated :) -- 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

Re: [go-nuts] how to get file's current offset

2019-04-19 Thread andrey mirtchovski
On Fri, Apr 19, 2019, 4:48 PM Rob Pike wrote: > I just use 1 so I don't have to look up what it's called these days, but > I'm seriously old school. > Does that pass code review or do people give you the benefit of doubt? > -- You received this message because you are subscribed to the Google

Re: [go-nuts] The smaller argument a time.Sleep call takes, the more allocations?

2019-04-20 Thread andrey mirtchovski
You need the -benchmem flag to get a report of allocations: $ go test -bench=. -benchmem goos: darwin goarch: amd64 BenchmarkTestSleep_2000-4 1 2005447537 ns/op 456 B/op 3 allocs/op BenchmarkTestSleep_1000-4 1 1001627153 ns/op 64 B/op 1 allocs/op BenchmarkT

Re: [go-nuts] go build *.exe file size seems much too large

2019-04-21 Thread andrey mirtchovski
the go runtime (bare, nothing else) is about 1.1MB now. the "fmt" package brings almost a MB of dependencies including 800 or so unicode-related functions (names/symbols), reflection, etc. the math package brings almost nothing: 11 symbols. -8< $

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

2019-04-21 Thread andrey mirtchovski
wolfram alpha is a good place to do numbers: https://www.wolframalpha.com/input/?i=-1+%3C%3C+31 if you're on a mac, the calculator has a "programmer mode" which allows arbitrary manipulations of bits. On Sun, Apr 21, 2019 at 9:36 PM Pat Farrell wrote: > > I have a logic error in my calculation.

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

2019-04-23 Thread andrey mirtchovski
> ? (test) { > //...do something > } > { > //..do something else > } I believe the Go team considered this very carefully early on the language's development and came to the decision to use "if test" for "? (test)" and "} else {" for "}{" (without the implied newline). They also threw in "} else i

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

2019-04-24 Thread andrey mirtchovski
Here's the lore associated with the subject: Ken wanted ternary, Rob and Robert did not. They overruled Ken (remember, early on all three had to agree for a feature to go in). The end. The number of frivolous and egregious abuse of ternary that I've seen in _modern_ C code is too high.jpg -- You

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

2019-04-24 Thread andrey mirtchovski
> I may easily misremember, but that doesn't match my recollection. I > don't remember what position Rob and Robert took, but as I recall Ken > was generally opposed to the ternary operator. He had been in part > responsible for adding it to C, and felt that it had been a mistake. > > Ian I am h

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

2019-04-24 Thread andrey mirtchovski
Please do! We need to resolve this connundrum for the next 5 generations of computer programmers! On Wed, Apr 24, 2019 at 8:41 PM David Riley wrote: > > On Apr 24, 2019, at 5:25 PM, andrey mirtchovski wrote: > > > >> I may easily misremember, but that doesn't

Re: [go-nuts] strange bug

2019-04-28 Thread andrey mirtchovski
> So, the question is: why ‘i’ isn’t treated as unsigned, since it is a range > index - won't it always be positive? The author of the PR was most likely working on Go's tip (what will become 1.13), where the requirement that the right operator in a shift is an unsigned integer has been lifted.

Re: [go-nuts] strange bug

2019-04-28 Thread andrey mirtchovski
> But still, it would seem the range index should be unsigned - what would be > the purpose of it being signed? Similarly, the slice indexing should be > unsigned as well. Just thinking about it... not the first time this has come up. here are a couple of references: https://groups.google.com/d

Re: [go-nuts] Re: Need help to launch hello.go

2019-04-29 Thread andrey mirtchovski
try setting GOTMPDIR. not sure what this corresponds to on windows, but it will change where the go tool will create its temp files: $ go run -x t.go WORK=/var/folders/sp/06p28g2d0vs7gd2vhf26wl9mgn/T/go-build126372523 [...] $ GOTMPDIR=/tmp/go go run -x t.go WORK=/tmp/go/go-build661115935 [...]

Re: [go-nuts] Re: Need help to launch hello.go

2019-04-30 Thread andrey mirtchovski
> PS F:\GoWorckspace\src\hello> go install > open E:\temp\go-build447177998\b001\exe\a.out.exe: The system cannot find the > file specified. is this a school or work computer? if yes then a group policy may have disabled the execution of exe files. supply the "-work" argument to go build. it will

Re: [go-nuts] Re: Need help to launch hello.go

2019-04-30 Thread andrey mirtchovski
> PS F:\GoWorckspace\src\hello> go build -work > WORK=E:\temp\go-build828919622 > open E:\temp\go-build828919622\b001\exe\a.out.exe: The system cannot find the > file specified. once you have done this you should be able to cd to E:\temp\go-build828919622 and look around to see if any files have

Re: [go-nuts] Re: Need help to launch hello.go

2019-04-30 Thread andrey mirtchovski
\windows_amd64\unicode\utf16.a > packagefile unicode=C:\Go\pkg\windows_amd64\unicode.a > packagefile internal/race=C:\Go\pkg\windows_amd64\internal\race.a > packagefile > internal/syscall/windows/sysdll=C:\Go\pkg\windows_amd64\internal\syscall\windows\sysdll.a > packagefile > int

Re: [go-nuts] Re: If Go is using libc instead of syscalls on macOS now, why is it not shown via otool -L?

2019-05-03 Thread andrey mirtchovski
macOS doesn't support static linking user binaries. in fact I do see libSystem linked for each go binary on my Mojave system, including the simplest non-outputting hello world: $ cat > t.go package main; func main(){} $ go build t.go && otool -L t t: /usr/lib/libSystem.B.dylib (compatibility versi

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

2019-05-03 Thread andrey mirtchovski
https://www.ardanlabs.com/blog/2018/12/garbage-collection-in-go-part1-semantics.html -- 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...@googl

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

2019-05-03 Thread andrey mirtchovski
when you terminate a process the virtual memory associated with that process ceases to exist. any real memory associated with that process is not addressable anymore. if another process allocates a page that maps to a page previously held by the first process will get a zeroed-out page. you should

Re: [go-nuts] go runtime in DLL not getting intialized(?) on some windows hosts

2019-05-13 Thread andrey mirtchovski
file an issue, please, if you have not done so already. i'd like to follow it. On Mon, May 13, 2019 at 8:01 PM Jason E. Aten wrote: > > Indeed, confirming data: I can re-create the crashing circumstances > immediately by renaming C:\Go to C:\Go1.12.5. > > On Tuesday, May 14, 2019 at 3:53:10 AM U

Re: [go-nuts] Re: Interesting public commentary on Go...

2019-05-24 Thread andrey mirtchovski
On Fri, May 24, 2019 at 12:49 AM Rob Pike wrote: > > If that's true - and it might well not be - it's a surprise to me. When > launching the language we explicitly made sure NOT to trademark it. > Go appears to be trademarked, as well as the new design of the Go logo. Golang doesn't seem to be.

Re: [go-nuts] math.Atan implementation

2019-05-30 Thread andrey mirtchovski
Atan is implemented in assembly. for amd64 it's just a call to atan (lowercase a): https://golang.org/src/math/atan_amd64.s for 386 it is not: https://golang.org/src/math/atan_386.s On Thu, May 30, 2019 at 9:15 AM rhiro wrote: > > I'd like to see the implementation for math.Atan, but I see that

Re: [go-nuts] Re: [Proposal] Change how gofmt formats struct fields

2020-02-18 Thread andrey mirtchovski
?w=1 is an option. On Tue, Feb 18, 2020 at 7:16 PM Wojciech S. Czarnecki wrote: > > Dnia 2020-02-18, o godz. 10:16:57 > Manlio Perillo napisał(a): > > > Here is an example of a diff with a lot of noise, where the actual change > > is very hard to see: > > https://gist.github.com/perillo/c5b3bdff

Re: [go-nuts] Bound checks elimination hint.

2020-02-21 Thread andrey mirtchovski
got it down to two: https://play.golang.org/p/jmTqhLGaLY_T On Fri, Feb 21, 2020 at 11:24 AM Bruno Albuquerque wrote: > > This is interesting. If I simplify the loop to something like this: > > nrgbaData := make([]byte, len(rgbData)+(len(rgbData)/3)) > > _ = nrgbaData[len(rgbData)] > >

Re: [go-nuts] Fuchsia Programming Language Policy

2020-02-25 Thread andrey mirtchovski
my take: - c++ programmers are going to c++ program. film at 11 (rob pike had a talk about that) - dart has UI - rust is fashionable, but scary (if you've done rust you'll know why) yes, go was touted as a systems programming language, but it meant "distributed systems". had that been made clear f

Re: [go-nuts] how to design log package to avoid allocations

2020-03-09 Thread andrey mirtchovski
to avoid allocations you have to hint at the type of what you're going to print. for example see/use zerolog: https://github.com/rs/zerolog On Mon, Mar 9, 2020 at 10:36 AM 'Axel Wagner' via golang-nuts wrote: > > IMO, there really isn't a super good answer. The simple answer is: You need > to de

[go-nuts] net.ParseIP unable to parse some types of ipv6 addresses

2020-05-01 Thread andrey mirtchovski
IPv6 addresses including a zone identifier [rfc4007] are not parsed correctly by net.ParseIP. is there any point in creating an issue or is this intentional and we're supposed to strip the zone identifier? https://play.golang.org/p/kQKyYYnZydX -- You received this message because you are subscri

Re: [go-nuts] Re: net.ParseIP unable to parse some types of ipv6 addresses

2020-05-01 Thread andrey mirtchovski
thanks. that ought to do it. On Fri, May 1, 2020 at 11:16 AM Brian Candler wrote: > > parseIP returns a net.IP which is just a slice of bytes without the zone. > > However, type net.IPAddr includes the zone. Looks like net.ResolveIPAddr > will do the job: > > https://play.golang.org/p/7p1XXIrVG

  1   2   3   >