Re: [go-nuts] mytex.RWLock recursive read lock

2020-09-21 Thread andrey mirtchovski
> Is this simply a recommendation or should the docs be updated to clarify what > this means? perhaps the latter, although that question only seems to come up once every two or so years. here's a good link: https://groups.google.com/d/msg/golang-nuts/XqW1qcuZgKg/Ui3nQkeLV80J the entire

Re: [go-nuts] Is there +v Stringer interface?

2020-06-24 Thread andrey mirtchovski
>> fmt.Formatter is woefully under documented. > > My reference is pkg/errros - > https://github.com/pkg/errors/blob/master/errors.go#L127 we have wasted tens of man-hours hunting for a bug that didn't manifest in logs due to that custom formatter. %#v basically went directly to stringer without

Re: [go-nuts] political fundraising on golang.org!

2020-06-14 Thread andrey mirtchovski
Hi, I have a non-profit I'd like to support. Who do I ask to put a banner on golang.org for me? (reductio ad absurdum) On Sun, Jun 14, 2020 at 4:08 PM Robert Engels wrote: > > Equating not supporting this and supporting marginalized groups is not > correct. You can support marginalized groups

Re: [go-nuts] Regarding time.NewTicker() and monotonic time

2020-06-10 Thread andrey mirtchovski
> Cool, makes sense. Assuming NewTicker does return monotonic time. > > I wonder if there is a way to verify. just fmt.Println the value you receive on the ticker chan, you'll see the monotonic component tacked on in the end: $ cat t.go package main import ( "fmt" "time" ) func main() {

Re: [go-nuts] Regarding time.NewTicker() and monotonic time

2020-06-10 Thread andrey mirtchovski
> Does anyone know if the time data that NewTicker returns (i.e. via it's > channel, etc...) includes monotonic time? it's right at the top: https://golang.org/pkg/time/ On Wed, Jun 10, 2020 at 4:48 PM Curtis Paul wrote: > > It sounds like NewTicker will dynamically adjust to keep tick time

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

[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

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

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

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

Re: [go-nuts] Virus detection issues on Windows/386 binaries built with -ldflags -s -w

2020-02-11 Thread andrey mirtchovski
sorry, wanted to add: submit your file to VT and see if it triggers a detection there (like in my link it is most likely that only the MS engine will detect it). then you have a case to argue. On Tue, Feb 11, 2020 at 9:29 PM andrey mirtchovski wrote: > > you can find similar dete

Re: [go-nuts] Virus detection issues on Windows/386 binaries built with -ldflags -s -w

2020-02-11 Thread andrey mirtchovski
you can find similar detections on virustotal. unfortunately it looks like a false positive: https://www.virustotal.com/gui/file/93eb448cedd4b4355065a4f9193d8548b02bc56ed5ba9e774095f9ab3da46227/detection there are members of this community working for microsoft, perhaps they'll have an avenue

Re: [go-nuts] Help with Oauth2 "grant_type=client_credentials"

2020-02-11 Thread andrey mirtchovski
i would strongly advise against implementing advice received online for something as important as auth. my suggestion is to work with curl from the command line (examples are given on the webpage you linked) until you have the process working. implementing that afterwards using http.Client will be

Re: [go-nuts] difference response from play.golang (bit operations)

2020-01-03 Thread andrey mirtchovski
sorry, i meant to put this in too; https://play.golang.org/p/vn5iMAWbDiv On Fri, Jan 3, 2020 at 11:27 AM andrey mirtchovski wrote: > > https://play.golang.org/p/cpKEQZJKDsh > > On Fri, Jan 3, 2020 at 11:24 AM X-Thief wrote: > > > > thx but have you tried it

Re: [go-nuts] difference response from play.golang (bit operations)

2020-01-03 Thread andrey mirtchovski
https://play.golang.org/p/cpKEQZJKDsh On Fri, Jan 3, 2020 at 11:24 AM X-Thief wrote: > > thx but have you tried it? it just gives positive on playground. > > пятница, 3 января 2020 г., 22:05:48 UTC+4 пользователь Ian Lance Taylor > написал: >> >> On Fri, Jan 3, 2020 at 9:50 AM X-Thief wrote:

Re: [go-nuts] Reordering error output in flags package so Usage is printed before the error?

2019-12-08 Thread andrey mirtchovski
You'll need to create a FlagSet instead and pass ContinueOnError as the error handling. If .Parse() returns an error call .PrintDefaults(), then print the error. On Sun, Dec 8, 2019 at 4:00 AM Thomas Nyberg wrote: > > Hello, > > Given the following file `flag_example.go`: > > package main > >

Re: [go-nuts] Re: Where is the middle of Brazil?

2019-12-07 Thread andrey mirtchovski
this is quickly becoming off-topic. however, from https://en.wikipedia.org/wiki/Geographical_centre: "As noted in a USGS document "There is no generally accepted definition of geographic center, and no completely satisfactory method for determining it."[1] In general, there is room for debate

Re: [go-nuts] cgo wrapper function not working in buildmode=c-shared with exported function

2019-12-05 Thread andrey mirtchovski
it once for callbacks in a library in 2013 and forgot about it :) it just works. On Thu, Dec 5, 2019 at 9:52 PM Dan Kortschak wrote: > > Thanks. Can you explain the reason for this so it sticks in my head? > > On Thu, 2019-12-05 at 21:03 -0700, andrey mirtchovski wrote: > > you

Re: [go-nuts] cgo wrapper function not working in buildmode=c-shared with exported function

2019-12-05 Thread andrey mirtchovski
you just need to split it in two files. the cfuncs go into another (sorry for lack of playground link): $ go build cgo.go cfunc.go $ ./cgo Hello from stdio $ cat cgo.go package main /* #include extern void myprint(char *s); */ import "C" import "unsafe" //export Example func Example() { cs

Re: [go-nuts] Where is the middle of Brazil?

2019-11-30 Thread andrey mirtchovski
i think JuciÊ wants us to crack the md5. i'm fresh off a CTF competition so i don't have any more resources to throw at warming the universe and increasing entropy, unfortunately... On Sat, Nov 30, 2019 at 6:43 PM Michael Jones wrote: > > > My answer is this place. > 14°35'03.5"S 53°03'51.3"W >

Re: [go-nuts] Re: Slices, backing array, goroutines, perhaps Considerations for Go2

2019-10-27 Thread andrey mirtchovski
>> I think it only catches concurrent access to the same address, so not sure >> if it catches everything. > > > If two things aren't writing concurrently to the same address, what's the > problem? I took that to mean 'things may be updating concurrently at different addresses inside an array

Re: [go-nuts] Where are the GO compiler sources?

2019-09-16 Thread andrey mirtchovski
'x' is for experimental. things that have a chance to get into the standard library but are not finished yet. the major differentiator is that they're not bound by the Go 1 guarantee that nothing changes (i.e., they can change). you should be able to find the compiler in

Re: [go-nuts] Re: If v2.x.y+incompatible exists, then getting the modules based v3 version will always fail?

2019-09-13 Thread andrey mirtchovski
are you following the steps outlined below? https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher in particular, for a v2 (or v3) it states that the go.mod file must be updated: > Update the go.mod file to include a /v3 at the end of the module path in the > module directive

Re: [go-nuts] playground - time.Sleep causes deadlock

2019-08-31 Thread andrey mirtchovski
see the "faking time" section here: https://blog.golang.org/playground not sure if anything has changed since that article On Sat, Aug 31, 2019 at 4:22 PM robert engels wrote: > Yes, the code runs fine locally. Reviewing the playground docs, it sees > that at one point time.Sleep() was a no-op

Re: [go-nuts] PCRE to RE2

2019-07-24 Thread andrey mirtchovski
I'm sorry to say that this list isn't RE2-specific (although one of the main Go contributors wrote RE2). you will probably get very good suggestions on how to convert that to Go's regex, which are RE2-like and I hope you find your answer. A good additional step to do for this particular list is

Re: [go-nuts] Re: About the Google logo on the new Go website

2019-07-18 Thread andrey mirtchovski
l I found is some very > general stuff. At least it very suspicious. I don't believe that Google can't > fund such a non-profit initiative without affecting true artists. > > And apparently, very unlikely, that you paid a cent to any independent artist > over that years. > > &

Re: [go-nuts] Re: About the Google logo on the new Go website

2019-07-18 Thread andrey mirtchovski
> Funny thing that today Google has announced "official" store for Go-related > merch, which in it's essence is a try to take away even an even tiny business > opportunities for artists who were creating some goods and had a very very > little outcome on this. Now they will have ZERO. really?

Re: [go-nuts] Re: About the Google logo on the new Go website

2019-07-15 Thread andrey mirtchovski
> Google invested in a tool for themselves, which helped a lot in getting some > zillions of bucks as return. Corps open smth to communities not because they > a "good", but because at some point they smart enough to make others work for > free. I see a "Go Haters Handbook" in the works. I

Re: [go-nuts] Passing Struct from Go to C

2019-07-10 Thread andrey mirtchovski
t; > I am new to Go and cgo therefore did not exactly understand your point. > Can you explain me in the context of the code that I had posted.It will > really help me to get hold of the things much better. > > Thanks, > Nitish > > On Wed, Jul 10, 2019 at 5:19 PM andrey mir

Re: [go-nuts] Passing Struct from Go to C

2019-07-10 Thread andrey mirtchovski
Hi Andrey, > > I understand the issue here but how can I pass a callback function in a > struct to C code.I need a struct because I want to pass and an extra > parameter 'userdata' as well that I would require back as part of callback. > > Thanks, > Nitish > > On Wed,

Re: [go-nuts] Passing Struct from Go to C

2019-07-10 Thread andrey mirtchovski
i don't think you can use a go function directly in the callback. you need a correctly-typed C helper to do it. at least that used to be the case. see examples: https://github.com/mirtchovski/clamav/blob/master/cfuncs.go https://github.com/mirtchovski/clamav/blob/master/callback.go -- You

Re: [go-nuts] The "leave "if err != nil" alone?" anti-proposal

2019-07-05 Thread andrey mirtchovski
easons I dislike exceptions. It's just really hard to reason about such > jumps in logic especially in massively concurrent programs that go allows us > to write. > > > > On Friday, July 5, 2019 at 10:30:43 PM UTC, andrey mirtchovski wrote: >> >> > So I was quiet on

Re: [go-nuts] The "leave "if err != nil" alone?" anti-proposal

2019-07-05 Thread andrey mirtchovski
> So I was quiet on the topic then - I am not now. i guess you missed the point where I advocated for a new survey, well advertised, where all the people who are fervent Go programmers but somehow neglected to fill out the Go surveys for three years running can cast their voice. "does go error

Re: [go-nuts] OOM occurring with a small heap

2019-07-02 Thread andrey mirtchovski
;> 0 0% 80.00% 1024.23kB 13.34% >> github.com/aws/aws-sdk-go/aws/signer/v4.(*signingCtx).build >> 0 0% 80.00% 1024.23kB 13.34% >> github.com/aws/aws-sdk-go/aws/signer/v4.SignSDKRequest >> 0 0% 80.00% 1024.23kB 13.34% >> git

Re: [go-nuts] OOM occurring with a small heap

2019-07-02 Thread andrey mirtchovski
What I have found useful in the past is pprof's ability to diff profiles. That means that if you capture heap profiles at regular intervals you can see a much smaller subset of changes and compare allocation patterns. On Tue, Jul 2, 2019, 10:53 AM 'Yunchi Luo' via golang-nuts <

Re: [go-nuts] Counter-counter-counter proposals

2019-06-30 Thread andrey mirtchovski
"Users don't care about what the designer does. They care about what they do. If every time you drove a car, you had to learn the meaning of 100 knobs, the whole system wouldn't work. Simplicity comes from tuning down the tasks required to drive the car into a certain set of understood paradigms

Re: [go-nuts] The "leave "if err != nil" alone?" anti-proposal

2019-06-29 Thread andrey mirtchovski
> I will let Andrey speak for himself. Since this is turning into a bit of fisticuffs I will quote my private message to you for clarity, here it is: --8<- Your point is a good one. I agree with your stance. > Which is why nothing should be done, because every proposal is going to

Re: [go-nuts] The "leave "if err != nil" alone?" anti-proposal

2019-06-29 Thread andrey mirtchovski
> go back to what is proven to work - Java and C++ are the dominant languages > in use today, adding their exception based error handling to Go is ‘the way > to Go” :) the battle you're fighting has already been lost. if you want java you know where to find it :) -- You received this message

Re: [go-nuts] The "leave "if err != nil" alone?" anti-proposal

2019-06-29 Thread andrey mirtchovski
> This issue seems to have resonated with a lot of people, which may be an > important data point when considering the try proposal Where were all those people when the Go Surveys were being taken the last few years? Overwhelmingly, the people have voted error handling as a major issue. The

Re: [go-nuts] Pointer Method Receiver

2019-06-16 Thread andrey mirtchovski
Hi Ali, I understand your desire to provide useful information about Go in blog posts. This is commendable. However let's try to keep this list for technical issues and keep empty posts containing just a link to a minimum. More signal, less noise. Is there a particular issue you'd like to raise?

Re: [go-nuts] https://godoc.org/github.com/couchbase/moss

2019-06-12 Thread andrey mirtchovski
collection is not an exported type: https://github.com/couchbase/moss/blob/master/collection.go#L24 the ?m=all parameter should enable you to see those, but it's not working for me on your link. perhaps because "collection" and "Collection" are not considered by godoc to be two different things?

Re: [go-nuts] How can I compile my project only relay on my vendor folder with go modules?

2019-06-11 Thread andrey mirtchovski
"go mod vendor" will populate the vendor directory in your project, then "go build -mod=vendor" will only use that directory to build. On Tue, Jun 11, 2019 at 3:12 AM 唐彦昭 wrote: > > I need put my project on the server to compile.But my server can't connect to > internet. > So I need to put all

Re: [go-nuts] Re: A good indicator of code quality

2019-06-06 Thread andrey mirtchovski
"does it look like the go standard library?" that style is desirable, yet inimitable -- 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

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

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

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

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

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

2019-04-30 Thread andrey mirtchovski
md64\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 > internal/sysc

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

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

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

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

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

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

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

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

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,

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

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

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

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

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

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

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

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

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

2019-01-23 Thread andrey mirtchovski
nt to 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

[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), >

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

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

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

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

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

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

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

[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

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 particul

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

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

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

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

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

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

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

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 <i...@golang.org> wrote: > On Thu, May 3, 2018 at 11:39 PM, andrey mirtchovski > <mirtchov...@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++

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

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

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

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

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

  1   2   3   >